-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
124 lines (91 loc) · 3.25 KB
/
xmake.lua
File metadata and controls
124 lines (91 loc) · 3.25 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
add_plugindirs("xmake_plugins")
set_policy("check.auto_ignore_flags", false)
function setupTest()
add_deps("libc3")
set_kind("binary")
add_cflags("-g")
add_ldflags("-g")
add_cxxflags("-g")
set_default(false)
end
-- on_config(registerTests)
-- local function registerTests()
-- local endswith = function(str, suffix)
-- return string.sub(str, -#suffix) == suffix
-- end
-- local lines = function(str)
-- return string.gmatch(str, "[^\r\n]+")
-- end
-- local function createMangledUnitTest(name)
-- target(name)
-- setupTest()
-- add_files("./unit_tests/"..name..".c" )
-- add_tests(name, {pass_outputs= "ok"})
-- add_headerfiles("./libc3/include/mangled.hpp")
-- end
-- root_path = "./unit_tests/"
-- mangled_suffix = "a.c"
-- -- get source files
-- files = os.iorunv("find", {root_path})
-- print("found" .. tostring(files))
-- for file_path in lines(files) do
-- if (endswith(file_path, mangled_suffix)) then
-- without_file_extension = string.sub(file_path, 0, -3)
-- createMangledUnitTest(without_file_extension)
-- else
-- print("warning: b tests are unimplemented")
-- end
-- end
-- end
target("libc3")
if is_arch("x86_64") and is_plat("linux") then
add_files("./libc3/src_platform/x86_64-gnu-linux/*.cpp")
end
add_headerfiles("./libc3/include/sys.hpp")
add_headerfiles("./libc3/include/helpers.hpp")
add_headerfiles("./libc3/include/ints.hpp")
add_headerfiles("./libc3/include/mangled.hpp")
set_kind("static")
add_files("libc3/src/**.cpp")
add_cxxflags("-ffreestanding", "-nostdlib", "-nostartfiles")
add_cflags("-ffreestanding", "-nostdlib", "-nostartfiles")
set_languages("cxx23", "c11")
add_ldflags("-g")
add_cflags("-g")
add_cxxflags("-g")
-- test with standard library
target("strlen1a")
setupTest()
add_files("./unit_tests/strlen1a.c" )
add_tests("strlen1a", {pass_outputs="ok"})
add_headerfiles("./libc3/include/mangled.hpp")
-- add_ldflags("-stdlib=libstdc++", {force = true})
target("fgetc1a")
setupTest()
add_files("./unit_tests/fgetc1a.c")
add_tests("fgetc1a", {pass_outputs="ok"})
add_headerfiles("./libc3/include/mangled.hpp")
target("malloc1a")
setupTest()
add_files("./unit_tests/malloc1a.c")
add_tests("malloc1a", {pass_outputs="ok"})
add_headerfiles("./libc3/include/mangled.hpp")
target("strcmp1a")
setupTest()
add_files("./unit_tests/strcmp1a.c")
add_tests("strcmp1a", {pass_outputs="ok"})
add_headerfiles("./libc3/include/mangled.hpp")
target("strncmp1a")
setupTest()
add_files("./unit_tests/strncmp1a.c")
add_tests("strncmp1a", {pass_outputs="ok"})
add_headerfiles("./libc3/include/mangled.hpp")
-- -- test without standard library
-- target("strlen1b")
-- setupTest()
-- add_headerfiles("./libc3/include/unmangled.hpp")
-- add_ldflags("-nostartfiles", "-ffreestanding", "-nostdlib")
-- add_cflags("-ffreestanding", "-nostdlib")
-- add_files("./unit_tests/strlen1b.c")
-- add_tests("strlen1b")
-- add_tests("strlen1b", {pass_outputs="ok"})