From 57ff6bb78cbc53b8d6422e54d213770949809c47 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 8 Oct 2013 00:10:34 +0100 Subject: [PATCH] MinGW/OSX build fixes. --- build/Helpers.lua | 3 +++ build/premake4.lua | 6 ++++-- src/AST/AST.lua | 4 +++- src/CppParser/premake4.lua | 20 ++++++++++++-------- src/Parser/Parser.lua | 24 +++++++++++++----------- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/build/Helpers.lua b/build/Helpers.lua index cd9f835b..475bed46 100644 --- a/build/Helpers.lua +++ b/build/Helpers.lua @@ -38,6 +38,9 @@ function SetupNativeProject() configuration "vs*" buildoptions { msvc_buildflags } defines { msvc_cpp_defines } + + configuration { "gmake" } + buildoptions { gcc_buildflags } configuration { "macosx" } buildoptions { gcc_buildflags, "-stdlib=libc++", "-fvisibility-inlines-hidden" } diff --git a/build/premake4.lua b/build/premake4.lua index f947b052..9872b557 100644 --- a/build/premake4.lua +++ b/build/premake4.lua @@ -22,7 +22,7 @@ solution "CppSharp" -- startproject "Generator" configuration "Release" - flags { "Optimize" } + optimize() configuration "vs2012" framework "4.0" @@ -42,6 +42,8 @@ solution "CppSharp" include (srcdir .. "/AST/AST.lua") include (srcdir .. "/Generator/Generator.lua") include (srcdir .. "/Generator.Tests/Generator.Tests.lua") - include (srcdir .. "/Parser/Parser.lua") include (srcdir .. "/Runtime/Runtime.lua") include (srcdir .. "/CppParser") + + --configuration "vs*" + --include (srcdir .. "/Parser/Parser.lua") diff --git a/src/AST/AST.lua b/src/AST/AST.lua index 96ea4863..da3f286c 100644 --- a/src/AST/AST.lua +++ b/src/AST/AST.lua @@ -2,7 +2,9 @@ project "CppSharp.AST" kind "SharedLib" language "C#" - location "." + + configuration "vs*" + location "." files { "*.cs" } links { "System", "System.Core" } \ No newline at end of file diff --git a/src/CppParser/premake4.lua b/src/CppParser/premake4.lua index a9763653..a4a3063a 100644 --- a/src/CppParser/premake4.lua +++ b/src/CppParser/premake4.lua @@ -5,6 +5,9 @@ clang_msvc_flags = "/wd4251" } +LLVMRootDir = "../../deps/LLVM/" +LLVMBuildDir = "../../deps/LLVM/build_mingw/" + project "CppSharp.CppParser" kind "SharedLib" @@ -28,22 +31,23 @@ project "CppSharp.CppParser" includedirs { - "../../deps/LLVM/include", - "../../deps/LLVM/build/include", - "../../deps/LLVM/tools/clang/include", - "../../deps/LLVM/tools/clang/lib", - "../../deps/LLVM/build/tools/clang/include" + path.join(LLVMRootDir, "include"), + path.join(LLVMRootDir, "tools/clang/include"), + path.join(LLVMRootDir, "tools/clang/lib"), + path.join(LLVMBuildDir, "include"), + path.join(LLVMBuildDir, "tools/clang/include"), } configuration { "Debug", "vs*" } - libdirs { "../../deps/LLVM/build/lib/Debug" } + libdirs { path.join(LLVMBuildDir, "lib/Debug") } configuration { "Release", "vs*" } - libdirs { "../../deps/LLVM/build/lib/RelWithDebInfo" } + libdirs { path.join(LLVMBuildDir, "lib/RelWithDebInfo") } configuration "not vs*" + buildoptions { "-fpermissive" } defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" } - libdirs { "../../deps/LLVM/build/lib" } + libdirs { path.join(LLVMBuildDir, "lib") } configuration "macosx" links { "c++", "curses", "pthread", "z" } diff --git a/src/Parser/Parser.lua b/src/Parser/Parser.lua index e2bda679..212e0ad5 100644 --- a/src/Parser/Parser.lua +++ b/src/Parser/Parser.lua @@ -13,6 +13,8 @@ project "CppSharp.Parser" dependson { "CppSharp.AST" } flags { common_flags, "Managed" } + usingdirs { libdir } + -- usingdirs is only supported in per-file configs in our -- premake build. remove this once this support is added -- at the project level. @@ -61,17 +63,6 @@ project "CppSharp.Parser" links { - "clangAnalysis", - "clangAST", - "clangBasic", - "clangCodeGen", - "clangDriver", - "clangEdit", - "clangFrontend", - "clangLex", - "clangParse", - "clangSema", - "clangSerialization", "LLVMAnalysis", "LLVMAsmParser", "LLVMBitReader", @@ -99,4 +90,15 @@ project "CppSharp.Parser" "LLVMX86Desc", "LLVMX86Info", "LLVMX86Utils", + "clangAnalysis", + "clangAST", + "clangBasic", + "clangDriver", + "clangEdit", + "clangFrontend", + "clangLex", + "clangParse", + "clangSema", + "clangSerialization", + "clangCodeGen", } \ No newline at end of file