-
Notifications
You must be signed in to change notification settings - Fork 1
/
xmake.lua
executable file
·87 lines (63 loc) · 1.78 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
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
-- project
set_project("xmake-cpputest")
-- version
set_version("1.0.0")
cpputest_home = "/usr/local/"
-- set warning all as error
set_warnings("all", "error")
-- set language: c99, c++11
set_languages("c99", "cxx11")
-- the debug or check or coverage mode
if is_mode("debug", "check", "coverage") then
-- enable the debug symbols
set_symbols("debug")
-- disable optimization
set_optimize("none")
-- add defines for debug
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
if is_mode("check") and is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
-- enable coverage
if is_mode("coverage") then
add_cxflags("--coverage")
add_mxflags("--coverage")
add_ldflags("--coverage")
end
end
-- the release mode
if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
-- enable fastest optimization
set_optimize("fastest")
-- strip all symbols
set_strip("all")
end
-- add option: CppUTest
option("CppUTest")
set_enable(false)
set_showmenu(true)
set_category("option")
set_description("Specify CppUTest Home")
-- add target
target("tutorial")
-- set kind
set_kind("binary")
-- add include directories
add_includedirs("include", "include/LedDriver", "mocks", cpputest_home .. "include")
-- add files
add_files("src/**.c", "mocks/*.c", "tests/**.cpp")
-- add link library
add_links("CppUTest")
-- add link directories
add_linkdirs(cpputest_home .. "lib")
-- add target
target("tut")
-- set kind
set_kind("binary")
-- add files
add_files("src/Tutorial/*.cxx")