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