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