-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxmake.lua
More file actions
218 lines (189 loc) · 4.99 KB
/
Copy pathxmake.lua
File metadata and controls
218 lines (189 loc) · 4.99 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
-- Set language standard
set_languages("c++17")
add_rules("mode.release")
add_rules("mode.releasedbg")
add_rules("mode.minsizerel")
add_rules("mode.debug")
set_policy("build.sanitizer.address", false)
set_policy("build.sanitizer.memory", false)
set_policy("build.sanitizer.leak", false)
set_policy("build.sanitizer.undefined", false)
set_policy("build.optimization.lto", false)
-- utils and custom libraries
includes("utils.lua")
includes("extlibs/vulkan.lua")
includes("extlibs/sdl_port.lua")
includes("extlibs/cares.lua")
-- fix libffi compile exception
if is_plat("linux") and is_arch("riscv64", "ppc64", "s390x") then
includes("extlibs/libffi.lua")
end
if is_plat("harmony") then
includes("extlibs/libffi_port.lua")
end
--------------------------------------------------------------------------------
-- Platform configs
--------------------------------------------------------------------------------
if not is_plat("windows", "mingw") then
add_ldflags("-rdynamic")
end
-- Platform macros
if get_config("arch") ~= nil then
add_defines('OM_ARCH="' .. get_config("arch") .. '"')
end
if not is_plat("windows", "mingw") then
add_defines("OM_PLATFORM_UNIX=")
end
if is_plat("windows", "mingw") then
add_defines("OM_PLATFORM_WINDOWS=")
end
if is_plat("mingw") then
add_defines("OM_PLATFORM_MINGW=")
end
if is_plat("linux") then
add_defines("OM_PLATFORM_LINUX=")
end
if is_plat("bsd") then
add_defines("OM_PLATFORM_BSD=")
end
if is_plat("macosx") then
add_defines("OM_PLATFORM_MACOS=")
end
if is_plat("android") then
add_defines("OM_PLATFORM_ANDROID=")
end
if is_plat("iphoneos") then
add_defines("OM_PLATFORM_IOS=")
end
if is_plat("harmony") then
add_defines("OM_PLATFORM_HARMONY=")
end
if not mobile() then
add_defines("OM_PLATFORM_DESKTOP=")
end
if apple() or is_plat("bsd") then
add_defines("BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED=")
add_defines("OM_PLATFORM_BSDLIKE=")
end
if apple() then
add_defines("OM_PLATFORM_APPLE=")
end
-- Vulkan dynamic loading
if vulkandyn() then
add_defines("OM_VULKAN_DYNAMIC=")
end
--------------------------------------------------------------------------------
-- Package dependency
--------------------------------------------------------------------------------
-- Static vulkan loader
if not mobile() then
if not is_plat("linux", "cross", "bsd", "macosx", "iphoneos", "visionos", "mingw") then
add_requires("vulkan-loader", { system = false })
end
end
-- MoltenVK for apple platforms
if apple() then
add_requires("moltenvk", { configs = { shared = false } })
end
add_requires(
"vulkan-headers",
"glm",
"vulkan-hpp",
"shaderc",
"tinyobjloader",
"opengl-headers",
"zlib",
"bullet3",
"libffi",
"c-ares",
"libsdl3",
"yoga",
{ system = false }
)
add_requires("boost", { system = false, configs = { stacktrace = true, asio = true } })
add_requires("fmt", { system = false, configs = { header_only = true } })
add_requires("harfbuzz", { system = false, configs = { freetype = false } })
------------------------------------------------------------------------------
-- Submodules
--------------------------------------------------------------------------------
includes("src/log/xmake.lua")
includes("src/vm/xmake.lua")
includes("src/mem/xmake.lua")
includes("src/io/xmake.lua")
includes("src/boot/xmake.lua")
includes("src/vfs/xmake.lua")
includes("src/util/xmake.lua")
includes("src/i18n/xmake.lua")
includes("src/renderer/xmake.lua")
includes("src/specs/xmake.lua")
includes("src/fontproc/xmake.lua")
includes("tests/xmake.lua")
includes("tools/xmake.lua")
--------------------------------------------------------------------------------
-- openminecraft (core target)
--------------------------------------------------------------------------------
target("openminecraft")
if is_plat("android", "harmony") then
set_kind("shared")
add_rules("utils.symbols.export_all")
else
set_kind("binary")
end
add_includedirs("include")
add_files("launcher/**.cpp")
add_rules("utils.bin2obj", { extensions = { ".bundle" } })
add_files("boot.bundle", { zeroend = false })
add_deps(
"openminecraft-log",
"openminecraft-vm",
"openminecraft-mem",
"openminecraft-io",
"openminecraft-vfs",
"openminecraft-boot",
"openminecraft-util",
"openminecraft-i18n",
"openminecraft-renderer",
"openminecraft-specs",
"openminecraft-fontproc"
)
add_packages(
"harfbuzz",
"vulkan-headers",
"glm",
"bullet3",
"vulkan-hpp",
"shaderc",
"fmt",
"boost",
"nlohmann_json",
"libsdl3",
"zlib",
"c-ares",
"yoga",
{ system = false }
)
if not mobile() and not vulkandyn() and not apple() then
add_packages("vulkan-loader")
end
if apple() then
add_packages("moltenvk")
add_frameworks("CoreText", "CoreFoundation", "CoreGraphics")
end
if is_plat("harmony") then
add_syslinks("vulkan")
add_links("vulkan")
end
if is_plat("android") then
add_syslinks("GLESv2")
end
if is_plat("iphoneos") then
add_frameworks("OpenGLES")
end
if is_plat("macosx") then
add_frameworks("OpenGL")
end
if is_plat("windows") then
add_links("opengl32", "dbghelp")
elseif is_plat("mingw") then
add_links("pthread", "opengl32", "dbghelp")
end