xref: /TaskScheduler/premake4.lua (revision 3fef42a0)
1if not _ACTION then
2	_ACTION="vs2010"
3end
4
5isPosix = false
6isVisualStudio = false
7isOSX = false
8
9if _ACTION == "vs2002" or _ACTION == "vs2003" or _ACTION == "vs2005" or _ACTION == "vs2008" or _ACTION == "vs2010" then
10	isVisualStudio = true
11end
12
13if _ACTION == "codeblocks" or _ACTION == "gmake"
14then
15	isPosix = true
16end
17
18if _ACTION == "xcode3" or os.is("macosx")
19then
20	isOSX = true
21end
22
23
24
25solution "TaskScheduler"
26
27	language "C++"
28
29	location ( "Build/" .. _ACTION )
30	flags {"NoManifest", "ExtraWarnings", "StaticRuntime", "NoMinimalRebuild", "FloatFast", "EnableSSE2" }
31	optimization_flags = { "OptimizeSpeed" }
32	targetdir("Bin")
33
34if isPosix or isOSX then
35	defines { "_XOPEN_SOURCE=600" }
36end
37
38if isOSX then
39	defines { "_DARWIN_C_SOURCE=1" }
40end
41
42
43if isVisualStudio then
44	debugdir ("Bin")
45end
46
47
48	local config_list = {
49		"Release",
50		"Debug",
51                "Instrumented_Release",
52                "Instrumented_Debug"
53	}
54	local platform_list = {
55		"x32",
56		"x64"
57	}
58
59	configurations(config_list)
60	platforms(platform_list)
61
62
63-- CONFIGURATIONS
64
65configuration "Instrumented_Release"
66	defines { "NDEBUG", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" }
67	flags { "Symbols", optimization_flags }
68
69configuration "Instrumented_Debug"
70	defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" }
71	flags { "Symbols" }
72
73configuration "Release"
74	defines { "NDEBUG", "MT_UNICODE" }
75	flags { "Symbols", optimization_flags }
76
77configuration "Debug"
78	defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_UNICODE"}
79	flags { "Symbols" }
80
81configuration "x32"
82if isVisualStudio then
83-- Compiler Warning (level 4) C4127. Conditional expression is constant
84        buildoptions { "/wd4127"  }
85else
86	buildoptions { "-std=c++11" }
87  if isPosix then
88  	linkoptions { "-rdynamic" }
89  	if isOSX then
90		buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" }
91		--linkoptions { "-fsanitize=undefined" }
92	else
93--		defines { "MT_THREAD_SANITIZER"}
94		buildoptions { "-Wno-invalid-offsetof -fPIE -g -fno-omit-frame-pointer" }
95--		buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" }
96--  		linkoptions { "-fsanitize=address -pie" }
97  	end
98  end
99end
100
101configuration "x64"
102if isVisualStudio then
103-- Compiler Warning (level 4) C4127. Conditional expression is constant
104        buildoptions { "/wd4127"  }
105else
106	buildoptions { "-std=c++11" }
107  if isPosix then
108  	linkoptions { "-rdynamic" }
109  	if isOSX then
110		buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" }
111		--linkoptions { "-fsanitize=undefined" }
112	else
113--		defines { "MT_THREAD_SANITIZER"}
114		buildoptions { "-Wno-invalid-offsetof -fPIE -g -fno-omit-frame-pointer" }
115--		buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" }
116--  		linkoptions { "-fsanitize=address -pie" }
117  	end
118  end
119end
120
121
122--  give each configuration/platform a unique output directory
123
124for _, config in ipairs(config_list) do
125	for _, plat in ipairs(platform_list) do
126		configuration { config, plat }
127		objdir    ( "Build/" .. _ACTION .. "/tmp/"  .. config  .. "-" .. plat )
128	end
129end
130
131os.mkdir("./Bin")
132
133-- SUBPROJECTS
134
135
136project "UnitTest++"
137	kind "StaticLib"
138	defines {
139		"_CRT_SECURE_NO_WARNINGS"
140	}
141
142	files {
143		"ThirdParty/UnitTest++/UnitTest++/**.cpp",
144		"ThirdParty/UnitTest++/UnitTest++/**.h",
145	}
146
147	if isPosix or isOSX then
148		excludes { "ThirdParty/UnitTest++/UnitTest++/Win32/**.*" }
149	else
150		excludes { "ThirdParty/UnitTest++/UnitTest++/Posix/**.*" }
151	end
152
153
154project "Squish"
155	kind "StaticLib"
156	defines {
157		"_CRT_SECURE_NO_WARNINGS"
158	}
159
160	files {
161		"ThirdParty/Squish/**.*",
162	}
163
164	includedirs {
165		"ThirdParty/Squish"
166	}
167
168project "TaskScheduler"
169    kind "StaticLib"
170 	flags {"NoPCH"}
171 	files {
172 		"Scheduler/**.*",
173		 "ThirdParty/Boost.Context/*.h",
174 	}
175
176	includedirs {
177		"ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++", "ThirdParty/Boost.Context"
178	}
179
180	if isPosix or isOSX then
181	excludes { "Src/Platform/Windows/**.*" }
182	else
183	excludes { "Src/Platform/Posix/**.*" }
184	end
185
186project "TaskSchedulerTests"
187 	flags {"NoPCH"}
188 	kind "ConsoleApp"
189 	files {
190 		"SchedulerTests/**.*",
191 	}
192
193	includedirs {
194		"ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++"
195	}
196
197	if isPosix or isOSX then
198	excludes { "Src/Platform/Windows/**.*" }
199	else
200	excludes { "Src/Platform/Posix/**.*" }
201	end
202
203	links {
204		"UnitTest++", "Squish", "TaskScheduler"
205	}
206
207	if isPosix or isOSX then
208		links { "pthread" }
209	end
210
211
212
213