-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
62 lines (54 loc) · 1.26 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
set_project("cgraph")
set_version("0.0.0")
add_includedirs("include", "src/type")
add_files("src/**.c")
add_cflags("-std=c89", "-Wall", "-pedantic", "-fPIC", {force = true})
if is_mode("debug") then
set_symbols("debug")
set_optimize("none")
add_cflags("-g", "-DDEBUG", {force = true})
end
if is_mode("release") then
set_symbols("hidden")
set_strip("all")
add_cflags("-static", "-O2", {force = true})
end
-- if is_mode("profile") then
-- set_symbols("debug")
-- end
if is_plat("linux", "macosx") then
add_links("m")
end
target("static")
set_kind("static")
set_basename("cgraph")
on_clean(function (target)
if os.exists(target:targetfile()) then
os.rm(target:targetfile())
end
end)
target_end()
target("shared")
set_kind("shared")
set_basename("cgraph")
on_clean(function (target)
if os.exists(target:targetfile()) then
os.rm(target:targetfile())
end
end)
target_end()
target("cgraph")
set_kind("binary")
set_basename("cgraph")
add_files("tests/cgraph.c")
add_deps("shared")
on_run(function (target)
os.exec("%s $(scriptdir)/tests/elements.csv", target:targetfile())
end)
on_clean(function (target)
if os.exists(target:targetfile()) then
os.rm(target:targetfile())
-- os.rmdir("$(buildir)/$(plat)/$(arch)/$(mode)")
end
end)
target_end()