-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvoid.lua
More file actions
97 lines (80 loc) · 2.89 KB
/
void.lua
File metadata and controls
97 lines (80 loc) · 2.89 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
void = void or {}
local function join(base, rel)
if base == nil or base == "" then
return rel
end
return path.join(base, rel)
end
function void.set_common_project_settings(groups)
r2.set_common_project_settings(groups)
end
function void.add_projects(opts, groups)
local base = opts.base or ""
local r2_dir = opts.r2_dir
local backend = opts.backend
local build_root = opts.build_root
local int_root = opts.int_root
-- resources
project "resources"
kind "StaticLib"
targetname "%{prj.name}_%{cfg.buildcfg}_%{cfg.platform}"
targetdir (build_root)
objdir (int_root)
location (join(base, "resources"))
void.set_common_project_settings(groups)
r2.set_project_backend_defines(backend)
local shader_glob = join(base, "resources/res/shaders/**.hlsl")
files {
join(base, "resources/include/**.h"),
join(base, "resources/internal/**.cpp"),
join(base, "resources/internal/**.h"),
shader_glob,
}
includedirs {
join(base, "resources/ext"),
join(base, "resources/include"),
}
-- hlsl preprocessing
local pp_out = "%{prj.location}/../resources/res/shaders/out"
filter { "files:" .. shader_glob }
buildaction "CustomBuild"
buildmessage "Preprocessing %{file.name}"
if backend == "d3d11" then
buildcommands {
'cl.exe /nologo /EP /DR2_BACKEND_D3D11 "%{file.abspath}" > "' .. pp_out .. '/%{file.basename}.shader"'
}
elseif backend == "opengl" then
buildcommands {
'cl.exe /nologo /EP /DR2_BACKEND_OPENGL "%{file.abspath}" > "' .. pp_out .. '/%{file.basename}.shader"'
}
else
error("void/resources: invalid backend.")
end
buildoutputs { pp_out .. "/%{file.basename}.shader" }
filter {}
-- void
project "void"
kind "StaticLib"
targetname "%{prj.name}_%{cfg.buildcfg}_%{cfg.platform}"
targetdir (build_root)
objdir (int_root)
location (join(base, "void"))
void.set_common_project_settings(groups)
r2.set_project_backend_defines(backend)
files {
join(base, "void/include/**.h"),
join(base, "void/include/**.inl"),
join(base, "void/src/**.h"),
join(base, "void/src/**.cpp"),
}
includedirs {
join(base, "void/include"),
join(base, "void/ext"),
join(base, "void/src"),
join(base, "resources/include"),
join(base, "resources/internal"),
}
r2.use { base = r2_dir, backend = backend, include_impl = true }
dependson { "r2", "resources" }
links { "resources" }
end