11-- This module checks for the all the project dependencies.
2+ require (' vstudio' )
3+ require (' premake/premake.fixes' )
4+ require (' premake/premake.extensions' )
25
36newoption {
47 trigger = " arch" ,
58 description = " Choose a particular architecture / bitness" ,
9+ default = " x64" ,
610 allowed = {
711 { " x86" , " x86 32-bits" },
812 { " x64" , " x64 64-bits" },
9- { " AnyCPU" , " Any CPU (.NET)" },
1013 }
1114}
1215
@@ -26,99 +29,34 @@ newoption {
2629 }
2730
2831newoption {
29- trigger = " debug" ,
30- description = " enable debug mode"
32+ trigger = " configuration" ,
33+ description = " Choose a configuration" ,
34+ default = " Release" ,
35+ allowed = {
36+ { " Release" , " Release" },
37+ { " Debug" , " Debug" },
38+ }
3139}
3240
33- explicit_target_architecture = _OPTIONS [" arch" ]
34-
35- function get_mono_path ()
36- local mono = " mono"
37- local result , errorcode = os .outputof (mono .. " --version" )
38- if result == nil and os .ishost (" macosx" ) then
39- mono = " /Library/Frameworks/Mono.framework/Versions/Current/bin/" .. mono
40- result , errorcode = os .outputof (mono .. " --version" )
41- end
42- if result == nil then
43- print (" Could not find Mono executable, please make sure it is in PATH." )
44- os.exit (1 )
45- end
46- return mono
47- end
48-
49- function is_64_bits_mono_runtime ()
50- local result , errorcode = os .outputof (get_mono_path () .. " --version" )
51- local arch = string.match (result , " Architecture:%s*([%w]+)" )
52- return arch == " amd64"
53- end
54- default_gcc_version = " 9.0.0"
55-
56- function target_architecture ()
57- if _ACTION == " netcore" then
58- return " AnyCPU"
59- end
60-
61- -- Default to 64-bit on Windows and Mono architecture otherwise.
62- if explicit_target_architecture ~= nil then
63- return explicit_target_architecture
64- end
65- if os .ishost (" windows" ) then return " x64" end
66- return is_64_bits_mono_runtime () and " x64" or " x86"
67- end
68-
69- if not _OPTIONS [" arch" ] then
70- _OPTIONS [" arch" ] = target_architecture ()
71- end
72-
73- -- Uncomment to enable Roslyn compiler.
74- --[[
75- premake.override(premake.tools.dotnet, "gettoolname", function(base, cfg, tool)
76- if tool == "csc" then
77- return "csc"
78- end
79- return base(cfg, tool)
80- end)
81- ]]
82-
83- basedir = path .getdirectory (_PREMAKE_COMMAND )
84- premake .path = premake .path .. " ;" .. path .join (basedir , " modules" )
85-
86- depsdir = path .getabsolute (" ../deps" );
87- srcdir = path .getabsolute (" ../src" );
88- incdir = path .getabsolute (" ../include" );
89- bindir = path .getabsolute (" ../bin" );
90- examplesdir = path .getabsolute (" ../examples" );
91- testsdir = path .getabsolute (" ../tests" );
92-
93- local function get_build_dir ()
94- if _ARGS [1 ] then
95- return _ARGS [1 ]
96- end
97-
98- if not _ACTION then
99- return " "
100- end
101-
102- return _ACTION == " gmake2" and " gmake" or _ACTION
103- end
104-
105- builddir = path .getabsolute (" ./" .. get_build_dir ());
106-
107- if _ACTION ~= " netcore" then
108- objsdir = path .join (builddir , " obj" , " %{cfg.buildcfg}_%{cfg.platform}" );
109- libdir = path .join (builddir , " lib" , " %{cfg.buildcfg}_%{cfg.platform}" );
110- else
111- objsdir = path .join (builddir , " obj" , " %{cfg.buildcfg}" );
112- libdir = path .join (builddir , " lib" , " %{cfg.buildcfg}" );
113- end
114-
41+ rootdir = path .getabsolute (" ../" )
42+ depsdir = path .join (rootdir , " deps" );
43+ srcdir = path .join (rootdir , " src" );
44+ incdir = path .join (rootdir , " include" );
45+ examplesdir = path .join (rootdir , " examples" );
46+ testsdir = path .join (rootdir , " tests" );
47+ builddir = path .join (rootdir , " build" )
48+ bindir = path .join (rootdir , " bin" )
49+ objsdir = path .join (builddir , " obj" );
11550gendir = path .join (builddir , " gen" );
51+ actionbuilddir = path .join (builddir , _ACTION == " gmake2" and " gmake" or (_ACTION and _ACTION or " " ));
52+ bindircfg = path .join (bindir , " %{cfg.buildcfg}_%{cfg.platform}" );
53+ prjobjdir = path .join (objsdir , " %{prj.name}" , " %{cfg.buildcfg}" )
11654
11755msvc_buildflags = { " /MP" , " /wd4267" }
118-
11956msvc_cpp_defines = { }
120-
57+ default_gcc_version = " 9.0.0 "
12158generate_build_config = true
59+ premake .path = premake .path .. " ;" .. path .join (builddir , " modules" )
12260
12361function string .starts (str , start )
12462 if str == nil then return end
@@ -129,8 +67,13 @@ function SafePath(path)
12967 return " \" " .. path .. " \" "
13068end
13169
70+ function target_architecture ()
71+ return _OPTIONS [" arch" ]
72+ end
73+
13274function SetupNativeProject ()
13375 location (" %{wks.location}/projects" )
76+ files { " *.lua" }
13477
13578 filter { " configurations:Debug" }
13679 defines { " DEBUG" }
177120
178121function SetupManagedProject ()
179122 language " C#"
180- location (" %{wks.location}/projects" )
181- buildoptions {" /langversion:7.3" }
182- buildoptions {" /platform:" .. _OPTIONS [" arch" ]}
183-
184- dotnetframework " 4.7.2"
185-
186- if not os .istarget (" macosx" ) then
187- filter { " action:vs* or netcore" }
188- location " ."
189- filter {}
190- end
191-
192- filter { " action:netcore" }
193- dotnetframework " netstandard2.0"
194-
123+ location " ."
195124 filter {}
196125end
197126
@@ -271,15 +200,15 @@ function UseCxx11ABI()
271200end
272201
273202function EnableNativeProjects ()
274- if _ACTION == " netcore" then
275- return false
276- end
203+ return not (string .starts (_ACTION , " vs" ) and not os .ishost (" windows" ))
204+ end
277205
278- if string . starts ( _ACTION , " vs " ) and not os . ishost ( " windows " ) then
279- return false
280- end
206+ function EnabledManagedProjects ()
207+ return string . starts ( _ACTION , " vs " )
208+ end
281209
282- return true
210+ function EnabledCLIProjects ()
211+ return EnabledManagedProjects () and os .istarget (" windows" )
283212end
284213
285214function AddPlatformSpecificFiles (folder , filename )
0 commit comments