From 1c6538207e1a82a0ffd7299aec13ed1675b2ef6a Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sat, 5 Oct 2013 16:24:09 +0100 Subject: [PATCH] Fixed Premake build files for OSX. --- build/Helpers.lua | 6 +-- src/CppParser/Bindings/premake4.lua | 62 ++++++++++++++++------------- src/CppParser/premake4.lua | 13 ++++-- src/Generator/Generator.lua | 13 ++++-- 4 files changed, 58 insertions(+), 36 deletions(-) diff --git a/build/Helpers.lua b/build/Helpers.lua index d852c78b..cd9f835b 100644 --- a/build/Helpers.lua +++ b/build/Helpers.lua @@ -15,7 +15,7 @@ gendir = path.join(builddir, "gen"); common_flags = { "Unicode", "Symbols" } msvc_buildflags = { } -- "/wd4190", "/wd4996", "/wd4530" -gcc_buildflags = { "-std=gnu++11" } +gcc_buildflags = { "-std=c++11" } msvc_cpp_defines = { } @@ -39,8 +39,8 @@ function SetupNativeProject() buildoptions { msvc_buildflags } defines { msvc_cpp_defines } - configuration "gcc" - buildoptions { gcc_buildflags } + configuration { "macosx" } + buildoptions { gcc_buildflags, "-stdlib=libc++", "-fvisibility-inlines-hidden" } -- OS-specific options diff --git a/src/CppParser/Bindings/premake4.lua b/src/CppParser/Bindings/premake4.lua index 794e9d15..1ceac516 100644 --- a/src/CppParser/Bindings/premake4.lua +++ b/src/CppParser/Bindings/premake4.lua @@ -6,35 +6,13 @@ project "CppSharp.Parser.Gen" debugdir "." files { "ParserGen.cs", "*.lua" } - links { "CppSharp.AST", "CppSharp.Generator", "CppSharp.Parser" } + links { "CppSharp.AST", "CppSharp.Generator" } -project "CppSharp.Parser.CLI" - - kind "SharedLib" - language "C++" - SetupNativeProject() - - dependson { "CppSharp.CppParser" } - flags { common_flags, "Managed" } + configuration { "vs*" } + links { "CppSharp.Parser" } - configuration "vs*" - buildoptions { clang_msvc_flags } - - configuration "*" - - files - { - "CLI/AST.h", - "CLI/AST.cpp", - "CLI/**.h", - "CLI/**.cpp", - "**.lua" - } - - includedirs { "../../../include/", "../../../src/CppParser/" } - - configuration "*" - links { "CppSharp.CppParser" } + configuration { "not vs*" } + links { "CppSharp.Parser.CSharp" } project "CppSharp.Parser.CSharp" @@ -52,3 +30,33 @@ project "CppSharp.Parser.CSharp" } links { "CppSharp.Runtime" } + +configuration "vs*" + + project "CppSharp.Parser.CLI" + + kind "SharedLib" + language "C++" + SetupNativeProject() + + dependson { "CppSharp.CppParser" } + flags { common_flags, "Managed" } + + configuration "vs*" + buildoptions { clang_msvc_flags } + + configuration "*" + + files + { + "CLI/AST.h", + "CLI/AST.cpp", + "CLI/**.h", + "CLI/**.cpp", + "**.lua" + } + + includedirs { "../../../include/", "../../../src/CppParser/" } + + configuration "*" + links { "CppSharp.CppParser" } \ No newline at end of file diff --git a/src/CppParser/premake4.lua b/src/CppParser/premake4.lua index 2bae2dd1..a9763653 100644 --- a/src/CppParser/premake4.lua +++ b/src/CppParser/premake4.lua @@ -11,7 +11,7 @@ project "CppSharp.CppParser" language "C++" SetupNativeProject() flags { common_flags } - + flags { "NoRTTI" } configuration "vs*" buildoptions { clang_msvc_flags } @@ -35,11 +35,18 @@ project "CppSharp.CppParser" "../../deps/LLVM/build/tools/clang/include" } - configuration "Debug" + configuration { "Debug", "vs*" } libdirs { "../../deps/LLVM/build/lib/Debug" } - configuration "Release" + configuration { "Release", "vs*" } libdirs { "../../deps/LLVM/build/lib/RelWithDebInfo" } + + configuration "not vs*" + defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" } + libdirs { "../../deps/LLVM/build/lib" } + + configuration "macosx" + links { "c++", "curses", "pthread", "z" } configuration "*" diff --git a/src/Generator/Generator.lua b/src/Generator/Generator.lua index f8fcb194..3ad74355 100644 --- a/src/Generator/Generator.lua +++ b/src/Generator/Generator.lua @@ -6,8 +6,15 @@ project "CppSharp.Generator" files { "**.cs", "**.bmp", "**.resx", "**.config", "**verbs.txt" } excludes { "Filter.cs" } - - links { "System", "System.Core", "CppSharp.AST", "CppSharp.Parser" } - + + links { "System", "System.Core", "CppSharp.AST" } + + configuration "vs*" + links { "CppSharp.Parser" } + + configuration "not vs*" + dependson { "CppSharp.CppParser" } + links { "CppSharp.Parser.CSharp" } + configuration '**verbs.txt' buildaction "Embed"