-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathxmake.lua
68 lines (55 loc) · 1.73 KB
/
xmake.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
set_xmakever("2.9.4")
add_rules("mode.debug", "mode.release")
set_allowedmodes("debug", "release")
set_allowedplats("windows", "linux", "macosx")
-- Set C/C++ language version
set_languages("c17", "cxx23")
-- Build debug mode by default
set_defaultmode("debug")
-- Project name and version
set_project("CrossVL")
set_version("0.0.1")
-- Enable all warnings and handle them as compilation errors
set_policy("build.warning", true)
set_warnings("all", "extra")
-- Enable link time optimization
set_policy("build.optimization.lto", true)
-- Allow auto build before running
set_policy("run.autobuild", true)
-- Generate compile_commands.json on build_should_pas
add_rules("plugin.compile_commands.autoupdate")
-- Include xmake build scripts
includes("Scripts/Options.lua")
includes("Scripts/Rules.lua")
includes("Scripts/Packages.lua")
includes("Scripts/Plugins/xmake.lua")
-- Set RHI macros
if has_config("rhi") then
local rhi = string.upper(get_config("rhi"))
local macro = "CGL_RHI_" .. rhi
add_defines(macro)
if rhi == "DX11" or rhi == "DX12" then
add_defines("CGL_RHI_D3D")
end
end
-- Add OS specific macros
if is_os("windows") then
add_defines("NOMINMAX", "NOMCX", "NOSERVICE", "NOHELP", "WIN32_LEAN_AND_MEAN")
add_defines("CGL_PLATFORM_WINDOWS")
elseif is_os("linux") then
add_defines("CGL_PLATFORM_LINUX")
elseif is_os("macosx") then
add_defines("CGL_PLATFORM_MACOSX")
add_includedirs("./metal-cpp/")
end
-- Add build config specific macros (and set runtimes)
if is_mode("debug") then
add_defines("CGL_BUILD_DEBUG", "_DEBUG")
set_runtimes("MDd")
elseif is_mode("release") then
add_defines("CGL_BUILD_RELEASE", "NDEBUG")
set_runtimes("MD")
end
-- include xmake projects
includes("Core/xmake.lua")
includes("Samples/**/xmake.lua")