-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake5.lua
373 lines (312 loc) · 9.41 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
workspace "Dwarfworks"
architecture "x64"
startproject "Sandbox"
configurations {
"Debug", -- Full on debug code enabled with all information available
"Release", -- Stripped out a lot of debug info, but some (like Logging) is kept
"Dist" -- build to be distributed to the public with all debug info stripped
}
-- platform-independent output directory definition
OutputDir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
-- include directories relative to root folder (solution directory)
IncludeDir = {}
IncludeDir["GLFW"] = "Dwarfworks/Vendor/glfw/include"
IncludeDir["Glad"] = "Dwarfworks/Vendor/glad/include"
IncludeDir["ImGui"] = "Dwarfworks/Vendor/imgui"
IncludeDir["glm"] = "Dwarfworks/Vendor/glm"
IncludeDir["spdlog"] = "Dwarfworks/Vendor/spdlog/include"
IncludeDir["debugbreak"] = "Dwarfworks/Vendor/debugbreak"
IncludeDir["stb_image"] = "Dwarfworks/Vendor/stb_image"
-- IncludeDir["directx"] = "Dwarfworks/Vendor/directx"
-- define project external dependencies
--group "Dependencies"
--include "Dwarfworks/Vendor/glfw"
--include "Dwarfworks/Vendor/glad"
--include "Dwarfworks/Vendor/imgui"
-- relative path to Dwarfworks source folder
local SourceDir = "%{prj.name}/Source"
local VendorDir = "%{prj.name}/Vendor"
----------------------------
-- Dwarfworks --
----------------------------
project "Dwarfworks"
-- set project general settings
location "Dwarfworks"
kind "StaticLib" -- SharedLib
language "C++"
cppdialect "C++17"
staticruntime "on" -- off
configurations {
"Debug", -- Full on debug code enabled with all information available
"Release", -- Stripped out a lot of debug info, but some (like Logging) is kept
"Dist" -- build to be distributed to the public with all debug info stripped
}
-- define project external dependencies
group "Dependencies"
include "Dwarfworks/Vendor/glfw"
include "Dwarfworks/Vendor/glad"
include "Dwarfworks/Vendor/imgui"
targetdir ("bin/" .. OutputDir .. "/%{prj.name}")
objdir ("bin-int/" .. OutputDir .. "/%{prj.name}")
-- setup PCH (pre-compiled headers)
-- for GNU makefiles
filter "action:gmake"
pchheader "dwpch.h"
pchsource "dwpch.cpp"
-- for Visual Studio actions
filter "action:vs*"
pchheader "dwpch.h"
pchsource "dwpch.cpp"
-- for Xcode actions
filter "action:xcode*"
pchheader "Source/dwpch.h"
pchsource "Source/dwpch.cpp"
-- set project source files
files {
SourceDir .. "/*.h",
SourceDir .. "/*.cpp",
SourceDir .. "/Dwarfworks/**.h",
SourceDir .. "/Dwarfworks/**.cpp",
SourceDir .. "/Dwarfworks/Source/**.h",
SourceDir .. "/Dwarfworks/Source/**.cpp",
VendorDir .. "/stb_image/**.h",
VendorDir .. "/stb_image/**.cpp",
VendorDir .. "/glm/**.hpp",
VendorDir .. "/glm/**.inl"
}
-- silence external "noise"
defines {
"_CRT_SECURE_NO_WARNINGS"
}
-- set project include directories
includedirs {
-- the project source folder
".",
SourceDir,
-- Cross-platform break into source-line debugger
"%{IncludeDir.debugbreak}",
-- External Logging lib - spdlog
"%{IncludeDir.spdlog}",
-- SIMD Mathematics
"%{IncludeDir.glm}",
-- (cross-platform) Window lib - GLFW
"%{IncludeDir.GLFW}",
-- Modern OpenGL profile loader
"%{IncludeDir.Glad}",
-- Immediate mode UI
"%{IncludeDir.ImGui}",
-- Image decoding/encoding
"%{IncludeDir.stb_image}"
}
links {
"GLFW",
"Glad",
"ImGui"
}
-- set project target properties
filter "system:windows"
-- system "windows"
systemversion "latest"
-- Windows specific
files {
-- VendorDir .. "/directx/**.h",
SourceDir .. "/Platform/Windows/**.h",
SourceDir .. "/Platform/Windows/**.cpp",
SourceDir .. "/Platform/OpenGL/**.h",
SourceDir .. "/Platform/OpenGL/**.cpp",
}
--
includedirs {
-- DirectX helpers
-- "%{IncludeDir.directx}"
}
--
links {
-- OpenGL
"opengl32.lib",
-- D3D12
-- "d3d12.lib", "dxgi.lib", "dxguid.lib",
}
-- preprocessor definitions
defines {
-- "DW_BUILD_DLL",
"GLFW_INCLUDE_NONE",
}
-- Temporary disabled until building the engine as a dll gets re-enabled
-- copying DLLs and resoruces
-- postbuildcommands {
-- copy dwarfworks.dll into sandbox
-- ("{COPY} %{cfg.buildtarget.relpath} ../bin/" .. OutputDir .. "/Sandbox")
-- }
filter "system:macosx"
-- system "macosx"
systemversion "latest"
-- Mac specific
files {
SourceDir .. "/Platform/OpenGL/**.h",
SourceDir .. "/Platform/OpenGL/**.cpp",
SourceDir .. "/Platform/Mac/**.h",
SourceDir .. "/Platform/Mac/**.cpp",
}
--
links {
"OpenGL.framework",
"Cocoa.framework",
"OpenGL.framework",
"IOKit.framework",
"CoreFoundation.framework"
}
--
defines {
"CFG_MACOS",
"__APPLE__",
"GLFW_INCLUDE_NONE",
}
filter "system:linux"
-- system "linux"
systemversion "latest"
-- Linux specific
files {
SourceDir .. "/Platform/OpenGL/**.h",
SourceDir .. "/Platform/OpenGL/**.cpp",
SourceDir .. "/Platform/Linux/**.h",
SourceDir .. "/Platform/Linux/**.cpp",
}
--
links {
"Xrandr",
"Xi",
"GLU",
"GL",
"X11",
"dl",
"pthread",
}
-- preprocessor definitions
defines {
-- "DW_BUILD_DLL",
"GLFW_INCLUDE_NONE"
}
print("%{cfg.buildtarget.relpath} ../bin/" .. OutputDir .. "/Sandbox")
-- specify build and compilation options per build configuration
filter "configurations:Debug"
defines {
"DW_DEBUG"
}
symbols "on"
filter "configurations:Release"
defines "DW_RELEASE"
optimize "on"
filter "configurations:Dist"
defines "DW_DIST"
optimize "on"
-------------------------
-- Sandbox --
-------------------------
project "Sandbox"
-- set project general settings
location "Sandbox"
kind "ConsoleApp" -- executable
language "C++"
cppdialect "C++17"
staticruntime "on"
configurations {
"Debug", -- Full on debug code enabled with all information available
"Release", -- Stripped out a lot of debug info, but some (like Logging) is kept
"Dist" -- build to be distributed to the public with all debug info stripped
}
-- define project external dependencies
group "Dependencies"
--include "Dwarfworks"
include "Dwarfworks/Vendor/glfw"
include "Dwarfworks/Vendor/glad"
include "Dwarfworks/Vendor/imgui"
targetdir ("bin/" .. OutputDir .. "/%{prj.name}")
objdir ("bin-int/" .. OutputDir .. "/%{prj.name}")
-- set project source files
files {
SourceDir .. "/**.h",
SourceDir .. "/**.hpp",
SourceDir .. "/**.cpp"
}
-- set project include directories
includedirs {
-- Dwarfworks
"Dwarfworks/Source",
"Dwarfworks/Vendor",
-- Cross-platform break into source-line debugger
"%{IncludeDir.debugbreak}",
-- External Logging lib - spdlog
"%{IncludeDir.spdlog}",
-- External Mathematics lib - glm
"%{IncludeDir.glm}"
}
-- set project link targets
links {
"Dwarfworks"
}
-- set project target properties
filter "system:windows"
systemversion "latest"
links {}
defines {
-- "DW_DYNAMIC_LINK"
}
filter "system:macosx"
systemversion "latest"
links {
"GLFW",
"Glad",
"ImGui",
"Cocoa.framework",
"OpenGL.framework",
"IOKit.framework",
"CoreFoundation.framework",
}
defines {
-- "DW_DYNAMIC_LINK"
--"CFG_MACOS",
--"__APPLE__",
"GLFW_INCLUDE_NONE",
}
filter "system:linux"
systemversion "latest"
links {
"GLFW",
"Glad",
"ImGui",
"Xrandr",
"Xi",
"GLU",
"GL",
"X11",
"dl",
"pthread",
}
defines {
-- "DW_DYNAMIC_LINK"
}
-- specify build and compilation options per build configuration
filter "configurations:Debug"
defines {
-- "DEBUG",
"DW_DEBUG"
}
runtime "Debug"
symbols "on"
filter "configurations:Release"
defines
{
-- "DEBUG",
"DW_RELEASE"
}
runtime "Release"
optimize "on"
filter "configurations:Dist"
defines
{
-- "NDEBUG",
"DW_DIST"
}
runtime "Release"
optimize "on"