-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxmake.lua
More file actions
88 lines (74 loc) · 2.16 KB
/
xmake.lua
File metadata and controls
88 lines (74 loc) · 2.16 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
-- set project name
set_project("Vultra")
-- set project version
set_version("0.1.0")
-- set language version: C++ 23
set_languages("cxx23")
-- global options
option("tests") -- build tests?
set_default(true)
set_showmenu(true)
set_description("Enable tests")
option_end()
-- if build on windows
if is_plat("windows") then
add_cxxflags("/Zc:__cplusplus", {tools = {"msvc", "cl"}}) -- fix __cplusplus == 199711L error
add_cxxflags("/bigobj") -- avoid big obj
add_cxxflags("-D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING")
add_cxxflags("/EHsc")
if is_mode("debug") then
set_runtimes("MDd")
add_links("ucrtd")
else
set_runtimes("MD")
end
else
add_cxxflags("-fexceptions")
end
-- add rules
rule("imguiconfig")
set_extensions(".ini")
on_build_file(function (target, sourcefile, opt) end)
after_build_file(function (target, sourcefile, opt)
if path.basename(sourcefile) ~= "imgui" then
return
end
local output_path = path.join(target:targetdir(), path.filename(sourcefile))
os.cp(sourcefile, output_path)
print("Copying imgui config: " .. sourcefile .. " -> " .. output_path)
end)
rule_end()
rule("linux.sdl.driver")
before_run(function (target)
if is_plat("linux") then
if has_config("wayland") then
os.setenv("SDL_VIDEODRIVER", "wayland")
else
os.setenv("SDL_VIDEODRIVER", "x11")
end
end
end)
rule_end()
rule("clangd.config")
on_config(function (target)
if is_host("windows") then
os.cp(".clangd.win", ".clangd")
else
os.cp(".clangd.nowin", ".clangd")
end
end)
rule_end()
add_rules("mode.debug", "mode.release")
add_rules("plugin.vsxmake.autoupdate")
add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode", lsp = "clangd"})
add_rules("clangd.config")
-- add repositories
add_repositories("my-xmake-repo https://github.com/zzxzzk115/xmake-repo.git backup")
-- include external
includes("external")
-- include source
includes("source")
-- include tests
if has_config("tests") then
includes("tests")
end