forked from 7thFACTOR/horus_ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake5.lua
288 lines (229 loc) · 5.91 KB
/
premake5.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
workspace "horus"
if _ACTION ~= "gmake" and _ACTION ~= "xcode" then
function os.winSdkVersion()
local reg_arch = iif( os.is64bit(), "\\Wow6432Node\\", "\\" )
local sdk_version = os.getWindowsRegistry( "HKLM:SOFTWARE" .. reg_arch .."Microsoft\\Microsoft SDKs\\Windows\\v10.0\\ProductVersion" )
if sdk_version ~= nil then return sdk_version end
end
filter {"system:windows", "action:vs*"}
systemversion(os.winSdkVersion() .. ".0")
end
filter {}
-- Location of the solutions
if _ACTION == "vs2015" then
location "./build_vs2015"
-- We're on Windows, this will be used in code for ifdef
defines {"_WINDOWS"}
system ("windows")
end
-- Location of the solutions
if _ACTION == "vs2017" then
location "./build_vs2017"
-- We're on Windows, this will be used in code for ifdef
defines {"_WINDOWS", "_WIN32"}
system ("windows")
end
if _ACTION == "gmake" and _ARGS[1] == "macos" then
location "./build_gmake"
-- We're on Linux, this will be used in code for ifdef
defines {"_APPLE"}
system ("macosx")
else
if _ACTION == "gmake" then
location "./build_gmake"
-- We're on Linux, this will be used in code for ifdef
defines {"_LINUX"}
system ("linux")
end
end
if _ACTION == "xcode" then
location "./build_xcode"
-- We're on OSX, this will be used in code for ifdef
defines {"_APPLE"}
system ("macosx")
end
postbuildcommands { "{MKDIR} bin" }
postbuildcommands { "{COPY} \"%{cfg.linktarget.abspath}\" bin" }
language "C++"
-- We only support 64bit architectures
architecture "x64"
configurations { "Debug", "Release" }
-- Keep the script root to be used in paths
scriptRoot = _WORKING_DIR
-- With no filter, we set some global settings
filter {}
debugdir "bin"
targetdir "bin"
libdirs { "%{prj.location}\\bin" }
-- We support Unicode
characterset ("Unicode")
flags { "NoMinimalRebuild", "MultiProcessorCompile", "NoPCH" }
cppdialect "C++11"
filter { "system:windows" }
-- Disable some warnings
disablewarnings { 4251, 4006, 4221, 4204 }
filter {}
filter { "system:linux or macosx or ios" }
buildoptions {"-pthread"}
buildoptions {"-fpermissive"}
filter {}
---
--- Prepare the configurations
---
filter { "configurations:Debug" }
symbols "On"
optimize "Debug"
defines {"_DEBUG"}
warnings "Off"
filter { "configurations:Development" }
symbols "On"
optimize "Speed"
defines {"_DEVELOPMENT"}
defines {"NDEBUG"}
warnings "Off"
filter { "configurations:Release" }
optimize "Full"
defines {"_SHIPPING"}
defines {"_RELEASE"}
defines {"NDEBUG"}
warnings "Off"
---
--- Global defines
---
filter {}
-- used for new/delete override, with logging of new/delete operations
filter { "configurations:Debug or Development" }
filter {}
---
--- Utility functions
---
function add_sources_from(path)
files { path.."**.h" }
files { path.."**.hpp" }
files { path.."**.cpp" }
files { path.."**.cxx" }
files { path.."**.c" }
files { path.."**.inl" }
end
function add_res_from(path)
files { path.."**/resource.h" }
files { path.."**.res" }
files { path.."**.rc" }
end
---
--- Linking with our libraries and 3rdparty
---
function link_win32()
filter { "system:windows" }
links { "shlwapi", "winmm", "Ws2_32", "Wininet", "dbghelp" }
links { "user32", "gdi32", "winmm", "imm32", "ole32", "oleaut32", "version", "uuid"}
filter {}
end
function link_opengl()
filter {}
defines {"USE_OPENGL"}
filter { "system:windows" }
links { "opengl32" }
filter { "system:linux" }
links { "GL", "GLU", "X11" }
filter {}
end
function link_freetype()
filter {}
includedirs {scriptRoot.."/3rdparty/freetype/include"}
filter { "configurations:Debug"}
links { "freetype_d" }
filter { "configurations:Release"}
links { "freetype" }
end
function link_glew()
filter {}
defines {"GLEW_STATIC"}
includedirs {scriptRoot.."/3rdparty/glew/include"}
filter { "configurations:Debug" }
links { "glew_d" }
filter {}
filter { "configurations:Release" }
links { "glew" }
filter {}
end
function link_binpack()
filter {}
includedirs {scriptRoot.."/3rdparty/binpack"}
filter { "configurations:Debug" }
links { "binpack_d" }
filter {}
filter { "configurations:Release" }
links { "binpack" }
filter {}
end
function link_stb_image()
filter {}
includedirs {scriptRoot.."/3rdparty/stb_image"}
filter { "configurations:Debug" }
links { "stb_image_d" }
filter {}
filter { "configurations:Release" }
links { "stb_image" }
filter {}
end
function link_jsoncpp()
filter {}
includedirs {scriptRoot.."/3rdparty/jsoncpp/include"}
filter { "configurations:Debug" }
links { "jsoncpp_d" }
filter {}
filter { "configurations:Release" }
links { "jsoncpp" }
filter {}
end
function link_nfd()
filter {}
includedirs {scriptRoot.."/3rdparty/nativefiledialog/src/include"}
filter { "configurations:Debug" }
links { "nativefiledialog_d" }
filter {}
filter { "configurations:Release" }
links { "nativefiledialog" }
filter {}
end
function link_sdl2()
filter {}
includedirs {scriptRoot.."/3rdparty/sdl2/include"}
filter { "configurations:Debug" }
links { "sdl2" }
filter {}
filter { "configurations:Release" }
links { "sdl2" }
filter {}
end
---
--- Own libs
---
function link_horus_static()
filter {}
includedirs {scriptRoot.."/include"}
filter { "configurations:Debug" }
links { "horus_sd" }
filter {}
filter { "configurations:Release" }
links { "horus_s" }
filter {}
end
function link_horus()
filter {}
includedirs {scriptRoot.."/include"}
filter { "configurations:Debug" }
links { "horus_d" }
filter {}
filter { "configurations:Release" }
links { "horus" }
filter {}
end
---
--- Include the subprojects
---
-- TODO: we need to generate solutions for CMake for 3rdparty that uses it
include "3rdparty"
include "src"
include "examples"