diff --git a/build/Helpers.lua b/build/Helpers.lua index bf9db600..099e427d 100644 --- a/build/Helpers.lua +++ b/build/Helpers.lua @@ -94,3 +94,28 @@ function IncludeDir(dir) end end end + +function StaticLinksOpt(libnames) + local cc = configuration() + local path = table.concat(cc.configset.libdirs, ";") + + local formats + if os.is("windows") then + formats = { "%s.lib" } + else + formats = { "lib%s.a" } + end + table.insert(formats, "%s"); + + local existing_libnames = {} + for _, libname in ipairs(libnames) do + for _, fmt in ipairs(formats) do + local name = string.format(fmt, libname) + if os.pathsearch(name, path) then + table.insert(existing_libnames, libname) + end + end + end + + links(existing_libnames) +end diff --git a/build/LLVM.lua b/build/LLVM.lua index 59fae3fd..fbdb3397 100644 --- a/build/LLVM.lua +++ b/build/LLVM.lua @@ -32,5 +32,49 @@ function SetupLLVMLibs() configuration "macosx" links { "c++", "curses", "pthread", "z" } + configuration "*" + links + { + "LLVMAnalysis", + "LLVMAsmParser", + "LLVMBitReader", + "LLVMBitWriter", + "LLVMCodeGen", + "LLVMCore", + "LLVMipa", + "LLVMipo", + "LLVMInstCombine", + "LLVMInstrumentation", + "LLVMIRReader", + "LLVMLinker", + "LLVMMC", + "LLVMMCParser", + "LLVMObjCARCOpts", + "LLVMObject", + "LLVMOption", + "LLVMScalarOpts", + "LLVMSupport", + "LLVMTarget", + "LLVMTransformUtils", + "LLVMVectorize", + "LLVMX86AsmParser", + "LLVMX86AsmPrinter", + "LLVMX86Desc", + "LLVMX86Info", + "LLVMX86Utils", + "clangAnalysis", + "clangAST", + "clangBasic", + "clangCodeGen", + "clangDriver", + "clangEdit", + "clangFrontend", + "clangLex", + "clangParse", + "clangSema", + "clangSerialization", + } + StaticLinksOpt { "LLVMProfileData" } + configuration(c) -end \ No newline at end of file +end diff --git a/src/CppParser/premake4.lua b/src/CppParser/premake4.lua index ab42bdf8..df9b87dd 100644 --- a/src/CppParser/premake4.lua +++ b/src/CppParser/premake4.lua @@ -31,49 +31,7 @@ project "CppSharp.CppParser" SetupLLVMLibs() configuration "*" - - links - { - "clangAnalysis", - "clangAST", - "clangBasic", - "clangCodeGen", - "clangDriver", - "clangEdit", - "clangFrontend", - "clangLex", - "clangParse", - "clangSema", - "clangSerialization", - "LLVMAnalysis", - "LLVMAsmParser", - "LLVMBitReader", - "LLVMBitWriter", - "LLVMCodeGen", - "LLVMCore", - "LLVMipa", - "LLVMipo", - "LLVMInstCombine", - "LLVMInstrumentation", - "LLVMIRReader", - "LLVMLinker", - "LLVMMC", - "LLVMMCParser", - "LLVMObjCARCOpts", - "LLVMObject", - "LLVMOption", - "LLVMScalarOpts", - "LLVMSupport", - "LLVMTarget", - "LLVMTransformUtils", - "LLVMVectorize", - "LLVMX86AsmParser", - "LLVMX86AsmPrinter", - "LLVMX86Desc", - "LLVMX86Info", - "LLVMX86Utils", - } end -include ("Bindings") \ No newline at end of file +include ("Bindings") diff --git a/src/Parser/Parser.lua b/src/Parser/Parser.lua index b2008414..dd6e9f08 100644 --- a/src/Parser/Parser.lua +++ b/src/Parser/Parser.lua @@ -48,44 +48,3 @@ project "CppSharp.Parser" configuration "*" - links - { - "LLVMAnalysis", - "LLVMAsmParser", - "LLVMBitReader", - "LLVMBitWriter", - "LLVMCodeGen", - "LLVMCore", - "LLVMipa", - "LLVMipo", - "LLVMInstCombine", - "LLVMInstrumentation", - "LLVMIRReader", - "LLVMLinker", - "LLVMMC", - "LLVMMCParser", - "LLVMObjCARCOpts", - "LLVMObject", - "LLVMOption", - "LLVMScalarOpts", - "LLVMSupport", - "LLVMTarget", - "LLVMTransformUtils", - "LLVMVectorize", - "LLVMX86AsmParser", - "LLVMX86AsmPrinter", - "LLVMX86Desc", - "LLVMX86Info", - "LLVMX86Utils", - "clangAnalysis", - "clangAST", - "clangBasic", - "clangDriver", - "clangEdit", - "clangFrontend", - "clangLex", - "clangParse", - "clangSema", - "clangSerialization", - "clangCodeGen", - } \ No newline at end of file