-
Notifications
You must be signed in to change notification settings - Fork 4
/
premake5.lua
155 lines (104 loc) · 3.37 KB
/
premake5.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
----------------------------------------------------------------------------------------------------
if _ACTION == "clean" then
os.rmdir("build")
end
----------------------------------------------------------------------------------------------------
local have_gtest = os.isdir("test/gtest")
----------------------------------------------------------------------------------------------------
solution "Support"
configurations { "Release", "Debug" }
platforms { "x64", "x32" }
location ("build/" .. _ACTION)
objdir ("build/" .. _ACTION .. "/obj")
if have_gtest then
-- all tests are single threaded.
-- compiling with "-pthread" doesn't help... avoid linker errors...
-- FIXME!
defines { "GTEST_HAS_PTHREAD=0" }
end
configuration { "Debug" }
defines { "_DEBUG" }
flags { "ExtraWarnings", "Symbols" }
configuration { "Release" }
defines { "NDEBUG" }
flags { "ExtraWarnings", "Optimize" }
configuration { "Debug", "x64" }
targetdir ("build/" .. _ACTION .. "/bin/x64/Debug")
configuration { "Release", "x64" }
targetdir ("build/" .. _ACTION .. "/bin/x64/Release")
configuration { "Debug", "x32" }
targetdir ("build/" .. _ACTION .. "/bin/x32/Debug")
configuration { "Release", "x32" }
targetdir ("build/" .. _ACTION .. "/bin/x32/Release")
configuration { "gmake" }
buildoptions {
"-std=c++1y",
"-pedantic",
}
configuration { "windows" }
flags { "Unicode" }
----------------------------------------------------------------------------------------------------
group "Library"
project "CmdLine"
kind "StaticLib"
language "C++"
includedirs { "include/" }
files {
"include/**.*",
"src/**.*",
}
configuration { "Debug" }
targetsuffix "d"
----------------------------------------------------------------------------------------------------
group "App"
project "Test"
kind "ConsoleApp"
language "C++"
links { "CmdLine" }
includedirs { "include/" }
files {
"test/*.cpp",
"test/*.h",
}
----------------------------------------------------------------------------------------------------
function add_unittest(name)
group "Unit Tests"
project (name)
kind "ConsoleApp"
language "C++"
links { "CmdLine", "gtest", "gtest_main" }
includedirs { "include/", "test/" }
if have_gtest then
includedirs { "test/gtest/include" }
end
files { "test/unittests/" .. name .. ".cpp" }
end
add_unittest("CmdLineExpandTest")
add_unittest("CmdLineTest")
add_unittest("CmdLineToArgvTest")
add_unittest("StringRefTest")
add_unittest("StringSplitTest")
----------------------------------------------------------------------------------------------------
if have_gtest then
group "Externals"
project "gtest"
kind "StaticLib"
language "C++"
includedirs {
"test/gtest/include",
"test/gtest",
}
files {
"test/gtest/src/gtest-all.cc",
}
project "gtest_main"
kind "StaticLib"
language "C++"
includedirs {
"test/gtest/include",
"test/gtest",
}
files {
"test/gtest/src/gtest_main.cc",
}
end