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