-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
134 lines (121 loc) · 3.67 KB
/
Copy pathxmake.lua
File metadata and controls
134 lines (121 loc) · 3.67 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
set_project("xent-kit")
-- Version from the git tag: release CI injects $XENT_VERSION (tag minus "v").
set_version(os.getenv("XENT_VERSION") or "0.3.0-dev")
set_languages("c23")
add_rules("mode.debug", "mode.release")
set_warnings("all")
local unit_tests = {
"test_xtk_el",
"test_xtk_list",
"test_xtk_batch",
"test_xtk_alloc_fail",
"test_xtk_catalog",
"test_xtk_nav_model",
"test_xtk_tree_model",
"test_xtk_event",
"test_xtk_headers",
"test_xtk_retained",
"test_xtk_scene",
"test_xtk_controls",
"test_xtk_probe_component",
"test_xtk_reconcile_txn",
"test_xtk_regions",
"test_xtk_cells",
}
-- Tests/benches that link the headless retained host (tests/retained).
local testhost_consumers = {
test_xtk_alloc_fail = true,
test_xtk_controls = true,
test_xtk_list = true,
test_xtk_probe_component = true,
test_xtk_reconcile_txn = true,
test_xtk_regions = true,
test_xtk_cells = true,
test_xtk_retained = true,
test_xtk_scene = true,
}
if is_mode("release") then
set_optimize("faster")
end
-- Pinned package by default; sibling source when present (local dev).
add_repositories("xent-repo https://github.com/Project-Xent/xent-repo.git")
local dev = os.isdir(path.absolute(path.join(os.scriptdir(), "..", "xent-core")))
if dev then
includes(path.join(os.scriptdir(), "..", "xent-core"))
else
add_requires("xent-core")
end
target("xtk")
set_kind("static")
if dev then
add_deps("xent_core")
else
add_packages("xent-core")
end
add_includedirs("include", { public = true })
add_includedirs("src", { private = true })
add_headerfiles("include/xtk/*.h")
add_files("src/*.c", "src/*/*.c")
target_end()
-- Headless retained host: test/bench fixture only, not part of libxtk.
target("xtk_testhost")
set_default(false)
set_kind("static")
add_deps("xtk")
add_files("tests/retained/*.c")
add_includedirs("tests/retained", { public = true })
add_includedirs("src", { private = true })
target_end()
target("bench_xtk_reconcile")
set_default(false)
set_kind("binary")
add_deps("xtk", "xtk_testhost")
add_files("bench/bench_xtk_reconcile.c")
add_includedirs("include", "src")
target("bench_xtk_composition")
set_default(false)
set_kind("binary")
add_files("bench/bench_xtk_composition.c", "bench/composition/*.c")
add_includedirs("bench")
target("bench_xtk_binding")
set_default(false)
set_kind("binary")
add_deps("xtk", "xtk_testhost")
add_files("bench/bench_xtk_binding.c")
add_includedirs("include", "src")
target("bench_xtk_workloads")
set_default(false)
set_kind("binary")
add_deps("xtk", "xtk_testhost")
add_files("bench/bench_xtk_workloads.c")
add_includedirs("include", "src")
for _, test_name in ipairs(unit_tests) do
target(test_name)
set_default(false)
set_kind("binary")
add_deps("xtk")
if testhost_consumers[test_name] then
add_deps("xtk_testhost")
end
add_files("tests/" .. test_name .. ".c")
add_includedirs("include", "src")
end
task("test")
set_menu {
usage = "xmake test",
description = "Build and run all unit tests.",
}
on_run(function ()
for _, test_name in ipairs(unit_tests) do
os.exec("xmake build " .. test_name)
os.exec("xmake run " .. test_name)
end
end)
task("gen-controls")
set_menu {
usage = "xmake gen-controls",
description = "Regenerate the typed control API from tools/catalog.lua.",
}
on_run(function ()
os.execv("xmake", {"lua", path.join(os.scriptdir(), "tools", "gen_controls.lua")})
end)