-
Notifications
You must be signed in to change notification settings - Fork 59
/
premake4.lua
215 lines (170 loc) · 4.55 KB
/
premake4.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
if not _ACTION then
_ACTION="vs2010"
end
isPosix = false
isVisualStudio = false
isOSX = false
if _ACTION == "vs2002" or _ACTION == "vs2003" or _ACTION == "vs2005" or _ACTION == "vs2008" or _ACTION == "vs2010" or _ACTION == "vs2012" then
isVisualStudio = true
end
if _ACTION == "codeblocks" or _ACTION == "gmake"
then
isPosix = true
end
if _ACTION == "xcode3" or os.is("macosx")
then
isOSX = true
end
solution "TaskScheduler"
language "C++"
location ( "Build/" .. _ACTION )
if isVisualStudio then
flags {"NoManifest", "ExtraWarnings", "StaticRuntime", "NoMinimalRebuild", "FloatFast" }
else
flags {"NoManifest", "ExtraWarnings", "StaticRuntime", "NoMinimalRebuild", "FloatFast", "EnableSSE2" }
end
optimization_flags = { "OptimizeSpeed" }
targetdir("Bin")
if isPosix or isOSX then
defines { "_XOPEN_SOURCE=600" }
end
if isOSX then
defines { "_DARWIN_C_SOURCE=1" }
end
if isVisualStudio then
defines { "_ALLOW_RTCc_IN_STL=1" }
debugdir ("Bin")
end
local config_list = {
"Release",
"Debug",
"Instrumented_Release",
"Instrumented_Debug"
}
local platform_list = {
"x32",
"x64"
}
configurations(config_list)
platforms(platform_list)
-- CONFIGURATIONS
configuration "Instrumented_Release"
defines { "NDEBUG", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" }
flags { "Symbols", optimization_flags }
configuration "Instrumented_Debug"
defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" }
flags { "Symbols" }
configuration "Release"
defines { "NDEBUG", "MT_UNICODE" }
flags { "Symbols", optimization_flags }
configuration "Debug"
defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_UNICODE"}
flags { "Symbols" }
configuration "x32"
if isVisualStudio then
-- Compiler Warning (level 4) C4127. Conditional expression is constant
buildoptions { "/wd4127" }
flags { "EnableSSE2" }
else
buildoptions { "-std=c++11" }
if isPosix then
linkoptions { "-rdynamic" }
if isOSX then
buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" }
--linkoptions { "-fsanitize=undefined" }
else
-- defines { "MT_THREAD_SANITIZER"}
buildoptions { "-Wno-invalid-offsetof -fPIE -g -fno-omit-frame-pointer" }
-- buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" }
-- linkoptions { "-fsanitize=address -pie" }
end
end
end
configuration "x64"
if isVisualStudio then
-- Compiler Warning (level 4) C4127. Conditional expression is constant
buildoptions { "/wd4127" }
else
buildoptions { "-std=c++11" }
if isPosix then
linkoptions { "-rdynamic" }
if isOSX then
buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" }
--linkoptions { "-fsanitize=undefined" }
else
-- defines { "MT_THREAD_SANITIZER"}
buildoptions { "-Wno-invalid-offsetof -fPIE -g -fno-omit-frame-pointer" }
-- buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" }
-- linkoptions { "-fsanitize=address -pie" }
end
end
end
-- give each configuration/platform a unique output directory
for _, config in ipairs(config_list) do
for _, plat in ipairs(platform_list) do
configuration { config, plat }
objdir ( "Build/" .. _ACTION .. "/tmp/" .. config .. "-" .. plat )
end
end
os.mkdir("./Bin")
-- SUBPROJECTS
project "UnitTest++"
kind "StaticLib"
defines {
"_CRT_SECURE_NO_WARNINGS"
}
files {
"ThirdParty/UnitTest++/UnitTest++/**.cpp",
"ThirdParty/UnitTest++/UnitTest++/**.h",
}
if isPosix or isOSX then
excludes { "ThirdParty/UnitTest++/UnitTest++/Win32/**.*" }
else
excludes { "ThirdParty/UnitTest++/UnitTest++/Posix/**.*" }
end
project "Squish"
kind "StaticLib"
defines {
"_CRT_SECURE_NO_WARNINGS"
}
files {
"ThirdParty/Squish/**.*",
}
includedirs {
"ThirdParty/Squish"
}
project "TaskScheduler"
kind "StaticLib"
flags {"NoPCH"}
files {
"Scheduler/**.*",
"ThirdParty/Boost.Context/*.h",
}
includedirs {
"ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++", "ThirdParty/Boost.Context"
}
if isPosix or isOSX then
excludes { "Src/Platform/Windows/**.*" }
else
excludes { "Src/Platform/Posix/**.*" }
end
project "TaskSchedulerTests"
flags {"NoPCH"}
kind "ConsoleApp"
files {
"SchedulerTests/**.*",
}
includedirs {
"ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++"
}
if isPosix or isOSX then
excludes { "Src/Platform/Windows/**.*" }
else
excludes { "Src/Platform/Posix/**.*" }
end
links {
"UnitTest++", "Squish", "TaskScheduler"
}
if isPosix or isOSX then
links { "pthread" }
end