-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxmake.lua
More file actions
129 lines (118 loc) · 4.55 KB
/
Copy pathxmake.lua
File metadata and controls
129 lines (118 loc) · 4.55 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
add_rules("mode.debug", "mode.release")
add_rules("plugin.compile_commands.autoupdate", {outputdir = "build"})
-- Tracy frame profiler (function/line sampling + manual zones)
-- Enable: xmake f -m debug --tracy=y && xmake
-- GUI: run `tracy`, launch ourcraft, connect (on-demand)
option("tracy")
set_default(false)
set_showmenu(true)
set_description("Enable Tracy profiler (function/line-level CPU profiling)")
option_end()
add_requires("libsdl3", "glm", "enet", "zstd", "zlib", "freetype")
add_requires("openal-soft")
add_requires("rocksdb", {configs = {zstd = true, zlib = true}})
add_requires("stb", {system = false})
add_requires("glad", {system = false, configs = {extensions = "all", api = "gl=4.6"}})
add_requires("doctest", {system = false})
-- Standalone Tracy client object lib so LTO/visibility don't strip/export wrong
if has_config("tracy") then
target("tracy-client")
set_kind("object")
set_languages("c++20")
set_symbols("debug")
add_defines("TRACY_ENABLE", "TRACY_ON_DEMAND", "TRACY_NO_FRAME_IMAGE")
-- Prefer portable timer if invariant TSC check fails on some CPUs
-- add_defines("TRACY_TIMER_FALLBACK")
add_includedirs("third_party/tracy/public", {public = true})
add_files("third_party/tracy/public/TracyClient.cpp")
-- Don't hide Tracy API symbols
add_cxflags("-fvisibility=default", {force = true})
if is_plat("linux") then
add_syslinks("pthread", "dl")
end
target_end()
end
local function apply_tracy()
if has_config("tracy") then
add_deps("tracy-client")
add_defines("TRACY_ENABLE", "TRACY_ON_DEMAND", "TRACY_NO_FRAME_IMAGE")
add_includedirs("third_party/tracy/public", {public = false})
set_symbols("debug")
if is_plat("linux") then
add_syslinks("pthread", "dl")
end
end
end
target("ourcraft")
set_kind("binary")
set_languages("c++20")
if is_mode("release") then
set_optimize("fastest")
if not has_config("tracy") then
set_strip("all")
set_policy("build.optimization.lto", true)
end
end
add_files("src/**.cpp")
remove_files("src/server_main.cpp")
add_includedirs("include")
add_packages("libsdl3", "glad", "glm", "enet", "stb", "zstd", "zlib", "rocksdb", "freetype", "openal-soft")
apply_tracy()
if is_plat("windows") then
add_syslinks("user32", "gdi32", "shell32")
elseif is_plat("linux") then
add_syslinks("pthread", "dl", "m")
end
target("ourcraft-server")
set_kind("binary")
set_languages("c++20")
if is_mode("release") then
set_optimize("fastest")
if not has_config("tracy") then
set_strip("all")
set_policy("build.optimization.lto", true)
end
end
add_files("src/net/Server.cpp", "src/net/Packet.cpp", "src/net/IntegratedServer.cpp", "src/net/ServerTick.cpp", "src/net/ServerPacketHandler.cpp", "src/net/Permissions.cpp", "src/net/CommandHandler.cpp", "src/net/RegistrationManager.cpp", "src/net/ServerConfig.cpp")
add_files("src/world/**.cpp")
add_files("src/entities/**.cpp")
remove_files("src/entities/PlayerTick.cpp")
add_files("src/physics/**.cpp")
add_files("src/util/**.cpp")
add_files("src/inventory/**.cpp")
add_files("src/items/**.cpp")
add_files("src/simulation/SimulationTick.cpp")
add_files("src/server_main.cpp")
add_includedirs("include")
add_packages("glm", "enet", "zstd", "zlib", "rocksdb")
add_defines("SERVER_ONLY")
apply_tracy()
if is_plat("windows") then
add_syslinks("user32", "gdi32", "shell32")
elseif is_plat("linux") then
add_syslinks("pthread", "dl", "m")
end
target("ourcraft-tests")
set_kind("binary")
set_languages("c++20")
if is_mode("release") then
set_optimize("fastest")
set_strip("all")
end
add_files("tests/**.cpp")
add_files("src/world/**.cpp")
add_files("src/physics/**.cpp")
add_files("src/entities/**.cpp")
remove_files("src/entities/PlayerTick.cpp")
add_files("src/items/**.cpp")
add_files("src/inventory/**.cpp")
add_files("src/simulation/SimulationTick.cpp")
add_files("src/util/Timer.cpp")
add_files("src/net/Packet.cpp")
add_files("src/renderer/ChunkMesher.cpp", "src/renderer/GreedyMesher.cpp", "src/renderer/FluidMesher.cpp")
add_includedirs("include")
add_packages("glad", "glm", "zstd", "zlib", "rocksdb", "doctest")
add_defines("SERVER_ONLY")
if is_plat("linux") then
add_syslinks("pthread", "dl", "m")
end