-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxmake.lua
104 lines (88 loc) · 3.21 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
103
104
add_requires("sfml","doctest")
add_rules("mode.debug", "mode.release")
target("spacedungeon-lib")
set_kind("static")
set_languages("cxx17")
add_packages("sfml","doctest")
-- common compiler flags
add_cxflags("-Wpedantic", "-Wall", "-Wextra", "-Wno-deprecated", "-Wno-deprecated-declarations", "-march=native")
add_ldflags("-march=native")
if is_mode("debug") then
add_defines("DEBUG")
add_cxflags("-fno-omit-frame-pointer")
add_ldflags("-fno-omit-frame-pointer")
else is_mode("release")
add_defines("RELEASE")
add_cxflags("-flto")
add_ldflags("-flto")
end
-- recursively search for .cpp files under the src directory, but exclude any .cpp files under src/unit-tests directory and the main.cpp file
add_files("src/**.cpp|unit-tests/*.cpp|main.cpp")
-- couldn't figure a way to recursively search for header files, so I just manually listed the directories
add_includedirs("src")
add_includedirs("src/entities")
add_includedirs("src/entities/weapons")
add_includedirs("src/gamestate")
add_includedirs("src/ui")
add_includedirs("src/util")
add_includedirs("src/unit-tests")
target_end()
-- unit tests first so that they are executed first when 'xmake run' is executed
target("unit-tests")
set_kind("binary")
set_languages("cxx17")
add_deps("spacedungeon-lib")
add_packages("sfml","doctest")
set_rundir("$(projectdir)")
-- common compiler flags
add_cxflags("-Wpedantic", "-Wall", "-Wextra", "-Wno-deprecated", "-Wno-deprecated-declarations", "-march=native")
add_ldflags("-march=native")
if is_mode("debug") then
add_defines("DEBUG")
add_cxflags("-fno-omit-frame-pointer")
add_ldflags("-fno-omit-frame-pointer")
else is_mode("release")
add_defines("RELEASE")
add_cxflags("-flto")
add_ldflags("-flto")
end
-- recursively search for .cpp files under the src/unit-tests directory
add_files("src/unit-tests/**.cpp")
-- couldn't figure a way to recursively search for header files, so I just manually listed the directories
add_includedirs("src")
add_includedirs("src/entities")
add_includedirs("src/entities/weapons")
add_includedirs("src/gamestate")
add_includedirs("src/ui")
add_includedirs("src/util")
add_includedirs("src/unit-tests")
target_end()
target("spacedungeon")
set_kind("binary")
set_languages("cxx17")
add_deps("spacedungeon-lib")
add_packages("sfml","doctest")
set_rundir("$(projectdir)")
-- common compiler flags
add_cxflags("-Wpedantic", "-Wall", "-Wextra", "-Wno-deprecated", "-Wno-deprecated-declarations", "-march=native")
add_ldflags("-march=native")
if is_mode("debug") then
add_defines("DEBUG")
add_cxflags("-fno-omit-frame-pointer")
add_ldflags("-fno-omit-frame-pointer")
else is_mode("release")
add_defines("RELEASE")
add_cxflags("-flto")
add_ldflags("-flto")
end
-- only need the main.cpp because the rest is in the spacedungeon-lib dependency
add_files("src/main.cpp")
-- couldn't figure a way to recursively search for header files, so I just manually listed the directories
add_includedirs("src")
add_includedirs("src/entities")
add_includedirs("src/entities/weapons")
add_includedirs("src/gamestate")
add_includedirs("src/ui")
add_includedirs("src/util")
add_includedirs("src/unit-tests")
target_end()