-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
68 lines (53 loc) · 2.1 KB
/
Copy pathxmake.lua
File metadata and controls
68 lines (53 loc) · 2.1 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
add_rules("mode.debug", "mode.release")
if is_mode("asan") then
add_rules("mode.debug")
end
add_rules("plugin.compile_commands.autoupdate", {outputdir = "./build"})
add_requires("fmt", "cxxopts", "stb", "openmp", "nlohmann_json")
option("perf_tracking")
set_default(true)
set_showmenu(true)
set_description("Enable data collection on number of secondary rays, hits, etc. This might cause slowdown in rendering")
option("use_iterative_solver")
set_default(true)
set_showmenu(true)
set_description("Whether ray bounces are computed iteratively or recursively")
target("rt")
set_kind("binary")
set_languages("c++20")
set_warnings("all", "extra")
add_includedirs("include/")
add_files("src/**.cpp")
add_packages("fmt", "cxxopts", "stb", "openmp", "nlohmann_json")
if is_mode("asan") then
-- Force xmake to use clang, because some of the sanitizers are only supported with clang
set_toolchains("clang")
add_cxflags("-fsanitize=address,undefined", "-fno-omit-frame-pointer", {force = true})
add_ldflags("-fsanitize=address,undefined", {force = true})
add_ldflags("-fopenmp", {force = true})
set_optimize("none")
add_cxflags("-O1")
add_cxflags("-Wformat=2", "-Wshadow", "-Wfloat-equal", "-Wshift-overflow")
add_cxflags("-Wconversion", "-Wsign-conversion", "-Wcast-align", "-pedantic")
add_cxflags("-gdwarf-4", "-ftrapv")
add_defines("_GLIBCXX_DEBUG", "_GLIBCXX_DEBUG_PEDANTIC", "_FORTIFY_SOURCE=2")
add_cxflags("-fstack-protector")
end
if is_mode("release") then
set_optimize("fastest")
add_cxflags("-ffast-math")
add_cxflags("-DNDEBUG")
add_cxflags("-march=native")
add_cxflags("-mfma")
add_cxflags("-mavx2")
end
if has_config("perf_tracking") then
add_defines("ENABLE_PERF_TRACKING=1")
else
add_defines("ENABLE_PERF_TRACKING=0")
end
if has_config("use_iterative_solver") then
add_defines("USE_ITERATIVE_SOLVER=1")
else
add_defines("USE_ITERATIVE_SOLVER=0")
end