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