-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
xmake.lua
46 lines (41 loc) · 1.14 KB
/
xmake.lua
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
set_xmakever("2.6.1") -- Minimum version to compile BPF source correctly
-- includes
includes("xmake/repos.lua")
-- rules
add_rules("mode.release", "mode.debug")
-- traffico
target("traffico")
set_kind("binary")
set_default(true)
includes("api")
add_deps("api")
add_deps("bpf")
add_packages("libbpf")
add_files({ "traffico.c" }, { languages = { "c11" }})
target_end()
-- traffico-cni
add_requires("cjson")
target("traffico-cni")
set_kind("binary")
add_packages("cjson")
includes("api")
add_deps("api")
add_deps("bpf")
add_packages("libbpf")
add_files({ "traffico-cni.c" }, { languages = { "c11" }})
target_end()
-- test
add_requires("bats v1.7.0", { system = false })
add_requires("mini_httpd", { system = false })
target("test")
set_kind("phony")
add_deps("traffico", "traffico-cni")
add_packages("bats", "mini_httpd")
on_run(function (target)
for _, name in ipairs(target:get("deps")) do
os.addenv("PATH", path.absolute(target:dep(name):targetdir()))
end
import("privilege.sudo")
sudo.execv("bats", { "-t", "test/" })
end)
target_end()