-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
premake5.lua
248 lines (206 loc) · 8.11 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
-- Configuration settings
include 'Scripts/premake/common/premake-config.lua'
-- Engine tool include directories
include 'Scripts/premake/common/tool_includes.lua'
-- System overrides to support PS4/PS5/PS3 and XBOX ONE/X/SERIES X and other hardware systems
include 'Scripts/premake/extensions/system-overides.lua'
-- Workspace Settings
settings = { }
settings.workspace_name = 'Razix'
settings.bundle_identifier = 'com.PhaniSrikar'
-- Output files directories signature for bin and int-bin
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
-- Current root directory where the global premake file is located
root_dir = os.getcwd()
function generate_default_engine_config()
-- Add this as the installation directory to the engine config file
-- TODO: Use a fixed installation directory in program files insted of an arbitrary thing/ infact use this to verify the proper installation directory
print("Generating Engine Config File...")
local root_dir = os.getcwd()
-- Path to the configuration file
local config_path = root_dir .. "/Engine/content/config/DefaultEngineConfig.ini"
-- Create the file if it doesn't exist
local config_file = io.open(config_path, "r")
local config_content = ""
if config_file then
-- File exists, read the current contents
config_content = config_file:read("*a")
config_file:close()
else
-- File doesn't exist, create a new one with default content
config_content = [[
[Rendering]
EnableAPIValidation = true
EnableMSAA = false
EnableBindless = true
PerfMode = 0 ; None/Fidelity/Performance
GfxQuality = 2 ; High/Medium/Low depending on GPU
PreferredResolution = 1
TargetFPS = 120 ; 60/120
MaxShadowCascades = 4
MSAASamples = 4
]]
end
-- Write the updated content back to the file
config_file = io.open(config_path, "w+")
io.output(config_file)
io.write(config_content)
io.close()
print("Updated configuration file at: " .. config_path)
end
generate_default_engine_config()
-- Set some Razix SDK env variables on Windows only
if os.target() == "windows" then
run_as_admin = "runas /user:administrator"
set_env = run_as_admin .. "SETX RAZIX_SDK" .. root_dir .. " /m >nul 2>&1"
set_env_tools = run_as_admin .. "SETX RAZIX_SDK" .. root_dir .. "/Tools /m >nul 2>&1"
os.execute(set_env)
os.execute(set_env_tools)
end
-- QT SDK - 5.15.2
QTDIR = os.getenv("QTDIR")
if (QTDIR == nil or QTDIR == '') then
print("QTDIR Enviroment variable is not found! Please check your development environment settings")
print("Exiting... fix and regenerate project files again!")
os.exit()
else
print("QTDIR found at : " .. QTDIR)
end
-- Using the command line to get the selected architecture
Arch = ""
if _OPTIONS["arch"] then
Arch = _OPTIONS["arch"]
else
_OPTIONS["arch"] = "x64"
Arch = "x64"
end
-- Razix Engine Global Built Settings
engine_global_config = {
-- Razix is compiled with C++14 (we need constexpr)
-- Using C++17 since Jolt, Entt, Sol needs it. Once we remove the dependencies of the
-- engine on Sol and Entt we will reert back to C++14, with the sole exception of Jolt
cpp_dialect = "C++17"
}
-- Function to apply global settings to a project
function apply_engine_global_config()
if engine_global_config.cpp_dialect then
cppdialect(engine_global_config.cpp_dialect)
end
end
-- The Razix Engine Workspace
workspace ( settings.workspace_name )
location "build"
startproject "Sandbox"
flags 'MultiProcessorCompile' --(this won't work with clang)
-- Use clang on windows
--toolset "clang"
-- Output directory path based on build config
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
-- Complete locatoin
workspace_location = "%{wks.location}"
-- Binaries Output directory
targetdir ("bin/%{outputdir}/")
-- Intermediate files Output directory
objdir ("bin-int/%{outputdir}/obj/")
-- Debugging directory = where the executable is located
debugdir ("bin/%{outputdir}/")
-- Setting the architecture for the workspace
if Arch == "arm" then
architecture "ARM"
elseif Arch == "x64" then
architecture "x86_64"
elseif Arch == "x86" then
architecture "x86"
elseif Arch == "ARM64" then
architecture "ARM64"
end
print("Generating Project files for Architecture = ", Arch)
-- Various build configuration for the engine
configurations
{
"Debug",
"Release",
"Distribution"
}
apply_engine_global_config()
-- Build scripts for the Razix vendor dependencies
group "Dependencies"
include "Engine/vendor/cereal/cereal.lua"
include "Engine/vendor/glfw/glfw.lua"
include "Engine/vendor/imgui/imgui.lua"
include "Engine/vendor/lua/lua.lua"
include "Engine/vendor/optick/optick.lua"
include "Engine/vendor/spdlog/spdlog.lua"
include "Engine/vendor/SPIRVCross/SPIRVCross.lua"
include "Engine/vendor/SPIRVReflect/SPIRVReflect.lua"
include "Engine/vendor/tracy/tracy.lua"
include "Engine/vendor/Jolt/jolt.lua"
group ""
-- Razix Tools Vendor dependencies
group "Dependencies/Tools"
include "Tools/RazixAssetPacker/vendor/assimp/assimp.lua"
include "Tools/RazixAssetPacker/vendor/meshoptimizer/meshoptimizer.lua"
include "Tools/RazixAssetPacker/vendor/OpenFBX/OpenFBX.lua"
group ""
-- Experimental
group "Dependencies/Experimental"
include "Engine/vendor/Experimental/eigen/eigen.lua"
group ""
-- Build Script for Razix Engine (Internal)
--------------------------------------------------------------------------------
group "Engine/internal"
include "Engine/internal/RazixMemory/razixmemory.lua"
include "Engine/internal/RZSTL/rzstl.lua"
group ""
-- Build Script for Razix Engine (Core)
--------------------------------------------------------------------------------
group "Engine"
include "Engine/razix_engine.lua"
group ""
-- Build Script for Razix Editor
--------------------------------------------------------------------------------
group "Editor"
include "Editor/razix_editor.lua"
group ""
-- in-house extension libraries for Razix Editor
group "Editor/internal"
include "Editor/internal/QtNodeGraph/QtNodeGraph_razix.lua"
group ""
-- Editor vendors
group "Editor/vendor"
include "Editor/vendor/QGoodWindow/QGoodWindow.lua"
-- Disabled due to C++20 requirement
-- include "Editor/vendor/qspdlog/qspdlog.lua"
include "Editor/vendor/QtADS/QtADS.lua"
include "Editor/vendor/toolwindowmanager/toolwindowmanager.lua"
group ""
--------------------------------------------------------------------------------
-- Build script for Razix Game Framework
group "Game Framework"
include "GameFramework/razix_game_framework.lua"
group ""
--------------------------------------------------------------------------------
-- Build script for Sandbox
group "Sandbox"
include "Sandbox/sandbox.lua"
group ""
--------------------------------------------------------------------------------
-- Engine related tools
group "Tools"
include "Tools/RazixAssetPacker/razix_tool_asset_packer.lua"
group ""
group "Tools/CLI"
include "Tools/RazixAssetPacker/razix_tool_asset_packer_cli.lua"
group""
group "Tools/Build"
-- premake scripts Utility project for in IDE management
include "Tools/Building/premake/premake_regenerate_proj_files.lua"
-- Gets the version of the Engine for Build workflows
include "Tools/Building/RazixVersion/razix_tool_version.lua"
-- Game Packager using Game Framework
include "Tools/Building/GamePackager/game_packager.lua"
group ""
-- Razix Engine Tests
--------------------------------------------------------------------------------
-- Tests
include "Tests/tests.lua"