diff --git a/build/Helpers.lua b/build/Helpers.lua index c83902e1..27a5f18d 100644 --- a/build/Helpers.lua +++ b/build/Helpers.lua @@ -140,7 +140,7 @@ function SetupNativeProject() -- Compiler-specific options - filter { "action:vs*" } + filter { "toolset:msc*" } buildoptions { msvc_buildflags } defines { msvc_cpp_defines } @@ -158,7 +158,7 @@ function SetupNativeProject() buildoptions { gcc_buildflags, "-stdlib=libc++" } links { "c++" } - filter { "system:not windows", "language:C++" } + filter { "toolset:not msc*", "language:C++" } cppdialect "C++14" buildoptions { "-fpermissive" } @@ -168,7 +168,7 @@ function SetupNativeProject() defines { "WIN32", "_WINDOWS" } -- For context: https://github.com/premake/premake-core/issues/935 - filter {"system:windows", "action:vs*"} + filter {"system:windows", "toolset:msc*"} systemversion("latest") filter {} @@ -277,3 +277,23 @@ function EnableNativeProjects() return true end + +function AddPlatformSpecificFiles(folder, filename) + + if os.istarget("windows") then + filter { "toolset:msc*", "architecture:x86_64" } + files { path.join(folder, "x86_64-pc-win32-msvc", filename) } + filter { "toolset:msc*", "architecture:x86" } + files { path.join(folder, "i686-pc-win32-msvc", filename) } + elseif os.istarget("macosx") then + filter { "architecture:x86_64" } + files { path.join(folder, "x86_64-apple-darwin12.4.0", filename) } + filter {"architecture:x86" } + files { path.join(folder, "i686-apple-darwin12.4.0", filename) } + elseif os.istarget("linux") then + filter { "architecture:x86_64" } + files { path.join(folder, "x86_64-linux-gnu" .. (UseCxx11ABI() and "-cxx11abi" or ""), filename) } + else + print "Unknown architecture" + end +end diff --git a/build/LLVM.lua b/build/LLVM.lua index cc8e7670..045e0ce0 100644 --- a/build/LLVM.lua +++ b/build/LLVM.lua @@ -104,13 +104,13 @@ end function SetupLLVMLibs() local c = filter() - filter { "action:not vs*" } + filter { "system:not msc*" } defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" } filter { "system:macosx" } links { "c++", "curses", "pthread", "z" } - filter { "action:vs*" } + filter { "toolset:msc*" } links { "version" } filter {} @@ -125,10 +125,10 @@ function SetupLLVMLibs() local LLVMBuildDir = get_llvm_build_dir() libdirs { path.join(LLVMBuildDir, "lib") } - filter { "configurations:Debug", "action:vs*" } + filter { "configurations:Debug", "toolset:msc*" } libdirs { path.join(LLVMBuildDir, "Debug/lib") } - filter { "configurations:Release", "action:vs*" } + filter { "configurations:Release", "toolset:msc*" } libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") } end diff --git a/src/ASTViewer/premake5.lua b/src/ASTViewer/premake5.lua index b217ace1..f27afaa9 100644 --- a/src/ASTViewer/premake5.lua +++ b/src/ASTViewer/premake5.lua @@ -28,5 +28,5 @@ project "CppSharp.ASTViewer" SetupLLVMIncludes() SetupLLVMLibs() - filter { "action:vs*" } + filter { "toolset:msc*" } buildoptions { "/wd4141", "/wd4146", "/wd4996" } diff --git a/src/CppParser/Bindings/CLI/premake5.lua b/src/CppParser/Bindings/CLI/premake5.lua index f0dcd194..a652d0c2 100644 --- a/src/CppParser/Bindings/CLI/premake5.lua +++ b/src/CppParser/Bindings/CLI/premake5.lua @@ -11,7 +11,7 @@ project "CppSharp.Parser.CLI" flags { common_flags } clr "On" - filter "action:vs*" + filter "toolset:msc*" buildoptions { clang_msvc_flags } filter {} diff --git a/src/CppParser/Bindings/CSharp/premake5.lua b/src/CppParser/Bindings/CSharp/premake5.lua index 7f6b2bbc..1c179f95 100644 --- a/src/CppParser/Bindings/CSharp/premake5.lua +++ b/src/CppParser/Bindings/CSharp/premake5.lua @@ -13,29 +13,7 @@ project "CppSharp.Parser.CSharp" links { "CppSharp.Runtime" } - if os.istarget("windows") then - filter { "action:vs*", "platforms:x86" } - files { "i686-pc-win32-msvc/**.cs" } - filter { "action:vs*", "platforms:x64" } - files { "x86_64-pc-win32-msvc/**.cs" } - elseif os.istarget("macosx") then - if is_64_bits_mono_runtime() or _OPTIONS["arch"] == "x64" then - files { "x86_64-apple-darwin12.4.0/**.cs" } - else - files { "i686-apple-darwin12.4.0/**.cs" } - end - - elseif os.istarget("linux") then - local abi = "" - if UseCxx11ABI() then - abi = "-cxx11abi" - end - files { "x86_64-linux-gnu"..abi.."/**.cs" } - else - print "Unknown architecture" - end - - filter {} + AddPlatformSpecificFiles("", "**.cs") function SetupParser() links diff --git a/src/CppParser/premake5.lua b/src/CppParser/premake5.lua index 63f5a4f5..dfe0b582 100644 --- a/src/CppParser/premake5.lua +++ b/src/CppParser/premake5.lua @@ -20,7 +20,7 @@ project "CppSharp.CppParser" linkgroups "On" end - filter "action:vs*" + filter "toolset:msc*" buildoptions { clang_msvc_flags } linkoptions { "/ignore:4099" } -- LNK4099: linking object as if no debug info @@ -49,32 +49,10 @@ project "Std-symbols" rtti "Off" defines { "DLL_EXPORT" } - filter { "action:vs*" } + filter { "toolset:msc*" } buildoptions { clang_msvc_flags } filter {} - if os.istarget("windows") then - filter { "action:vs*", "platforms:x86" } - files { "Bindings/CSharp/i686-pc-win32-msvc/Std-symbols.cpp" } - filter { "action:vs*", "platforms:x64" } - files { "Bindings/CSharp/x86_64-pc-win32-msvc/Std-symbols.cpp" } - elseif os.istarget("macosx") then - if is_64_bits_mono_runtime() or _OPTIONS["arch"] == "x64" then - files { "Bindings/CSharp/x86_64-apple-darwin12.4.0/Std-symbols.cpp" } - else - files { "Bindings/CSharp/i686-apple-darwin12.4.0/Std-symbols.cpp" } - end - elseif os.istarget("linux") then - local abi = "" - if UseCxx11ABI() then - abi = "-cxx11abi" - end - files { "Bindings/CSharp/x86_64-linux-gnu"..abi.."/Std-symbols.cpp" } - else - print "Unknown architecture" - end - - filter {} - + AddPlatformSpecificFiles("Bindings/CSharp", "Std-symbols.cpp") end diff --git a/src/Runtime/premake5.lua b/src/Runtime/premake5.lua index b4ce12c0..7c683523 100644 --- a/src/Runtime/premake5.lua +++ b/src/Runtime/premake5.lua @@ -12,7 +12,7 @@ project "CppSharp.Runtime" filter { "action:not netcore"} links { "System" } - filter { "action:vs*" } + filter { "toolset:msc*" } defines { "MSVC" } filter { "system:macosx" }