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