xref: /TaskScheduler/premake4.lua (revision 3d930776)
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 -fsanitize=address -fno-omit-frame-pointer" }
91		linkoptions { "-fsanitize=address" }
92	else
93--		defines { "MT_THREAD_SANITIZER"}
94		buildoptions { "-Wno-invalid-offsetof -fsanitize=undefined -fPIE -g -fno-omit-frame-pointer" }
95  		linkoptions { "-fsanitize=undefined -pie" }
96  	end
97  end
98end
99
100configuration "x64"
101if isVisualStudio then
102-- Compiler Warning (level 4) C4127. Conditional expression is constant
103        buildoptions { "/wd4127"  }
104else
105	buildoptions { "-std=c++11" }
106  if isPosix then
107  	linkoptions { "-rdynamic" }
108  	if isOSX then
109		buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fsanitize=address -fno-omit-frame-pointer" }
110		linkoptions { "-fsanitize=address" }
111	else
112--		defines { "MT_THREAD_SANITIZER"}
113		buildoptions { "-Wno-invalid-offsetof -fsanitize=undefined -fPIE -g -fno-omit-frame-pointer" }
114  		linkoptions { "-fsanitize=undefined -pie" }
115  	end
116  end
117end
118
119
120--  give each configuration/platform a unique output directory
121
122for _, config in ipairs(config_list) do
123	for _, plat in ipairs(platform_list) do
124		configuration { config, plat }
125		objdir    ( "Build/" .. _ACTION .. "/tmp/"  .. config  .. "-" .. plat )
126	end
127end
128
129os.mkdir("./Bin")
130
131-- SUBPROJECTS
132
133
134project "UnitTest++"
135	kind "StaticLib"
136	defines { "_CRT_SECURE_NO_WARNINGS" }
137	files {
138		"ThirdParty/UnitTest++/UnitTest++/**.cpp",
139                "ThirdParty/UnitTest++/UnitTest++/**.h",
140	}
141
142if isPosix or isOSX then
143	excludes { "ThirdParty/UnitTest++/UnitTest++/Win32/**.*" }
144else
145	excludes { "ThirdParty/UnitTest++/UnitTest++/Posix/**.*" }
146end
147
148
149project "Squish"
150	kind "StaticLib"
151	defines { "_CRT_SECURE_NO_WARNINGS" }
152	files {
153		"ThirdParty/Squish/**.*",
154	}
155
156	includedirs
157	{
158		"ThirdParty/Squish"
159	}
160
161
162project "TaskScheduler"
163        kind "StaticLib"
164 	flags {"NoPCH"}
165 	files {
166 		"Scheduler/**.*",
167 	}
168
169	includedirs
170	{
171		"ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++"
172	}
173
174	if isPosix or isOSX then
175	excludes { "Src/Platform/Windows/**.*" }
176	else
177	excludes { "Src/Platform/Posix/**.*" }
178	end
179
180project "TaskSchedulerTests"
181 	flags {"NoPCH"}
182 	kind "ConsoleApp"
183 	files {
184 		"SchedulerTests/**.*",
185 	}
186
187	includedirs
188	{
189		"ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++"
190	}
191
192	if isPosix or isOSX then
193	excludes { "Src/Platform/Windows/**.*" }
194	else
195	excludes { "Src/Platform/Posix/**.*" }
196	end
197
198	links {
199		"UnitTest++", "Squish", "TaskScheduler"
200	}
201
202
203	if isPosix or isOSX then
204		links { "pthread" }
205	end
206
207
208
209