Skip to content

Commit 9e80865

Browse files
authored
Avoid using "action:vs* filter because there are better ones that are more specific (#1523)
1 parent ea9ec7f commit 9e80865

File tree

7 files changed

+34
-58
lines changed

7 files changed

+34
-58
lines changed

build/Helpers.lua

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function SetupNativeProject()
140140

141141
-- Compiler-specific options
142142

143-
filter { "action:vs*" }
143+
filter { "toolset:msc*" }
144144
buildoptions { msvc_buildflags }
145145
defines { msvc_cpp_defines }
146146

@@ -158,7 +158,7 @@ function SetupNativeProject()
158158
buildoptions { gcc_buildflags, "-stdlib=libc++" }
159159
links { "c++" }
160160

161-
filter { "system:not windows", "language:C++" }
161+
filter { "toolset:not msc*", "language:C++" }
162162
cppdialect "C++14"
163163
buildoptions { "-fpermissive" }
164164

@@ -168,7 +168,7 @@ function SetupNativeProject()
168168
defines { "WIN32", "_WINDOWS" }
169169

170170
-- For context: https://github.com/premake/premake-core/issues/935
171-
filter {"system:windows", "action:vs*"}
171+
filter {"system:windows", "toolset:msc*"}
172172
systemversion("latest")
173173

174174
filter {}
@@ -277,3 +277,23 @@ function EnableNativeProjects()
277277

278278
return true
279279
end
280+
281+
function AddPlatformSpecificFiles(folder, filename)
282+
283+
if os.istarget("windows") then
284+
filter { "toolset:msc*", "architecture:x86_64" }
285+
files { path.join(folder, "x86_64-pc-win32-msvc", filename) }
286+
filter { "toolset:msc*", "architecture:x86" }
287+
files { path.join(folder, "i686-pc-win32-msvc", filename) }
288+
elseif os.istarget("macosx") then
289+
filter { "architecture:x86_64" }
290+
files { path.join(folder, "x86_64-apple-darwin12.4.0", filename) }
291+
filter {"architecture:x86" }
292+
files { path.join(folder, "i686-apple-darwin12.4.0", filename) }
293+
elseif os.istarget("linux") then
294+
filter { "architecture:x86_64" }
295+
files { path.join(folder, "x86_64-linux-gnu" .. (UseCxx11ABI() and "-cxx11abi" or ""), filename) }
296+
else
297+
print "Unknown architecture"
298+
end
299+
end

build/LLVM.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ end
104104
function SetupLLVMLibs()
105105
local c = filter()
106106

107-
filter { "action:not vs*" }
107+
filter { "system:not msc*" }
108108
defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" }
109109

110110
filter { "system:macosx" }
111111
links { "c++", "curses", "pthread", "z" }
112112

113-
filter { "action:vs*" }
113+
filter { "toolset:msc*" }
114114
links { "version" }
115115

116116
filter {}
@@ -125,10 +125,10 @@ function SetupLLVMLibs()
125125
local LLVMBuildDir = get_llvm_build_dir()
126126
libdirs { path.join(LLVMBuildDir, "lib") }
127127

128-
filter { "configurations:Debug", "action:vs*" }
128+
filter { "configurations:Debug", "toolset:msc*" }
129129
libdirs { path.join(LLVMBuildDir, "Debug/lib") }
130130

131-
filter { "configurations:Release", "action:vs*" }
131+
filter { "configurations:Release", "toolset:msc*" }
132132
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
133133
end
134134

src/ASTViewer/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ project "CppSharp.ASTViewer"
2828
SetupLLVMIncludes()
2929
SetupLLVMLibs()
3030

31-
filter { "action:vs*" }
31+
filter { "toolset:msc*" }
3232
buildoptions { "/wd4141", "/wd4146", "/wd4996" }

src/CppParser/Bindings/CLI/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ project "CppSharp.Parser.CLI"
1111
flags { common_flags }
1212
clr "On"
1313

14-
filter "action:vs*"
14+
filter "toolset:msc*"
1515
buildoptions { clang_msvc_flags }
1616

1717
filter {}

src/CppParser/Bindings/CSharp/premake5.lua

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,7 @@ project "CppSharp.Parser.CSharp"
1313

1414
links { "CppSharp.Runtime" }
1515

16-
if os.istarget("windows") then
17-
filter { "action:vs*", "platforms:x86" }
18-
files { "i686-pc-win32-msvc/**.cs" }
19-
filter { "action:vs*", "platforms:x64" }
20-
files { "x86_64-pc-win32-msvc/**.cs" }
21-
elseif os.istarget("macosx") then
22-
if is_64_bits_mono_runtime() or _OPTIONS["arch"] == "x64" then
23-
files { "x86_64-apple-darwin12.4.0/**.cs" }
24-
else
25-
files { "i686-apple-darwin12.4.0/**.cs" }
26-
end
27-
28-
elseif os.istarget("linux") then
29-
local abi = ""
30-
if UseCxx11ABI() then
31-
abi = "-cxx11abi"
32-
end
33-
files { "x86_64-linux-gnu"..abi.."/**.cs" }
34-
else
35-
print "Unknown architecture"
36-
end
37-
38-
filter {}
16+
AddPlatformSpecificFiles("", "**.cs")
3917

4018
function SetupParser()
4119
links

src/CppParser/premake5.lua

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ project "CppSharp.CppParser"
2020
linkgroups "On"
2121
end
2222

23-
filter "action:vs*"
23+
filter "toolset:msc*"
2424
buildoptions { clang_msvc_flags }
2525

2626
linkoptions { "/ignore:4099" } -- LNK4099: linking object as if no debug info
@@ -49,32 +49,10 @@ project "Std-symbols"
4949
rtti "Off"
5050
defines { "DLL_EXPORT" }
5151

52-
filter { "action:vs*" }
52+
filter { "toolset:msc*" }
5353
buildoptions { clang_msvc_flags }
5454

5555
filter {}
5656

57-
if os.istarget("windows") then
58-
filter { "action:vs*", "platforms:x86" }
59-
files { "Bindings/CSharp/i686-pc-win32-msvc/Std-symbols.cpp" }
60-
filter { "action:vs*", "platforms:x64" }
61-
files { "Bindings/CSharp/x86_64-pc-win32-msvc/Std-symbols.cpp" }
62-
elseif os.istarget("macosx") then
63-
if is_64_bits_mono_runtime() or _OPTIONS["arch"] == "x64" then
64-
files { "Bindings/CSharp/x86_64-apple-darwin12.4.0/Std-symbols.cpp" }
65-
else
66-
files { "Bindings/CSharp/i686-apple-darwin12.4.0/Std-symbols.cpp" }
67-
end
68-
elseif os.istarget("linux") then
69-
local abi = ""
70-
if UseCxx11ABI() then
71-
abi = "-cxx11abi"
72-
end
73-
files { "Bindings/CSharp/x86_64-linux-gnu"..abi.."/Std-symbols.cpp" }
74-
else
75-
print "Unknown architecture"
76-
end
77-
78-
filter {}
79-
57+
AddPlatformSpecificFiles("Bindings/CSharp", "Std-symbols.cpp")
8058
end

src/Runtime/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ project "CppSharp.Runtime"
1212
filter { "action:not netcore"}
1313
links { "System" }
1414

15-
filter { "action:vs*" }
15+
filter { "toolset:msc*" }
1616
defines { "MSVC" }
1717

1818
filter { "system:macosx" }

0 commit comments

Comments
 (0)