Skip to content

Commit ff41c61

Browse files
authored
Merge pull request #50 from CapsCollective/hotfix/fix-setup-scripts
Bumped MoltenVK and Vulkan versions and removed python dependency
2 parents 52ff85a + af75322 commit ff41c61

File tree

11 files changed

+61
-53
lines changed

11 files changed

+61
-53
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,25 @@ The following are dependencies for building and running the project:
4545

4646
- **All platforms**
4747
- [CMake](https://cmake.org/)
48-
- [Python](https://www.python.org/)
4948
- **macOS**
5049
- [GNU Make](https://www.gnu.org/software/make/)
51-
- [Clang Format](https://clang.llvm.org/docs/ClangFormat.html) (Linux & MacOS)
50+
- [Clang Format](https://clang.llvm.org/docs/ClangFormat.html)
51+
- [Xcode Command Line Tools](https://developer.apple.com/download/) (via `xcode-select --install`)
5252
- **Windows**
5353
- [MinGW32 Make](https://www.mingw-w64.org/)
5454
- [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/)
5555
- **Linux**
56-
- For linux environments the following packages are required for building the dependencies:
56+
- [Clang Format](https://clang.llvm.org/docs/ClangFormat.html)
57+
- The following packages are required for building the dependencies:
58+
- `git`
59+
- `build-essential`
5760
- `libx11-xcb-dev`
5861
- `libxkbcommon-dev`
5962
- `libwayland-dev`
6063
- `libxrandr-dev`
6164
- `libasound2-dev`
6265
- `mesa-common-dev`
6366
- `libx11-dev`
64-
- `libxrandr-dev`
6567
- `libxi-dev`
6668
- `xorg-dev`
6769
- `libgl1-mesa-dev`
@@ -70,12 +72,11 @@ The following are dependencies for building and running the project:
7072
These can be installed using `apt-get` or an equivalent package manager for your Linux distribution:
7173

7274
```console
73-
// Only required if not building with the Vulkan SDK
7475
$ sudo apt-get update
7576
$ sudo apt-get install git build-essential libx11-xcb-dev libxkbcommon-dev libwayland-dev libxrandr-dev
7677

7778
// Required for building GLFW
78-
$ sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
79+
$ sudo apt-get install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
7980
```
8081

8182
### Setup
@@ -94,9 +95,9 @@ $ sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi
9495

9596
3. This should install all required dependencies. Once completed a `.env` file will be generated with all required variables. If the build is completed with no issue then you can proceed to build the project.
9697

97-
#### Building With Validation Layers
98+
#### Setup With Validation Layers
9899

99-
If you want to build with validation layers then the setup scripts should be run by passing the `--include-validation-layers` flag:
100+
If you want to build with validation layers then the setup scripts should be run instead by passing the validation layers include flag:
100101

101102
```console
102103
// Linux & macOS
@@ -118,14 +119,14 @@ Assuming all dependencies have been satisfied, the project can be built using th
118119
$ make
119120

120121
// Linux and macOS (with validation layers)
121-
$ make CXXFLAGS="-DENABLE_VALIDATION_LAYERS=1"
122+
$ make CXXFLAGS="-DENABLE_VALIDATION_LAYERS"
122123
```
123124
```console
124125
// Windows
125126
> mingw32-make
126127

127128
// Windows (with validation layers)
128-
> mingw32-make CXXFLAGS="-DENABLE_VALIDATION_LAYERS=1"
129+
> mingw32-make CXXFLAGS="-DENABLE_VALIDATION_LAYERS"
129130
```
130131

131132
Once it completes, all targets should be built and ready to run from the newly generated `output` directory.
@@ -138,13 +139,13 @@ You can see examples of this in any of the application targets under `examples`.
138139

139140
#### Compile Options
140141

141-
| Option | Default Value | Description |
142-
| ------------------------------ | ---------------- | -------------------------------------------------------------------------------- |
143-
| **DEBUG** | `1` | When set to `1`, will compile in debug mode, and default **CC_LOG_LEVEL** to `2` |
144-
| **CC_LOG_LEVEL** | `2` | Sets the logging verbosity to `info` (`2`), `warning` (`1`), and `error` (`0`) |
145-
| **ENABLE_VALIDATION_LAYERS** | `0` | When set to `1`, will enable Vulkan validation layers for the executable |
146-
| **CXX** | `g++`/`clang++` | Sets the compiler to use during build steps (default differs per-platform) |
147-
| **CXXFLAGS** | N/A | Allows for the specification of compile directives, such as macro definitions |
142+
| Option | Default Value | Description |
143+
| ---------------------------- |------------------|----------------------------------------------------------------------------------|
144+
| **DEBUG** | `1` | When set to `1`, will compile in debug mode, and default **CC_LOG_LEVEL** to `2` |
145+
| **CC_LOG_LEVEL** | `2` | Sets the logging verbosity to `info` (`2`), `warning` (`1`), and `error` (`0`) |
146+
| **ENABLE_VALIDATION_LAYERS** | N/A | When set, will enable Vulkan validation layers for the executable |
147+
| **CXX** | `g++`/`clang++` | Sets the compiler to use during build steps (default differs per-platform) |
148+
| **CXXFLAGS** | N/A | Allows for the specification of compile directives, such as macro definitions |
148149

149150
## Project Structure
150151

@@ -153,6 +154,7 @@ You can see examples of this in any of the application targets under `examples`.
153154
├─[engine]
154155
│ ├─[core] <- the engine's core library
155156
│ ├─[render] <- the engine's renderer
157+
│ ├─[window] <- the engine's windowing and input library
156158
│ ├─[utils] <- the engine's utils library
157159
158160
├─[examples]

scripts/setup.ps1

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ param (
99
)
1010

1111
[string] $Root_Dir=(pwd)
12-
[string] $Vulkan_Version= "v1.3.211"
13-
[string] $Spirv_Version="v2022.4"
12+
[string] $Vulkan_Version= "v1.3.250"
13+
[string] $Spirv_Version="sdk-1.3.250.1"
14+
[string] $Glslang_Version="12.2.0"
15+
[string] $Robin_Hood_Hashing_Version="3.11.5"
1416
[string] $Generator="MinGW Makefiles"
15-
[string] $Vendor_Dir="$Root_Dir\vendor"
17+
[string] $Vendor_Dir="$Root_Dir/vendor".Replace('\','/')
1618

17-
[string] $Bin_Dir="$Root_Dir\bin"
18-
[string] $Build_Dir="examples\render\build"
19+
[string] $Bin_Dir="$Root_Dir/bin".Replace('\','/')
20+
[string] $Build_Dir="examples/render/build"
1921

20-
[string] $Vulkan_Vendor_Dir="$Vendor_Dir/vulkan"
21-
[string] $Vulkan_Lib_Dir="$Vulkan_Vendor_Dir/lib"
22-
[string] $Vulkan_Include_Dir="$Vulkan_Vendor_Dir/include/vulkan"
23-
[string] $Volk_Include_Dir="$Vulkan_Vendor_Dir/include/volk"
22+
[string] $Vulkan_Vendor_Dir="$Vendor_Dir/vulkan".Replace('\','/')
23+
[string] $Vulkan_Lib_Dir="$Vulkan_Vendor_Dir/lib".Replace('\','/')
24+
[string] $Vulkan_Include_Dir="$Vulkan_Vendor_Dir/include".Replace('\','/')
25+
[string] $Volk_Include_Dir="$Vulkan_Vendor_Dir/include/volk".Replace('\','/')
2426

2527
function Make-Dir {
2628
param ( [string] $Dir_Path )
@@ -137,6 +139,7 @@ function Setup-Glslang {
137139
Write-Output "Setting up glslang..."
138140
Write-Output "Cloning glslang..."
139141
Update-Submodule glslang
142+
Checkout-Tags "$Vendor_Dir/glslang" $Glslang_Version
140143

141144
Write-Output "Building glslang..."
142145
[string] $build_dir = "$Vendor_Dir/glslang/build"
@@ -181,7 +184,7 @@ function Setup-Vulkan-Headers {
181184

182185
Make-Dir $Vulkan_Include_Dir
183186

184-
Copy-Item -Path "$Vulkan_Vendor_Dir/Vulkan-Headers/include/vulkan/*" -Destination $Vulkan_Include_Dir -Include "*.h"
187+
Get-ChildItem "$Vulkan_Vendor_Dir/Vulkan-Headers/build/install/include" | Copy-Item -Destination $Vulkan_Include_Dir -Recurse
185188
}
186189

187190
function Setup-Vulkan-Loader {
@@ -211,6 +214,7 @@ function Setup-Robin-Hood-Hashing {
211214
Write-Output "Setting up Robin Hood Hashing..."
212215
Write-Output "Cloning Robin Hood Hashing..."
213216
Update-Submodule vulkan/robin-hood-hashing
217+
Checkout-Tags "$Vulkan_Vendor_Dir/robin-hood-hashing" $Robin_Hood_Hashing_Version
214218

215219
Write-Output "Building Robin Hood Hashing..."
216220
[string] $build_dir = "$Vulkan_Vendor_Dir/robin-hood-hashing/build"
@@ -231,7 +235,7 @@ function Setup-Spirv-Headers {
231235
Write-Output "Cloning SPIRV Headers..."
232236
Update-Submodule vulkan/SPIRV-Headers
233237

234-
Checkout-Tags "$Vulkan_Vendor_Dir/SPIRV-Headers" "sdk-1.3.231.1"
238+
Checkout-Tags "$Vulkan_Vendor_Dir/SPIRV-Headers" "$Spirv_Version"
235239

236240
Write-Output "Building SPIRV Headers..."
237241
[string] $build_dir = "$Vulkan_Vendor_Dir/SPIRV-Headers/build"
@@ -255,8 +259,9 @@ function Setup-Spirv-Tools {
255259

256260
Make-Dir $build_dir
257261

258-
python3 "$Vulkan_Vendor_Dir\SPIRV-Tools\utils\git-sync-deps"
259-
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$build_dir\install" -S"$Vulkan_Vendor_Dir\SPIRV-Tools" -B"$build_dir"
262+
cmake .. -DCMAKE_BUILD_TYPE=Release -DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF -DSPIRV-Headers_SOURCE_DIR="$Vulkan_Vendor_Dir/SPIRV-Headers" -DCMAKE_INSTALL_PREFIX="$build_dir\install" -S"$Vulkan_Vendor_Dir\SPIRV-Tools" -B"$build_dir"
263+
264+
cmake -DCMAKE_BUILD_TYPE=Release -DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF -DSPIRV-Headers_SOURCE_DIR="$Vulkan_Vendor_Dir/SPIRV-Headers" -DCMAKE_INSTALL_PREFIX="$build_dir\install" -S"$Vulkan_Vendor_Dir\SPIRV-Tools" -B"$build_dir"
260265
cmake --build $build_dir --parallel $env:NUMBER_OF_PROCESSORS --target install --config Release
261266
}
262267

@@ -272,25 +277,23 @@ function Setup-Validation-Layers {
272277

273278
Make-Dir $build_dir
274279

275-
cmake `
280+
cmake `
276281
-DVULKAN_HEADERS_INSTALL_DIR="$Vulkan_Vendor_Dir/Vulkan-Headers/build/install" `
277-
-DVULKAN_LOADER_INSTALL_DIR="$Vulkan_Vendor_Dir/Vulkan-Loader/build" `
278282
-DGLSLANG_INSTALL_DIR="$Vulkan_Vendor_Dir/glslang/build/install" `
279283
-DSPIRV_HEADERS_INSTALL_DIR="$Vulkan_Vendor_Dir/SPIRV-Headers/build/install" `
280284
-DSPIRV_TOOLS_INSTALL_DIR="$Vulkan_Vendor_Dir/SPIRV-Tools/build/install" `
281285
-DROBIN_HOOD_HASHING_INSTALL_DIR="$Vulkan_Vendor_Dir/robin-hood-hashing/build/install" `
282-
-DCMAKE_BUILD_TYPE=Release `
283286
-DCMAKE_INSTALL_PREFIX="$build_dir" `
284287
-DBUILD_TESTS=OFF `
285288
-S"$Vulkan_Vendor_Dir/Vulkan-ValidationLayers" `
286289
-B"$build_dir"
287290

288-
cmake --build "$build_dir" --config Release --target install -j"$env:NUMBER_OF_PROCESSORS"
291+
cmake --build $build_dir --parallel $env:NUMBER_OF_PROCESSORS --target install --config Release
289292

290293
Make-Dir "$Vulkan_Lib_Dir/explicit_layer.d"
291294

292-
Copy-Item -Path "$build_dir/layers/Release/*" -Destination "$Vulkan_Lib_Dir/explicit_layer.d" -Include "*.json" -Recurse
293-
Copy-Item -Path "$build_dir/layers/Release/*" -Destination "$Vulkan_Lib_Dir/explicit_layer.d" -Include "*.dll" -Recurse
295+
Copy-Item -Path "$build_dir/bin/*" -Destination "$Vulkan_Lib_Dir/explicit_layer.d" -Include "*.json" -Recurse
296+
Copy-Item -Path "$build_dir/bin/*" -Destination "$Vulkan_Lib_Dir/explicit_layer.d" -Include "*.dll" -Recurse
294297
}
295298

296299
Write-Output "Setting up dependencies..."

scripts/setup.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ else
2525
fi
2626

2727
# Set setup details
28-
VULKAN_VERSION="v1.3.231"
29-
SPIRV_VERSION="2022.4"
28+
VULKAN_VERSION="v1.3.250"
29+
SPIRV_VERSION="sdk-1.3.250.1"
30+
GLSLANG_VERSION="12.2.0"
31+
ROBIN_HOOD_HASHING_VERSION="3.11.5"
32+
MOLTENVK_VERSION="v1.2.4"
3033
GENERATOR="Unix Makefiles"
3134
VENDOR_DIR="${ROOT_DIR}/vendor"
3235

3336
# Vulkan dependency variables
3437
VULKAN_VENDOR_DIR="${VENDOR_DIR}/vulkan"
3538
VULKAN_LIB_DIR="${VULKAN_VENDOR_DIR}/lib"
36-
VULKAN_INCLUDE_DIR="${VULKAN_VENDOR_DIR}/include/vulkan"
39+
VULKAN_INCLUDE_DIR="${VULKAN_VENDOR_DIR}/include"
3740
VOLK_INCLUDE_DIR="${VULKAN_VENDOR_DIR}/include/volk"
3841

3942
update_submodules() {
@@ -72,6 +75,7 @@ setup_glslang() {
7275
echo "Setting up glslang..."
7376
echo "Cloning glslang..."
7477
update_submodules glslang
78+
checkout_tags "${VENDOR_DIR}"/glslang "$GLSLANG_VERSION"
7579

7680
echo "Building glslang..."
7781
mkdir -p "${VENDOR_DIR}"/glslang/build
@@ -113,7 +117,7 @@ setup_vulkan_headers() {
113117
cmake -DCMAKE_INSTALL_PREFIX="${BUILD_DIR}"/install -G "${GENERATOR}" -B"${BUILD_DIR}" -S"${VULKAN_VENDOR_DIR}"/Vulkan-Headers
114118
cmake --build "${BUILD_DIR}" --target install
115119
mkdir -p "${VULKAN_INCLUDE_DIR}"
116-
cp "${VULKAN_VENDOR_DIR}"/Vulkan-Headers/include/vulkan/**.h "${VULKAN_INCLUDE_DIR}"
120+
cp -r "${VULKAN_VENDOR_DIR}"/Vulkan-Headers/build/install/include/** "${VULKAN_INCLUDE_DIR}"
117121
}
118122

119123
setup_vulkan_loader() {
@@ -139,7 +143,7 @@ setup_moltenVk() {
139143
echo "Setting up MoltenVk..."
140144
echo "Cloning MoltenVk..."
141145
update_submodules vulkan/MoltenVK
142-
checkout_tags "${VULKAN_VENDOR_DIR}"/MoltenVK "v1.2.0"
146+
checkout_tags "${VULKAN_VENDOR_DIR}"/MoltenVK ${MOLTENVK_VERSION}
143147

144148
echo "Building MoltenVk..."
145149
(cd "${VULKAN_VENDOR_DIR}"/MoltenVK ; ./fetchDependencies --macos --v-headers-root "${VULKAN_VENDOR_DIR}"/Vulkan-Headers)
@@ -153,6 +157,7 @@ setup_robin_hood_hashing() {
153157
echo "Setting up Robin Hood Hashing..."
154158
echo "Cloning Robin Hood Hashing..."
155159
update_submodules vulkan/robin-hood-hashing
160+
checkout_tags "${VULKAN_VENDOR_DIR}"/robin-hood-hashing ${ROBIN_HOOD_HASHING_VERSION}
156161

157162
echo "Building Robin Hood Hashing..."
158163
local BUILD_DIR="${VULKAN_VENDOR_DIR}"/robin-hood-hashing/build
@@ -171,7 +176,7 @@ setup_spirv_headers() {
171176
echo "Cloning SPIRV Headers..."
172177
update_submodules vulkan/SPIRV-Headers
173178

174-
checkout_tags "${VULKAN_VENDOR_DIR}"/SPIRV-Headers "sdk-1.3.231.1"
179+
checkout_tags "${VULKAN_VENDOR_DIR}"/SPIRV-Headers "${SPIRV_VERSION}"
175180

176181
echo "Building SPIRV Headers..."
177182
local BUILD_DIR="${VULKAN_VENDOR_DIR}"/SPIRV-Headers/build
@@ -189,8 +194,7 @@ setup_spirv_tools() {
189194
echo "Building SPIRV Tools..."
190195
local BUILD_DIR="${VULKAN_VENDOR_DIR}"/SPIRV-Tools/build
191196
mkdir -p "${BUILD_DIR}"
192-
python3 "${VULKAN_VENDOR_DIR}"/SPIRV-Tools/utils/git-sync-deps
193-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${BUILD_DIR}"/install -S"${VULKAN_VENDOR_DIR}"/SPIRV-Tools -B"${BUILD_DIR}"
197+
cmake -DCMAKE_BUILD_TYPE=Release -DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF -DSPIRV-Headers_SOURCE_DIR="${VULKAN_VENDOR_DIR}/SPIRV-Headers" -DCMAKE_INSTALL_PREFIX="${BUILD_DIR}"/install -S"${VULKAN_VENDOR_DIR}"/SPIRV-Tools -B"${BUILD_DIR}"
194198
cmake --build "${BUILD_DIR}" --target install --config Release -j"${NUMBER_OF_PROCESSORS}"
195199
}
196200

@@ -205,7 +209,6 @@ setup_validation_layers() {
205209
mkdir -p "${BUILD_DIR}"
206210
cmake \
207211
-DVULKAN_HEADERS_INSTALL_DIR="${VULKAN_VENDOR_DIR}"/Vulkan-Headers/build/install \
208-
-DVULKAN_LOADER_INSTALL_DIR="${VULKAN_VENDOR_DIR}"/Vulkan-Loader/build \
209212
-DGLSLANG_INSTALL_DIR="${VENDOR_DIR}"/glslang/build/install \
210213
-DSPIRV_HEADERS_INSTALL_DIR="${VULKAN_VENDOR_DIR}"/SPIRV-Headers/build/install \
211214
-DSPIRV_TOOLS_INSTALL_DIR="${VULKAN_VENDOR_DIR}"/SPIRV-Tools/build/install \

vendor/glslang

Submodule glslang updated 1099 files

vendor/vulkan/MoltenVK

Submodule MoltenVK updated 202 files

vendor/vulkan/SPIRV-Tools

Submodule SPIRV-Tools updated 715 files

vendor/vulkan/Vulkan-Headers

Submodule Vulkan-Headers updated 70 files

vendor/vulkan/Vulkan-Loader

Submodule Vulkan-Loader updated 113 files

0 commit comments

Comments
 (0)