-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
121 lines (100 loc) · 2.91 KB
/
Copy pathxmake.lua
File metadata and controls
121 lines (100 loc) · 2.91 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
set_project("Nova07")
set_version("0.1.0")
add_rules("mode.debug", "mode.release")
add_rules("plugin.compile_commands.autoupdate", { outputdir = "build" })
set_languages("c++20")
-- Dependencies
add_requires("libsdl3", { configs = { vulkan = true } })
add_requires("libsdl3_image", { configs = { jpeg = true, png = true, tiff = true, webp = true } })
add_requires("shaderc")
add_requires("luau")
add_requires("luabridge3")
add_requires("glm")
add_requires("joltphysics")
add_requires("pugixml")
add_requires("enet")
add_requires("zstd")
add_requires("tracy v0.12.2", { configs = { on_demand = true } })
-- Shader compilation rule using glslc (from shaderc)
rule("hlsl2spv")
set_extensions(".hlsl")
on_buildcmd_file( function (target, batchcmds, sourcefile, opt)
import("lib.detect.find_tool")
local glslc = find_tool("glslc")
if not glslc then
raise("glslc not found! Install shaderc or the Vulkan SDK.")
end
local basename = path.basename(sourcefile)
local stage = nil
if basename:find("vert") then
stage = "vertex"
elseif basename:find("frag") then
stage = "fragment"
else
raise("Cannot determine shader stage from filename: " .. sourcefile)
end
local outputfile = sourcefile:gsub("%.hlsl$", ".spv")
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.hlsl %s", sourcefile)
batchcmds:vrunv(glslc.program, {
"-fshader-stage=" .. stage,
"-fentry-point=main",
"--target-env=vulkan1.0",
"--target-spv=spv1.0",
sourcefile,
"-o", outputfile
})
batchcmds:add_depfiles(sourcefile)
batchcmds:set_depmtime(os.mtime(outputfile))
batchcmds:set_depcache(target:dependfile(outputfile))
end)
rule_end()
target("Nova07")
set_kind("binary")
set_default(true)
add_files("src/**.cpp|ncc_main.cpp")
add_includedirs("src")
add_rules("hlsl2spv")
add_files("shaders/**.hlsl")
add_defines("TRACY_ENABLE")
add_packages(
"libsdl3",
"libsdl3_image",
"shaderc",
"luau",
"luabridge3",
"glm",
"joltphysics",
"pugixml",
"enet",
"zstd",
"tracy"
)
target("NCCService")
set_kind("binary")
set_default(false)
add_files("src/**.cpp|main.cpp")
add_includedirs("src")
add_rules("hlsl2spv")
add_files("shaders/**.hlsl")
add_defines("TRACY_ENABLE")
add_packages(
"libsdl3",
"libsdl3_image",
"shaderc",
"luau",
"luabridge3",
"glm",
"joltphysics",
"pugixml",
"enet",
"zstd",
"tracy"
)
target("ReplicationTests")
set_kind("binary")
set_default(false)
add_files("tests/test_replication.cpp")
add_includedirs("src")
add_packages(
"glm"
)