Repository navigation
Expand file tree
/
Copy pathxmake.lua
More file actions
207 lines (197 loc) · 9.08 KB
/
Copy pathxmake.lua
File metadata and controls
207 lines (197 loc) · 9.08 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
set_xmakever("3.0.6")
add_rules("mode.release", "mode.debug", "mode.releasedbg")
set_policy("build.ccache", not is_plat("windows"))
set_policy("check.auto_ignore_flags", false)
-- pre-defined options
-- enable mimalloc as default allocator: https://github.com/LuisaGroup/mimalloc
option("lc_enable_mimalloc", {default = true})
-- enable custom memory allocator instead of default system allocator
option("lc_enable_custom_malloc", {default = false})
-- enable unity(jumbo) build, enable this option will optimize compile speed
option("lc_enable_unity_build", {default = true})
-- run scripts/check_unity_build_conflicts.py as part of every build. The unity
-- build merges several translation units of a target into one, so two files that
-- declare the same file-local helper name (`static` or in an anonymous namespace)
-- collide as soon as they land in the same batch. The check needs Python with the
-- tree-sitter and tree-sitter-cpp packages (`pip install tree-sitter tree-sitter-cpp`).
option("lc_check_unity_build", {default = false,
description = "Fail the build when two files of a unity build batch declare the same file-local symbol.",
showmenu = true})
-- enable Pre-Compile header, enable this option will optimize compile speed
option("lc_enable_pch", {default = true})
-- enable sse and sse2 SIMD
option("lc_enable_simd", {default = true})
-- enable DirectX-12 backend
option("lc_dx_backend", {default = true})
-- enable the native C++ fallback backend for platforms without GPU support
option("lc_fallback_backend", {default = false})
-- enable XIR (Intermediate Representation) support
option("lc_enable_xir", {default = true})
-- use external Marl library instead of bundled version
option("lc_external_marl", {default = false})
-- enable DirectX-CUDA interoperability
option("lc_dx_cuda_interop", {default = false})
-- enable Vulkan-CUDA interoperability
option("lc_vk_cuda_interop", {default = false})
-- enable Link Time Optimization (LTO) for smaller binary size
option("lc_use_lto", {default=false})
-- enable Vulkan backend
option("lc_vk_backend", {default = true})
-- Android NDK installation directory (required when configuring for android)
option("lc_ndk", {default = false,
description = "Android NDK installation directory. Required for -p android builds.",
showmenu = true})
-- Vulkan backend: lower the requested update-after-bind heap capacity for
-- low-end / mobile GPUs. Defaults to the desktop 262144-slot capacity.
option("lc_vk_bindless_heap_capacity", {default = 262144,
description = "Requested Vulkan bindless heap capacity (0 disables bindless).",
showmenu = true})
-- Vulkan backend: minimum supported Vulkan API version for device negotiation.
-- "auto" (default) uses whatever the physical device exposes (preferring the
-- sync2/copy2 paths on 1.3+ devices); "1.2" forces the legacy barrier/copy
-- path (the Android-compatible floor) so CI can exercise it on a 1.3 device.
option("lc_vk_min_api_version", {default = "auto",
description = "Minimum Vulkan API version for the Vulkan backend (auto, 1.2 or 1.3).",
showmenu = true})
option("lc_vk_backend_use_xir_spirv", {default = false})
-- Keep the legacy runtime DXC route available for unsupported Vulkan shader
-- features. Projects that require a native-only Vulkan build can disable it;
-- the backend then fails at configuration time unless a native SPIR-V route
-- is enabled.
option("lc_vk_backend_enable_dxc_compatibility", {default = true})
-- enable NVIDIA-CUDA backend
option("lc_cuda_backend", {default = true})
-- enable NVIDIA-CUDA Extension CUB, default false, because of long compile time
option("lc_cuda_ext_lcub", {default = false})
-- enable Metal backend
option("lc_metal_backend", {default = true})
-- enable tests module
option("lc_enable_tests", {default = true})
-- C++ standard version (e.g., cxx17, cxx20, cxx23)
option("lc_cxx_standard", {default = 'cxx20'})
-- C standard version (e.g., c11, clatest)
option("lc_c_standard", {default = 'clatest'})
-- enable C++ Run-Time Type Information (RTTI)
option("lc_rtti", {default = false})
-- enable safe mode for runtime
option("lc_safe_mode", {default = false})
-- Python include directory path
option("lc_py_include", {default = false})
-- Python library directory path
option("lc_py_linkdir", {default = false})
-- Python libraries to link
option("lc_py_libs", {default = false})
-- enable OpenShadingLanguage (OSL) support
option("lc_enable_osl", {default = true})
-- enable C++ DSL module
option("lc_enable_dsl", {default = true})
-- enable clang C++ module
option("lc_enable_clangcxx", {default = false})
-- enable GUI module
option("lc_enable_gui", {default = true})
-- enable ImGui integration for GUI
option("lc_enable_imgui", {default = true})
-- custom binary output directory
option("lc_bin_dir", {default = "bin"})
-- enable Python bindings
option("lc_enable_py", {default = true})
-- download and extract package dir, set to empty string to disable installation
option("lc_sdk_dir", {default = false})
-- custom toolchain path or name
option("lc_toolchain", {default = false})
-- Windows runtime library (MT/MD/MTd/MDd)
option("lc_win_runtime", {default = false})
-- additional optimization flags
option("lc_optimize", {default = false})
-- custom LLVM installation path
option("lc_llvm_path", {default = false})
-- optional native C++ TileIR -> TVM TIRx bridge (mirrors
-- LUISA_COMPUTE_ENABLE_TILE_TIRX_BRIDGE in the CMake build). Builds and links
-- the bundled apache/tvm submodule at src/ext/tvm (tvm_ffi, tvm_runtime and
-- tvm_compiler are compiled from source by src/ext/xmake.lua).
option("lc_tile_tirx_bridge", {default = false,
description = "Enable the native C++ TileIR to TVM TIRx bridge using the bundled src/ext/tvm submodule.",
showmenu = true})
-- Build the bundled TVM stack (tvm_ffi / tvm_runtime / tvm_compiler) without
-- the TileIR bridge. Useful on its own: the CUDA-C codegen registration, the
-- TVM source lists and the LLVM codegen can be built and probed while the
-- bridge is being ported to a newer TIRx API.
option("lc_tvm_stack", {default = false,
description = "Build the bundled TVM stack from src/ext/tvm without the TileIR TIRx bridge.",
showmenu = true})
-- build the bundled TVM compiler with LLVM codegen (registers the
-- target.build.llvm pipeline used by the TIRx CPU/execution tests). Requires
-- LLVM >= 15, resolved from lc_llvm_path or the xmake-repo llvm package.
option("lc_tvm_llvm", {default = false,
description = "Enable LLVM codegen in the bundled TVM compiler.",
showmenu = true})
-- custom Embree installation path
option("lc_embree_path", {default = false})
-- Use AST→LLVM→SPIR-V codegen for Vulkan backend (mutually exclusive with lc_vk_backend_use_xir_spirv)
option("lc_vk_backend_use_ast_llvm_spirv", {default = false,
description = "Use AST LLVM codegen for Vulkan backend SPIR-V generation.",
showmenu = true})
-- use system STL instead of bundled or custom one
option("lc_use_system_stl", {default = false})
-- third-party: use xmake-repo packages instead of bundled sources
-- use xmake-repo spdlog package instead of bundled
option("lc_spdlog_use_xrepo", {default = false})
-- use xmake-repo reproc package instead of bundled
option("lc_reproc_use_xrepo", {default = false})
-- use xmake-repo lmdb package instead of bundled
option("lc_lmdb_use_xrepo", {default = false})
-- use xmake-repo imgui package instead of bundled
option("lc_imgui_use_xrepo", {default = false})
-- use xmake-repo glfw package instead of bundled
option("lc_glfw_use_xrepo", {default = false})
-- use xmake-repo yyjson package instead of bundled
option("lc_disable_win_message_box", {default = true})
option("lc_yyjson_use_xrepo", {default = false})
-- internal: xmake scripts directory path
option("lc_scripts_path")
function lc_set_pcxxheader(...)
if get_config('lc_enable_pch') then
set_pcxxheader(...)
end
end
set_showmenu(false)
set_default(false)
after_check(function(option)
option:set_value(path.join(os.scriptdir(), 'scripts'))
end)
option_end()
-- internal: external dependencies directory path
option("lc_ext_path")
set_showmenu(false)
set_default(false)
after_check(function(option)
option:set_value(path.join(os.scriptdir(), 'src/ext'))
end)
option_end()
-- pre-defined options end
-- try options.lua
if path.absolute(os.projectdir()) == path.absolute(os.scriptdir()) and os.exists("scripts/options.lua") then
includes("scripts/options.lua")
end
if lc_options then
for k, v in pairs(lc_options) do
set_config(k, v)
end
end
if has_config("lc_vk_backend_use_xir_spirv") and has_config("lc_vk_backend_use_ast_llvm_spirv") then
raise("Vulkan compute shader codegen options are mutually exclusive. " ..
"Use lc_vk_backend_use_xir_spirv for the default native SPIR-V path, " ..
"or lc_vk_backend_use_ast_llvm_spirv for the experimental LLVM SPIR-V path.")
end
includes("scripts/xmake_func.lua")
if has_config('_lc_check_env') then
local lc_bin_dir = get_config("_lc_bin_dir")
if lc_bin_dir then
set_targetdir(lc_bin_dir)
end
includes("src")
if has_config("lc_enable_tests") then
includes("examples")
includes("tutorials")
end
end