Skip to content

Commit 47cadfe

Browse files
fetchcontent with installed packages
1 parent 71b802f commit 47cadfe

6 files changed

Lines changed: 170 additions & 13 deletions

File tree

.github/workflows/job-cmakebuild-macOS.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
- name: Update LLVM
3030
run: brew install llvm
3131

32+
- name: Install Dependencies
33+
run: brew install assimp spirv-headers spirv-tools spirv-cross glslang glfw glew yaml-cpp spdlog googletest
34+
3235
- name: CMake Build
3336
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} -Architecture ${{inputs.architecture}} -RunClangFormat 0
3437
shell: pwsh

.github/workflows/job-test-linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
with:
2323
name: Build-linux-${{ inputs.configuration }}
2424

25+
- name: Install Dependencies
26+
run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-22 glslang-tools libwayland-dev libxkbcommon-dev
27+
2528
- name: Update access permission of ZEngineTests
2629
run: chmod +x ${{github.workspace}}/tests/ZEngineTests
2730

.github/workflows/job-test-macOS.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ jobs:
1717
name: test-macOS-${{ inputs.architecture }}-${{ inputs.configuration }}
1818
runs-on: ${{ inputs.architecture == 'x64' && 'macos-15-intel' || 'macos-latest' }}
1919
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Install Dependencies
24+
run: brew install assimp spirv-headers spirv-tools spirv-cross glslang glfw glew yaml-cpp spdlog googletest fmt
25+
2026
- name: Download Artifacts
2127
uses: actions/download-artifact@v6
2228
with:

Scripts/PostBuild.ps1

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# MIT License
2+
3+
# Copyright (c) 2020 Jean Philippe
4+
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
#Requires -PSEdition Core
24+
25+
param (
26+
[Parameter(HelpMessage="SystemName type to build, default to Windows")]
27+
[ValidateSet('Windows', 'Darwin', 'Linux')]
28+
[string[]] $SystemName = 'Windows',
29+
30+
[Parameter(HelpMessage = "Architecture to build")]
31+
[ValidateSet('x64', 'arm64')]
32+
[string] $Architecture = 'x64',
33+
34+
[Parameter(HelpMessage="Configuration type to build, default to Debug")]
35+
[ValidateSet('Debug', 'Release')]
36+
[string[]] $Configurations = 'Debug',
37+
38+
[Parameter(HelpMessage = "Build Launcher only")]
39+
[switch] $LauncherOnly
40+
)
41+
42+
$ErrorActionPreference = "Stop"
43+
$TargetFramework = 'net8.0'
44+
45+
[string]$RepoRoot = [IO.Path]::Combine($PSScriptRoot, "..")
46+
[string]$OuputBuildDirectory = If($IsWindows) {
47+
[IO.Path]::Combine($RepoRoot, "Result.Windows.x64.MultiConfig")
48+
} Else {
49+
[IO.Path]::Combine($RepoRoot, "Result.$SystemName.x64.$Configurations")
50+
}
51+
52+
if($LauncherOnly) {
53+
Write-Host "Skipping resources copy..."
54+
return;
55+
}
56+
57+
$ContentsToProcess = @(
58+
@{
59+
Name = "Resources"
60+
IsDirectory = $true
61+
Contents = @(
62+
switch ($SystemName) {
63+
"Windows" {
64+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Shaders"}
65+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Settings"}
66+
}
67+
"Darwin" {
68+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Shaders"}
69+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Settings"}
70+
}
71+
"Linux" {
72+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\Shaders"}
73+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\Settings"}
74+
}
75+
Default {
76+
throw 'This system is not supported'
77+
}
78+
}
79+
)
80+
},
81+
@{
82+
Name = "Obelisk"
83+
IsDirectory = $true
84+
Contents = @(
85+
switch ($SystemName) {
86+
"Windows" {
87+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\win-$Architecture\Editor"}
88+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\win-$Architecture\publish\Editor"}
89+
}
90+
"Darwin" {
91+
switch ($Architecture) {
92+
"x64" {
93+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\osx-$Architecture\Editor"}
94+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\osx-$Architecture\publish\Editor"}
95+
}
96+
"arm64" {
97+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\osx-$Architecture\Editor"}
98+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\osx-$Architecture\publish\Editor"}
99+
}
100+
Default {
101+
throw 'This architecture is not supported'
102+
}
103+
}
104+
}
105+
"Linux" {
106+
@{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
107+
@{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
108+
}
109+
Default {
110+
throw 'This system is not supported'
111+
}
112+
}
113+
)
114+
}
115+
)
116+
117+
foreach ($item in $ContentsToProcess) {
118+
foreach($content in $item.Contents) {
119+
120+
if($item.IsDirectory -eq $true) {
121+
122+
# Delete if directories or files already exist
123+
#
124+
if(Test-Path $content.To) {
125+
Remove-Item $content.To -Recurse -Force
126+
}
127+
Copy-Item -Path $content.From -Destination $content.To -Recurse -Force
128+
}
129+
else {
130+
Copy-Item -Path $content.From -Destination $content.To -Force
131+
}
132+
133+
[string]$name = $item.Name
134+
[string]$ToDirectory = $content.To
135+
Write-Host "Copied $name --> $ToDirectory"
136+
}
137+
}

ZEngine/ZEngine/Maths/Math.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <Maths/Math.h>
2-
32
#include <glm/gtx/matrix_decompose.hpp>
43

54
namespace glm

dependencies.cmake

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ FetchContent_Declare(
55
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
66
GIT_SHALLOW TRUE
77
GIT_TAG main
8+
FIND_PACKAGE_ARGS CONFIG
89
)
910

1011
FetchContent_Declare(
@@ -28,48 +29,52 @@ FetchContent_Declare(
2829
GIT_REPOSITORY https://github.com/nothings/stb.git
2930
GIT_SHALLOW TRUE
3031
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/stb
32+
FIND_PACKAGE_ARGS CONFIG
3133
)
3234

3335
FetchContent_Declare(
3436
glfw3
3537
GIT_REPOSITORY https://github.com/glfw/glfw.git
3638
GIT_SHALLOW TRUE
3739
GIT_TAG 3.3.10
40+
FIND_PACKAGE_ARGS CONFIG
3841
)
3942

4043
FetchContent_Declare(
4144
spdlog
4245
GIT_REPOSITORY https://github.com/gabime/spdlog.git
4346
GIT_SHALLOW TRUE
44-
GIT_TAG v1.15.3
47+
GIT_TAG v1.15.3
48+
FIND_PACKAGE_ARGS CONFIG
4549
)
4650

4751
FetchContent_Declare(
4852
EnTT
4953
GIT_REPOSITORY https://github.com/skypjack/entt.git
5054
GIT_SHALLOW TRUE
5155
GIT_TAG v3.16.0
56+
FIND_PACKAGE_ARGS CONFIG
5257
)
5358

5459
FetchContent_Declare(
5560
assimp
5661
GIT_REPOSITORY https://github.com/assimp/assimp.git
5762
GIT_SHALLOW TRUE
58-
63+
FIND_PACKAGE_ARGS CONFIG
5964
)
6065

6166
FetchContent_Declare(
6267
stduuid
6368
GIT_REPOSITORY https://github.com/mariusbancila/stduuid.git
6469
GIT_SHALLOW TRUE
65-
70+
FIND_PACKAGE_ARGS CONFIG
6671
)
6772

6873
FetchContent_Declare(
6974
yaml-cpp
7075
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp
7176
GIT_SHALLOW TRUE
72-
77+
FIND_PACKAGE_ARGS CONFIG
7378
)
7479

7580

@@ -78,20 +83,23 @@ FetchContent_Declare(
7883
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Cross.git
7984
GIT_TAG vulkan-sdk-1.3.296.0
8085
GIT_SHALLOW TRUE
86+
FIND_PACKAGE_ARGS CONFIG
8187
)
8288

8389
FetchContent_Declare(
8490
VulkanMemoryAllocator
8591
GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
8692
GIT_SHALLOW TRUE
8793
GIT_TAG v3.3.0
94+
FIND_PACKAGE_ARGS CONFIG
8895
)
8996

9097
FetchContent_Declare(
9198
SPIRV-Headers
9299
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Headers.git
93100
GIT_SHALLOW TRUE
94101
GIT_TAG vulkan-sdk-1.3.296.0
102+
FIND_PACKAGE_ARGS CONFIG
95103
)
96104

97105
FetchContent_Declare(
@@ -100,14 +108,15 @@ FetchContent_Declare(
100108
GIT_SHALLOW TRUE
101109
GIT_TAG 14.3.0
102110
SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/glslang"
103-
111+
FIND_PACKAGE_ARGS CONFIG
104112
)
105113

106114
FetchContent_Declare(
107115
SPIRV-Tools
108116
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Tools.git
109117
GIT_SHALLOW TRUE
110118
GIT_TAG vulkan-sdk-1.3.296.0
119+
FIND_PACKAGE_ARGS CONFIG
111120
)
112121

113122

@@ -116,21 +125,22 @@ Fetchcontent_Declare(
116125
GIT_REPOSITORY https://github.com/google/googletest.git
117126
GIT_SHALLOW TRUE
118127
GIT_TAG main
128+
FIND_PACKAGE_ARGS CONFIG
119129
)
120130

121131
Fetchcontent_Declare(
122132
nlohmann_json
123133
GIT_REPOSITORY https://github.com/nlohmann/json.git
124134
GIT_SHALLOW TRUE
125-
135+
FIND_PACKAGE_ARGS CONFIG
126136
)
127137

128138
Fetchcontent_Declare(
129139
tlsf
130140
GIT_REPOSITORY https://github.com/mattconte/tlsf
131141
GIT_SHALLOW TRUE
132142
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/tlsf
133-
143+
FIND_PACKAGE_ARGS CONFIG
134144
)
135145

136146
Fetchcontent_Declare(
@@ -139,7 +149,7 @@ Fetchcontent_Declare(
139149
GIT_SHALLOW TRUE
140150
GIT_TAG main
141151
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/CLI11
142-
152+
FIND_PACKAGE_ARGS CONFIG
143153
)
144154

145155

@@ -148,22 +158,23 @@ Fetchcontent_Declare(
148158
GIT_REPOSITORY https://github.com/Nicoshev/rapidhash
149159
GIT_SHALLOW TRUE
150160
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/rapidhash
151-
161+
FIND_PACKAGE_ARGS CONFIG
152162
)
153163

154164
FetchContent_Declare(Vulkan-Headers
155165
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers
156166
GIT_SHALLOW TRUE
157167
GIT_TAG vulkan-sdk-1.3.296.0
168+
FIND_PACKAGE_ARGS CONFIG
158169
)
159170

160171
FetchContent_Declare(Vulkan-Loader
161172
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Loader
162173
GIT_SHALLOW TRUE
163174
GIT_TAG vulkan-sdk-1.3.296.0
175+
FIND_PACKAGE_ARGS CONFIG
164176
)
165177

166-
167178
FetchContent_MakeAvailable(
168179
fmt
169180
Vulkan-Headers
@@ -264,15 +275,13 @@ target_link_libraries(External_libs
264275
nlohmann_json::nlohmann_json
265276
)
266277

267-
268278
add_library(imported::ZEngine_External_Dependencies ALIAS External_libs)
269279

270280
add_library(External_obeliskLibs INTERFACE)
271281
target_link_libraries(External_obeliskLibs
272282
INTERFACE
273283
CLI11::CLI11
274284
)
275-
276285
add_library(imported::External_obeliskLibs ALIAS External_obeliskLibs)
277286

278287
include(${CMAKE_CURRENT_SOURCE_DIR}/Scripts/CMake/NuGet.cmake)

0 commit comments

Comments
 (0)