-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathxmake.lua
102 lines (76 loc) · 1.99 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
-- Global settings
add_requires("libsdl", { configs = { sdlmain = false } })
add_rules("mode.debug", "mode.release", "mode.releasedbg")
set_languages("cxx20", "c11")
set_objectdir("objs/xmake/$(os)_$(arch)")
set_targetdir("./")
set_optimize("fastest")
-- Options
option("images_optimized")
set_default(true)
add_defines("IMAGE_OPTIMIZED")
option_end()
option("force_integrated_gpu")
set_default(false)
add_defines("FORCE_INTEGRATED_GPU")
option_end()
option("graphics_memory_dump")
set_default(false)
add_defines("GRAPHICS_MEMORY_DUMP")
option_end()
option("profiler")
set_default(false)
add_defines("PROFILER")
option_end()
option("force_wayland")
set_default(false)
add_defines("FORCE_WAYLAND")
option_end()
option("disable_all_safeties")
set_default(false)
add_defines("DISABLE_ALL_SAFETIES")
option_end()
-- Targets
target("mlx")
set_default(true)
set_license("MIT")
set_kind("shared")
add_options("images_optimized")
add_options("force_integrated_gpu")
add_options("graphics_memory_dump")
add_options("profiler")
add_options("force_wayland")
add_options("disable_all_safeties")
add_includedirs("runtime/Includes", "runtime/Sources", "includes", "third_party")
set_pcxxheader("runtime/Includes/PreCompiled.h")
add_defines("MLX_BUILD", "SDL_MAIN_HANDLED")
add_files("runtime/Sources/**.cpp")
add_packages("libsdl")
if is_mode("debug") then
add_defines("DEBUG")
end
on_clean(function(target)
if target:objectfiles() then
for _, file in ipairs(target:objectfiles()) do
if os.exists(file) then
print("Removing " .. file)
os.rm(file)
end
end
end
if target:targetfile() and os.exists(target:targetfile()) then
print("Removing " .. target:targetfile())
os.rm(target:targetfile())
end
end)
target_end()
target("Test")
set_default(false)
set_kind("binary")
set_targetdir("example")
add_linkdirs("./")
add_deps("mlx")
add_files("example/main.c", { languages = "c99" })
add_defines("SDL_MAIN_HANDLED")
add_packages("libsdl")
target_end()