Skip to content

Commit 705cda6

Browse files
authored
Merge branch 'main' into ecosystem
2 parents 4b4c133 + 17528f7 commit 705cda6

File tree

6 files changed

+416
-1
lines changed

6 files changed

+416
-1
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2024 Sascha Willems
2+
# SPDX-License-Identifier: CC-BY-4.0
3+
# This Antora playbook is used by the CI to make sure the Antora build works
4+
name: "Build Antora documentation"
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
types: [ opened, synchronize, reopened ]
9+
push:
10+
branches: [ main ]
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
13+
cancel-in-progress: true
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: "recursive"
21+
- name: "Get Antora UI bundle"
22+
uses: actions/checkout@v4
23+
with:
24+
repository: KhronosGroup/antora-ui-khronos
25+
path: ./antora-ui-khronos
26+
ref: main
27+
- name: "Install npm"
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 'latest'
31+
cache: 'npm'
32+
cache-dependency-path: './antora-ui-khronos/package-lock.json'
33+
- name: "Install dependencies"
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y asciidoctor
37+
- name: "Build UI bundle"
38+
working-directory: ./antora-ui-khronos
39+
run: |
40+
npx update-browserslist-db@latest
41+
./node_modules/gulp/bin/gulp.js --version
42+
./node_modules/gulp/bin/gulp.js bundle
43+
- name: "Copy UI bundle"
44+
run: cp ./antora-ui-khronos/build/ui-bundle.zip ./
45+
- name: "Build tutorial"
46+
run: |
47+
cd antora
48+
make
49+
- name: "Build Antora documentation"
50+
working-directory: ./
51+
run: npx antora antora-ci-playbook.yml --stacktrace

.github/workflows/workflow.yml

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
name: CMake CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, windows-latest]
15+
include:
16+
- os: ubuntu-latest
17+
vulkan-install: |
18+
# Download and install Vulkan SDK using the tar.gz method
19+
VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/linux.txt)
20+
echo "Using Vulkan SDK version: $VULKAN_VERSION"
21+
22+
# Create a temporary directory for the SDK
23+
mkdir -p vulkan-sdk
24+
cd vulkan-sdk
25+
26+
# Download the SDK
27+
curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz"
28+
29+
# Extract the SDK - use tar with J flag for xz compression
30+
tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz
31+
32+
# Set up environment variables
33+
echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV
34+
echo "PATH=$PWD/$VULKAN_VERSION/x86_64/bin:$PATH" >> $GITHUB_ENV
35+
echo "LD_LIBRARY_PATH=$PWD/$VULKAN_VERSION/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
36+
echo "VK_LAYER_PATH=$PWD/$VULKAN_VERSION/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV
37+
38+
# Return to the original directory
39+
cd ..
40+
deps-install: |
41+
# GitHub runners already have cmake, ninja-build, and clang installed
42+
sudo apt-get update
43+
sudo apt-get install -y \
44+
libglfw3-dev \
45+
libglm-dev \
46+
libtinyobjloader-dev \
47+
libstb-dev
48+
test-cmd: |
49+
# Check if some of the expected executables were built
50+
if [ -f "00_base_code/00_base_code" ]; then
51+
echo "00_base_code built successfully"
52+
else
53+
echo "00_base_code build failed"
54+
exit 1
55+
fi
56+
57+
if [ -f "15_hello_triangle/15_hello_triangle" ]; then
58+
echo "15_hello_triangle built successfully"
59+
else
60+
echo "15_hello_triangle build failed"
61+
exit 1
62+
fi
63+
64+
if [ -f "31_compute_shader/31_compute_shader" ]; then
65+
echo "31_compute_shader built successfully"
66+
else
67+
echo "31_compute_shader build failed"
68+
exit 1
69+
fi
70+
- os: windows-latest
71+
vulkan-install: |
72+
# Download the Vulkan SDK installer
73+
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe"
74+
75+
# Run the installer with silent options
76+
Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow
77+
78+
# Find the actual installed SDK version
79+
$vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
80+
81+
if (-not $vulkanPath) {
82+
$vulkanPath = "C:\VulkanSDK\latest"
83+
}
84+
85+
# Set environment variables with correct Windows-style paths
86+
echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
87+
echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
88+
echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
89+
echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
90+
echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
91+
92+
# Display debug information
93+
Write-Host "Vulkan SDK path: $vulkanPath"
94+
if (Test-Path "$vulkanPath\Lib") {
95+
Write-Host "Lib directory exists"
96+
} else {
97+
Write-Host "Lib directory does not exist"
98+
}
99+
if (Test-Path "$vulkanPath\Include") {
100+
Write-Host "Include directory exists"
101+
} else {
102+
Write-Host "Include directory does not exist"
103+
}
104+
deps-install: |
105+
vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows
106+
echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
107+
test-cmd: |
108+
# Check if some of the expected executables were built
109+
if (Test-Path "00_base_code/Release/00_base_code.exe") {
110+
echo "00_base_code built successfully"
111+
} else {
112+
echo "00_base_code build failed"
113+
exit 1
114+
}
115+
116+
if (Test-Path "15_hello_triangle/Release/15_hello_triangle.exe") {
117+
echo "15_hello_triangle built successfully"
118+
} else {
119+
echo "15_hello_triangle build failed"
120+
exit 1
121+
}
122+
123+
if (Test-Path "31_compute_shader/Release/31_compute_shader.exe") {
124+
echo "31_compute_shader built successfully"
125+
} else {
126+
echo "31_compute_shader build failed"
127+
exit 1
128+
}
129+
130+
runs-on: ${{ matrix.os }}
131+
132+
steps:
133+
- uses: actions/checkout@v3
134+
135+
# Cache vcpkg packages for Windows
136+
- name: Cache vcpkg packages (Windows)
137+
if: runner.os == 'Windows'
138+
uses: actions/cache@v3
139+
with:
140+
path: |
141+
${{ env.VCPKG_INSTALLATION_ROOT }}/installed
142+
${{ env.VCPKG_INSTALLATION_ROOT }}/packages
143+
${{ env.VCPKG_INSTALLATION_ROOT }}/buildtrees
144+
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}
145+
restore-keys: |
146+
${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-
147+
${{ runner.os }}-vcpkg-
148+
149+
# Cache Vulkan SDK for Windows
150+
- name: Cache Vulkan SDK (Windows)
151+
if: runner.os == 'Windows'
152+
uses: actions/cache@v3
153+
with:
154+
path: C:\VulkanSDK
155+
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}
156+
restore-keys: |
157+
${{ runner.os }}-vulkan-sdk-
158+
159+
# Cache apt packages for Ubuntu
160+
- name: Cache apt packages (Ubuntu)
161+
if: runner.os == 'Linux'
162+
uses: actions/cache@v3
163+
with:
164+
path: /var/cache/apt/archives
165+
key: ${{ runner.os }}-apt-${{ hashFiles('**/workflow.yml') }}
166+
restore-keys: |
167+
${{ runner.os }}-apt-
168+
169+
# Cache Vulkan SDK for Ubuntu
170+
- name: Cache Vulkan SDK (Ubuntu)
171+
if: runner.os == 'Linux'
172+
uses: actions/cache@v3
173+
with:
174+
path: |
175+
${{ github.workspace }}/vulkan-sdk
176+
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}
177+
restore-keys: |
178+
${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-
179+
${{ runner.os }}-vulkan-sdk-
180+
181+
- name: Install dependencies
182+
run: ${{ matrix.deps-install }}
183+
184+
- name: Install Vulkan SDK
185+
run: ${{ matrix.vulkan-install }}
186+
187+
- name: Verify Vulkan Installation (Windows)
188+
if: runner.os == 'Windows'
189+
run: |
190+
if (Test-Path $env:VULKAN_SDK) {
191+
echo "Vulkan SDK found at: $env:VULKAN_SDK"
192+
193+
# Check for critical directories and files
194+
$criticalPaths = @(
195+
"$env:VULKAN_SDK\Include",
196+
"$env:VULKAN_SDK\Lib",
197+
"$env:VULKAN_SDK\Bin",
198+
"$env:VULKAN_SDK\Include\vulkan\vulkan.h",
199+
"$env:VULKAN_SDK\Lib\vulkan-1.lib",
200+
"$env:VULKAN_SDK\Bin\glslangValidator.exe"
201+
)
202+
203+
$allPathsExist = $true
204+
foreach ($path in $criticalPaths) {
205+
if (Test-Path $path) {
206+
echo "✓ Found: $path"
207+
} else {
208+
echo "✗ Missing: $path"
209+
$allPathsExist = $false
210+
}
211+
}
212+
213+
if ($allPathsExist) {
214+
echo "Vulkan SDK installation verified successfully"
215+
} else {
216+
echo "Vulkan SDK installation is incomplete!"
217+
exit 1
218+
}
219+
} else {
220+
echo "Vulkan SDK not found!"
221+
exit 1
222+
}
223+
224+
# Cache CMake build directory for Windows
225+
- name: Cache build artifacts (Windows)
226+
if: runner.os == 'Windows'
227+
uses: actions/cache@v3
228+
with:
229+
path: ${{github.workspace}}/attachments/build
230+
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
231+
restore-keys: |
232+
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
233+
${{ runner.os }}-build-
234+
235+
- name: Configure CMake (Windows)
236+
working-directory: ${{github.workspace}}/attachments
237+
if: runner.os == 'Windows'
238+
run: |
239+
cmake -B build -DCMAKE_BUILD_TYPE=Release `
240+
-DVulkan_INCLUDE_DIR="$env:Vulkan_INCLUDE_DIR" `
241+
-DVulkan_LIBRARY="$env:Vulkan_LIBRARY" `
242+
-DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" `
243+
-DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE"
244+
245+
# Display CMake cache to debug Vulkan detection
246+
if (Test-Path "build/CMakeCache.txt") {
247+
Write-Host "CMake cache contents:"
248+
Get-Content "build/CMakeCache.txt" | Select-String -Pattern "Vulkan"
249+
}
250+
251+
# Verify Vulkan Installation for Ubuntu
252+
- name: Verify Vulkan Installation (Ubuntu)
253+
if: runner.os == 'Linux'
254+
run: |
255+
if [ -d "$VULKAN_SDK" ]; then
256+
echo "Vulkan SDK found at: $VULKAN_SDK"
257+
echo "Vulkan SDK installation verified"
258+
else
259+
echo "Vulkan SDK not found!"
260+
exit 1
261+
fi
262+
263+
# Cache CMake build directory for Ubuntu
264+
- name: Cache build artifacts (Ubuntu)
265+
if: runner.os == 'Linux'
266+
uses: actions/cache@v3
267+
with:
268+
path: ${{github.workspace}}/attachments/build
269+
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
270+
restore-keys: |
271+
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
272+
${{ runner.os }}-build-
273+
274+
- name: Configure CMake (Unix)
275+
working-directory: ${{github.workspace}}/attachments
276+
if: runner.os != 'Windows'
277+
run: |
278+
# Use Clang for better C++20 module support
279+
export CC=clang
280+
export CXX=clang++
281+
282+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
283+
-DCMAKE_CXX_SCAN_FOR_MODULES=ON \
284+
-DCMAKE_CXX_FLAGS="-std=c++20"
285+
286+
- name: Build
287+
working-directory: ${{github.workspace}}/attachments
288+
run: cmake --build build --config Release
289+
290+
- name: Test Build Output
291+
working-directory: ${{github.workspace}}/attachments/build
292+
run: ${{ matrix.test-cmd }}

README.adoc

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,53 @@ The Khronos Vulkan^®^ Tutorial is based on the "link:https://vulkan-tutorial.co
88

99
This repository hosts the contents of the link:https://docs.vulkan.org/tutorial/latest[Khronos Vulkan Tutorial]. The tutorial is part of the link:https://github.com/KhronosGroup/Vulkan-Site[Vulkan Documentation Project].
1010

11+
== Project Structure
12+
13+
The repository is organized into several important directories:
14+
15+
* `en/` - Contains the tutorial content in English, organized by chapters
16+
* `attachments/` - Contains code examples, shader files, and resources used in the tutorial
17+
* `images/` - Contains illustrations, diagrams, and screenshots used in the tutorial
18+
* `scripts/` - Contains utility scripts, including dependency installation scripts
19+
* `antora/` - Contains configuration files for the Antora documentation system
20+
21+
== Installation Dependencies
22+
23+
The project provides scripts to help you install the necessary dependencies:
24+
25+
=== Linux
26+
Run the following command to install dependencies on Linux:
27+
[source,bash]
28+
----
29+
./scripts/install_dependencies_linux.sh
30+
----
31+
32+
This script detects your package manager (apt, dnf, pacman) and installs the required dependencies, including:
33+
* Build essentials (gcc, cmake, ninja-build)
34+
* GLFW, GLM, tinyobjloader, stb
35+
* X Window System dependencies
36+
37+
It also provides instructions for installing the Vulkan SDK.
38+
39+
=== Windows
40+
Run the following command to install dependencies on Windows:
41+
[source,batch]
42+
----
43+
scripts\install_dependencies_windows.bat
44+
----
45+
46+
This script uses vcpkg to install the required dependencies, including:
47+
* GLFW, GLM, tinyobjloader, stb
48+
49+
You will also need to install the Vulkan SDK separately from https://vulkan.lunarg.com/.
50+
1151
== License
1252

1353
The contents of this repository are licensed as https://creativecommons.org/licenses/by-sa/4.0/[CC BY-SA 4.0], unless stated otherwise.
1454
By contributing to this repository, you agree to license your contributions to the public under that same license.
1555

16-
The code listings in the `code` directory are licensed as https://creativecommons.org/publicdomain/zero/1.0/[CC0 1.0 Universal].
56+
The code listings in the `attachments` directory are licensed as
57+
https://creativecommons.org/publicdomain/zero/1.0/[CC0 1.0 Universal].
1758
By contributing to that directory, you agree to license your contributions to the public under that same public domain-like license.
1859

1960
== Contributing

0 commit comments

Comments
 (0)