-
Notifications
You must be signed in to change notification settings - Fork 4
/
premake5.lua
188 lines (173 loc) · 6.85 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
workspace "Primal"
configurations { "Debug", "Release", "DebugEditor", "ReleaseEditor" }
platforms "x64"
architecture "x64"
defines "PRIMAL_PLUS"
flags "MultiProcessorCompile"
if _TARGET_OS == "windows" then
startproject "PrimalEditor"
linkoptions {"/ignore:4099"}
else
startproject "EngineTest"
end
filter "configurations:Debug"
defines "_DEBUG"
symbols "On"
filter "configurations:DebugEditor"
defines { "_DEBUG", "USE_WITH_EDITOR" }
symbols "On"
filter "configurations:Release"
defines "NDEBUG"
optimize "On"
omitframepointer "On"
flags {"LinkTimeOptimization", "NoBufferSecurityCheck", "NoRuntimeChecks"}
filter "configurations:ReleaseEditor"
defines { "NDEBUG" , "USE_WITH_EDITOR" }
optimize "On"
omitframepointer "On"
flags {"LinkTimeOptimization", "NoBufferSecurityCheck", "NoRuntimeChecks"}
if _TARGET_OS == "linux" then
toolset "gcc"
end
-- If this is generated for VisualStudio, use their own path macros. If not, use Premake's wildcards
if _ACTION == "vs2022" then
outputdir = "$(SolutionDir)$(Platform)/$(Configuration)/"
intermediatesdir="$(Platform)/$(Configuration)/"
else
outputdir = "%{wks.location}/%{cfg.platform}/%{cfg.buildcfg}"
intermediatesdir = "%{cfg.platform}/%{cfg.buildcfg}"
end
-- This should only build in DebugEditor and ReleaseEditor configurations, and therefore only build in
-- the Windows environment
if _TARGET_OS == "windows" then
project "ContentTools"
location "ContentTools"
kind "SharedLib"
language "C++"
cppdialect "C++17"
staticruntime "Off"
targetname "$(ProjectName)"
targetdir (outputdir)
objdir (intermediatesdir)
files { "%{prj.name}/**.h", "%{prj.name}/**.cpp" }
includedirs { "$(SolutionDir)Engine", "$(SolutionDir)Engine/Common", "C:/Program Files/Autodesk/FBX/FBX SDK/2020.2/include" }
rtti "Off"
floatingpoint "Fast"
conformancemode "On"
exceptionhandling "Off"
warnings "Extra"
removeconfigurations { "Release", "Debug" }
-- filter "system:windows"
systemversion "latest"
defines { "CONTENTTOOLS_EXPORTS", "_WINDOWS", "_USRDLL" }
end
-- This should build in all configurations
project "Engine"
location "Engine"
kind "StaticLib"
language "C++"
cppdialect "C++17"
staticruntime "Off"
files { "%{prj.name}/**.h", "%{prj.name}/**.cpp" }
if _TARGET_OS == "windows" then
targetname "$(ProjectName)"
includedirs { "$(SolutionDir)Engine", "$(SolutionDir)Engine/Common", "$(VULKAN_SDK)/Include" }
systemversion "latest"
defines "_LIB"
else
targetname "%{prj.name}"
includedirs { "%{wks.location}/Engine", "%{wks.location}/Engine/Common" }
removefiles { "%{prj.name}/Graphics/Direct3D12/**.cpp" }
buildoptions { "-Wno-switch -Wno-missing-field-initializers -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-unknown-pragmas -Wno-class-memaccess -Wno-reorder" }
links { "X11" }
if _ARGS[1] == "wayland" then
defines "PLATFORM_WAYLAND"
end
end
targetdir (outputdir)
objdir (intermediatesdir)
rtti "Off"
floatingpoint "Fast"
conformancemode "On"
exceptionhandling "Off"
warnings "Extra"
nuget "Microsoft.Direct3D.D3D12:1.606.3"
if _ACTION == "vs2022" then
require('vstudio')
premake.override(premake.vstudio.vc2010, "project", function(base, prj)
base(prj)
premake.w('<Import Project="..\\packages\\Microsoft.Direct3D.D3D12.1.606.3\\build\\native\\Microsoft.Direct3D.D3D12.props" Condition="Exists(\'..\\packages\\Microsoft.Direct3D.D3D12.1.606.3\\build\\native\\Microsoft.Direct3D.D3D12.props\')" />')
end)
end
-- This should only build in DebugEditor and ReleaseEditor configurations, and therefore only build in
-- the Windows environment
if _TARGET_OS == "windows" then
project "EngineDLL"
location "EngineDLL"
kind "SharedLib"
language "C++"
cppdialect "C++17"
staticruntime "Off"
targetname "$(ProjectName)"
targetdir (outputdir)
objdir (intermediatesdir)
files { "%{prj.name}/**.h", "%{prj.name}/**.cpp" }
includedirs {"$(SolutionDir)Engine", "$(SolutionDir)Engine/Common"}
libdirs "$(OutDir)"
rtti "Off"
floatingpoint "Fast"
conformancemode "On"
exceptionhandling "Off"
warnings "Extra"
dependson "Engine"
removeconfigurations { "Release", "Debug" }
-- filter "system:windows"
systemversion "latest"
defines { "ENGINEDLL_EXPORTS", "_WINDOWS", "_USRDLL" }
end
-- This should only build in Debug and Release configurations
project "EngineTest"
location "EngineTest"
kind "WindowedApp"
language "C++"
cppdialect "C++17"
staticruntime "Off"
if _TARGET_OS == "windows" then
targetname "$(ProjectName)"
includedirs { "$(SolutionDir)Engine", "$(SolutionDir)Engine/Common" }
libdirs "$(OutDir)"
systemversion "latest"
defines "_CONSOLE"
else
targetname "%{prj.name}"
includedirs { "%{wks.location}/Engine", "%{wks.location}/Engine/Common" }
buildoptions { "-Wno-switch -Wno-missing-field-initializers -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-unknown-pragmas -Wno-class-memaccess -Wno-reorder" }
libdirs (outputdir)
links { "X11", "Engine" }
end
targetdir (outputdir)
objdir (intermediatesdir)
files { "%{prj.name}/**.h", "%{prj.name}/**.cpp" }
rtti "Off"
floatingpoint "Fast"
conformancemode "On"
exceptionhandling "Off"
warnings "Extra"
dependson "Engine"
removeconfigurations { "ReleaseEditor", "DebugEditor" }
filter "system:windows"
prebuildcommands {"powershell -ExecutionPolicy Bypass -File $(SolutionDir)GetDXC.ps1 $(SolutionDir)packages\\DirectXShaderCompiler",
"xcopy /Y /D $(SolutionDir)packages\\DirectXShaderCompiler\\bin\\x64\\dxcompiler.dll $(OutDir)",
"xcopy /Y /D $(SolutionDir)packages\\DirectXShaderCompiler\\bin\\x64\\dxil.dll $(OutDir)" }
prebuildmessage "If packages\\DirectXShaderCompiler\\ folder doesn't exist or is empty then download the latest release of DXC"
-- This should only build in DebugEditor and ReleaseEditor configurations, and therefore only build in
-- the Windows environment
if _TARGET_OS == "windows" then
project "PrimalEditor"
location "PrimalEditor"
kind "WindowedApp"
language "C#"
dotnetframework "net6.0" -- net6.0 for .NET 6.0, netcoreapp3.1 for .NET Core 3.1
targetdir (outputdir)
removeconfigurations { "Release", "Debug" }
end