xref: /TaskScheduler/premake4.lua (revision f27fe1ee)
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"
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 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" }
62	flags { "Symbols", optimization_flags }
63
64configuration "Instrumented_Debug"
65	defines { "_DEBUG", "MT_INSTRUMENTED_BUILD", "_CRTDBG_MAP_ALLOC" }
66	flags { "Symbols" }
67
68configuration "Release"
69	defines { "NDEBUG" }
70	flags { "Symbols", optimization_flags }
71
72configuration "Debug"
73	defines { "_DEBUG", "_CRTDBG_MAP_ALLOC"}
74	flags { "Symbols" }
75
76configuration "x32"
77if isVisualStudio then
78        buildoptions { "/wd4127"  }
79else
80	buildoptions { "-std=c++11" }
81	linkoptions { "-rdynamic" }
82end
83
84configuration "x64"
85if isVisualStudio then
86        buildoptions { "/wd4127"  }
87else
88	buildoptions { "-std=c++11" }
89	linkoptions { "-rdynamic" }
90end
91
92
93--  give each configuration/platform a unique output directory
94
95for _, config in ipairs(config_list) do
96	for _, plat in ipairs(platform_list) do
97		configuration { config, plat }
98		objdir    ( "Build/" .. _ACTION .. "/tmp/"  .. config  .. "-" .. plat )
99	end
100end
101
102os.mkdir("./Bin")
103os.copyfile("./Scheduler/Profiler/filesaver.min.js", "./Bin/filesaver.min.js")
104os.copyfile("./Scheduler/Profiler/jquery.min.js", "./Bin/jquery.min.js")
105os.copyfile("./Scheduler/Profiler/jquery.mousewheel.min.js", "./Bin/jquery.mousewheel.min.js")
106os.copyfile("./Scheduler/Profiler/w2ui.min.js", "./Bin/w2ui.min.js")
107
108os.copyfile("./Scheduler/Profiler/Profiler.html", "./Bin/Profiler.html")
109
110os.copyfile("./Scheduler/Profiler/w2ui-dark.min.css", "./Bin/w2ui-dark.min.css")
111
112-- SUBPROJECTS
113
114
115project "UnitTest++"
116	kind "StaticLib"
117	defines { "_CRT_SECURE_NO_WARNINGS" }
118	files {
119		"TestFramework/UnitTest++/**.cpp",
120                "TestFramework/UnitTest++/**.h",
121	}
122
123if isPosix or isOSX then
124	excludes { "TestFramework/UnitTest++/Win32/**.*" }
125else
126	excludes { "TestFramework/UnitTest++/Posix/**.*" }
127end
128
129
130project "Squish"
131	kind "StaticLib"
132	defines { "_CRT_SECURE_NO_WARNINGS" }
133	files {
134		"Squish/**.*",
135	}
136
137	includedirs
138	{
139		"Squish"
140	}
141
142
143project "TaskScheduler"
144        kind "StaticLib"
145 	flags {"NoPCH"}
146 	files {
147 		"Scheduler/**.*",
148 	}
149
150	includedirs
151	{
152		"Squish", "Scheduler/Include", "TestFramework/UnitTest++"
153	}
154
155	if isPosix or isOSX then
156	excludes { "Src/Platform/Windows/**.*" }
157	else
158	excludes { "Src/Platform/Posix/**.*" }
159	end
160
161project "Tests"
162 	flags {"NoPCH"}
163 	kind "ConsoleApp"
164 	files {
165 		"Tests/**.*",
166 	}
167
168	includedirs
169	{
170		"Squish", "Scheduler/Include", "TestFramework/UnitTest++"
171	}
172
173	if isPosix or isOSX then
174	excludes { "Src/Platform/Windows/**.*" }
175	else
176	excludes { "Src/Platform/Posix/**.*" }
177	end
178
179	links {
180		"UnitTest++", "Squish", "TaskScheduler"
181	}
182
183
184	if isPosix or isOSX then
185		links { "pthread" }
186	end
187
188	if isVisualStudio then
189		links { "Ws2_32" }
190	end
191
192
193