From ea02373c9458b551fc68fef69398db34422b818b Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 16:52:33 -0700 Subject: [PATCH 01/19] Add cross-platform GitHub Actions CI with Vulkan SDK and dependency setup Introduce a CI workflow to automate builds and tests for Ubuntu, Windows, and macOS. Includes Vulkan SDK installation and essential dependency configurations for each platform. --- .github/workflows/workflow.yml | 146 +++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 00000000..7b1a5fd1 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,146 @@ +name: CMake CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: ubuntu-latest + vulkan-install: | + wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - + sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list + sudo apt-get update + sudo apt-get install -y vulkan-sdk + deps-install: | + sudo apt-get update + sudo apt-get install -y \ + libglfw3-dev \ + libglm-dev \ + libtinyobjloader-dev \ + libstb-dev + test-cmd: | + # Check if some of the expected executables were built + if [ -f "00_base_code/00_base_code" ]; then + echo "00_base_code built successfully" + else + echo "00_base_code build failed" + exit 1 + fi + + if [ -f "15_hello_triangle/15_hello_triangle" ]; then + echo "15_hello_triangle built successfully" + else + echo "15_hello_triangle build failed" + exit 1 + fi + + if [ -f "31_compute_shader/31_compute_shader" ]; then + echo "31_compute_shader built successfully" + else + echo "31_compute_shader build failed" + exit 1 + fi + - os: windows-latest + vulkan-install: | + Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe" + Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait + echo "VULKAN_SDK=$env:VULKAN_SDK" >> $env:GITHUB_ENV + deps-install: | + vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows + echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV + test-cmd: | + # Check if some of the expected executables were built + if (Test-Path "00_base_code/Release/00_base_code.exe") { + echo "00_base_code built successfully" + } else { + echo "00_base_code build failed" + exit 1 + } + + if (Test-Path "15_hello_triangle/Release/15_hello_triangle.exe") { + echo "15_hello_triangle built successfully" + } else { + echo "15_hello_triangle build failed" + exit 1 + } + + if (Test-Path "31_compute_shader/Release/31_compute_shader.exe") { + echo "31_compute_shader built successfully" + } else { + echo "31_compute_shader build failed" + exit 1 + } + - os: macos-latest + vulkan-install: | + brew install molten-vk + curl -L -o vulkansdk.dmg "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg" + hdiutil attach vulkansdk.dmg + sudo /Volumes/vulkansdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install + hdiutil detach /Volumes/vulkansdk + deps-install: | + brew install glfw glm tinyobjloader stb + test-cmd: | + # Check if some of the expected executables were built + if [ -f "00_base_code/00_base_code" ]; then + echo "00_base_code built successfully" + else + echo "00_base_code build failed" + exit 1 + fi + + if [ -f "15_hello_triangle/15_hello_triangle" ]; then + echo "15_hello_triangle built successfully" + else + echo "15_hello_triangle build failed" + exit 1 + fi + + if [ -f "31_compute_shader/31_compute_shader" ]; then + echo "31_compute_shader built successfully" + else + echo "31_compute_shader build failed" + exit 1 + fi + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.vcpkg + ~/Library/Caches/Homebrew + ${{ env.VCPKG_INSTALLATION_ROOT }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }} + restore-keys: | + ${{ runner.os }}-deps- + + - name: Install dependencies + run: ${{ matrix.deps-install }} + + - name: Install Vulkan SDK + run: ${{ matrix.vulkan-install }} + + - name: Configure CMake + working-directory: ${{github.workspace}}/attachments + run: cmake -B build -DCMAKE_BUILD_TYPE=Release + + - name: Build + working-directory: ${{github.workspace}}/attachments + run: cmake --build build --config Release + + - name: Test Build Output + working-directory: ${{github.workspace}}/attachments/build + run: ${{ matrix.test-cmd }} From b7526610d956c0a6b41553f4c9ae0d493c9e4cc6 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 17:05:18 -0700 Subject: [PATCH 02/19] Switch Vulkan SDK installation to tarball method on Linux and refine dependency setups across platforms Replaced package-based Vulkan SDK installation on Linux with tar.gz method for better compatibility and control. Updated environment variable configurations on Windows. Refined macOS process by sourcing `tinyobjloader` from GitHub due to unavailability on brew. Added `libyaml-cpp0.7` to Linux dependencies. --- .github/workflows/workflow.yml | 37 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 7b1a5fd1..4bdb9831 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -15,17 +15,25 @@ jobs: include: - os: ubuntu-latest vulkan-install: | - wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - - sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list - sudo apt-get update - sudo apt-get install -y vulkan-sdk + # Download and install Vulkan SDK using the tar.gz method + VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/linux.txt) + curl -O https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz + tar xf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz + cd $VULKAN_VERSION + ./vulkansdk + # Set up environment variables + echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV + echo "PATH=$PWD/$VULKAN_VERSION/x86_64/bin:$PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$PWD/$VULKAN_VERSION/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "VK_LAYER_PATH=$PWD/$VULKAN_VERSION/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV deps-install: | sudo apt-get update sudo apt-get install -y \ - libglfw3-dev \ - libglm-dev \ - libtinyobjloader-dev \ - libstb-dev + libglfw3-dev \ + libglm-dev \ + libtinyobjloader-dev \ + libstb-dev \ + libyaml-cpp0.7 test-cmd: | # Check if some of the expected executables were built if [ -f "00_base_code/00_base_code" ]; then @@ -52,7 +60,10 @@ jobs: vulkan-install: | Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe" Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait - echo "VULKAN_SDK=$env:VULKAN_SDK" >> $env:GITHUB_ENV + # Add these environment variables + echo "VULKAN_SDK=C:\VulkanSDK\latest" >> $env:GITHUB_ENV + echo "VULKAN_INCLUDE_DIR=C:\VulkanSDK\latest\Include" >> $env:GITHUB_ENV + echo "VULKAN_LIBRARY=C:\VulkanSDK\latest\Lib\vulkan-1.lib" >> $env:GITHUB_ENV deps-install: | vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV @@ -86,7 +97,13 @@ jobs: sudo /Volumes/vulkansdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install hdiutil detach /Volumes/vulkansdk deps-install: | - brew install glfw glm tinyobjloader stb + brew install glfw glm stb + # Install tinyobjloader from source since it's not available in brew + git clone https://github.com/tinyobjloader/tinyobjloader.git + cd tinyobjloader + cmake -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release + sudo cmake --install build test-cmd: | # Check if some of the expected executables were built if [ -f "00_base_code/00_base_code" ]; then From 7ecee14aa6c513a262f68836b86665c54f97fbf4 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 17:18:10 -0700 Subject: [PATCH 03/19] Refine workflow to improve cross-platform dependency setup and Vulkan SDK configuration - Build `yaml-cpp` from source on Linux for greater control and flexibility. - Adjust Windows Vulkan SDK variables for consistency and add CMake configuration. - Enhance macOS dependency handling by installing `stb` and `tinyobjloader` from source. - Add Vulkan SDK installation verification on Windows. --- .github/workflows/workflow.yml | 57 +++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4bdb9831..c6850139 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -33,7 +33,13 @@ jobs: libglm-dev \ libtinyobjloader-dev \ libstb-dev \ - libyaml-cpp0.7 + cmake + # Build and install yaml-cpp from source + git clone https://github.com/jbeder/yaml-cpp.git + cd yaml-cpp + cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON + cmake --build build --config Release -j4 + sudo cmake --install build test-cmd: | # Check if some of the expected executables were built if [ -f "00_base_code/00_base_code" ]; then @@ -60,10 +66,15 @@ jobs: vulkan-install: | Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe" Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait - # Add these environment variables - echo "VULKAN_SDK=C:\VulkanSDK\latest" >> $env:GITHUB_ENV - echo "VULKAN_INCLUDE_DIR=C:\VulkanSDK\latest\Include" >> $env:GITHUB_ENV - echo "VULKAN_LIBRARY=C:\VulkanSDK\latest\Lib\vulkan-1.lib" >> $env:GITHUB_ENV + # Set environment variables with correct Windows-style paths + $vulkanPath = "C:\VulkanSDK\latest" + echo "VULKAN_SDK=$vulkanPath" >> $env:GITHUB_ENV + # Add Vulkan SDK to system PATH + echo "$vulkanPath\Bin" >> $env:GITHUB_PATH + # Set explicit CMake variables + echo "CMAKE_PREFIX_PATH=$vulkanPath" >> $env:GITHUB_ENV + echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" >> $env:GITHUB_ENV + echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" >> $env:GITHUB_ENV deps-install: | vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV @@ -97,13 +108,22 @@ jobs: sudo /Volumes/vulkansdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install hdiutil detach /Volumes/vulkansdk deps-install: | - brew install glfw glm stb - # Install tinyobjloader from source since it's not available in brew + # Install available packages through brew + brew install glfw glm + + # Install tinyobjloader from source git clone https://github.com/tinyobjloader/tinyobjloader.git cd tinyobjloader cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release sudo cmake --install build + cd .. + + # Install stb headers + git clone https://github.com/nothings/stb.git + sudo mkdir -p /usr/local/include/stb + sudo cp stb/*.h /usr/local/include/stb/ + test-cmd: | # Check if some of the expected executables were built if [ -f "00_base_code/00_base_code" ]; then @@ -150,6 +170,29 @@ jobs: - name: Install Vulkan SDK run: ${{ matrix.vulkan-install }} + - name: Verify Vulkan Installation (Windows) + if: runner.os == 'Windows' + run: | + if (Test-Path $env:VULKAN_SDK) { + echo "Vulkan SDK found at: $env:VULKAN_SDK" + echo "Contents of Lib directory:" + Get-ChildItem "$env:VULKAN_SDK\Lib" + echo "Contents of Include directory:" + Get-ChildItem "$env:VULKAN_SDK\Include" + } else { + echo "Vulkan SDK not found!" + exit 1 + } + + - name: Configure CMake + working-directory: ${{github.workspace}}/attachments + run: | + cmake -B build -DCMAKE_BUILD_TYPE=Release ` + -DVulkan_INCLUDE_DIR="$env:Vulkan_INCLUDE_DIR" ` + -DVulkan_LIBRARY="$env:Vulkan_LIBRARY" ` + -DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" + if: runner.os == 'Windows' + - name: Configure CMake working-directory: ${{github.workspace}}/attachments run: cmake -B build -DCMAKE_BUILD_TYPE=Release From c9f77715e80d85368ac7874bdbc6abd845426391 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 17:39:30 -0700 Subject: [PATCH 04/19] Refactor Vulkan SDK installation steps across platforms for better reliability and clarity --- .github/workflows/workflow.yml | 105 ++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index c6850139..680646fc 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -17,15 +17,26 @@ jobs: vulkan-install: | # Download and install Vulkan SDK using the tar.gz method VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/linux.txt) - curl -O https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz - tar xf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz - cd $VULKAN_VERSION - ./vulkansdk + echo "Using Vulkan SDK version: $VULKAN_VERSION" + + # Create a temporary directory for the SDK + mkdir -p vulkan-sdk + cd vulkan-sdk + + # Download the SDK + curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz" + + # Extract the SDK + tar xzf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz + # Set up environment variables echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV echo "PATH=$PWD/$VULKAN_VERSION/x86_64/bin:$PATH" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$PWD/$VULKAN_VERSION/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV echo "VK_LAYER_PATH=$PWD/$VULKAN_VERSION/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV + + # Return to the original directory + cd .. deps-install: | sudo apt-get update sudo apt-get install -y \ @@ -64,17 +75,42 @@ jobs: fi - os: windows-latest vulkan-install: | + # Download the Vulkan SDK installer Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe" - Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait + + # Run the installer with silent options + Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow + + # Find the actual installed SDK version + $vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName + + if (-not $vulkanPath) { + $vulkanPath = "C:\VulkanSDK\latest" + } + # Set environment variables with correct Windows-style paths - $vulkanPath = "C:\VulkanSDK\latest" - echo "VULKAN_SDK=$vulkanPath" >> $env:GITHUB_ENV + echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + # Add Vulkan SDK to system PATH - echo "$vulkanPath\Bin" >> $env:GITHUB_PATH + echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + # Set explicit CMake variables - echo "CMAKE_PREFIX_PATH=$vulkanPath" >> $env:GITHUB_ENV - echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" >> $env:GITHUB_ENV - echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" >> $env:GITHUB_ENV + echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + # Display debug information + Write-Host "Vulkan SDK path: $vulkanPath" + if (Test-Path "$vulkanPath\Lib") { + Write-Host "Lib directory exists" + } else { + Write-Host "Lib directory does not exist" + } + if (Test-Path "$vulkanPath\Include") { + Write-Host "Include directory exists" + } else { + Write-Host "Include directory does not exist" + } deps-install: | vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV @@ -102,15 +138,34 @@ jobs: } - os: macos-latest vulkan-install: | + # Install MoltenVK (Vulkan implementation for macOS) brew install molten-vk - curl -L -o vulkansdk.dmg "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg" - hdiutil attach vulkansdk.dmg - sudo /Volumes/vulkansdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install - hdiutil detach /Volumes/vulkansdk + + # Get the latest SDK version + VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/mac.txt) + echo "Using Vulkan SDK version: $VULKAN_VERSION" + + # Create a temporary directory for the SDK + mkdir -p vulkan-sdk + cd vulkan-sdk + + # Download and extract the SDK tarball instead of using DMG + curl -L -o vulkansdk.tar.gz "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/mac/vulkansdk-macos-$VULKAN_VERSION.tar.gz" + tar -xzf vulkansdk.tar.gz + + # Set environment variables + echo "VULKAN_SDK=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS" >> $GITHUB_ENV + echo "PATH=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/bin:$PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + echo "VK_LAYER_PATH=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/share/vulkan/explicit_layer.d" >> $GITHUB_ENV + echo "VK_ICD_FILENAMES=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/share/vulkan/icd.d/MoltenVK_icd.json" >> $GITHUB_ENV + + # Return to the original directory + cd .. deps-install: | # Install available packages through brew brew install glfw glm - + # Install tinyobjloader from source git clone https://github.com/tinyobjloader/tinyobjloader.git cd tinyobjloader @@ -118,7 +173,7 @@ jobs: cmake --build build --config Release sudo cmake --install build cd .. - + # Install stb headers git clone https://github.com/nothings/stb.git sudo mkdir -p /usr/local/include/stb @@ -184,17 +239,25 @@ jobs: exit 1 } - - name: Configure CMake + - name: Configure CMake (Windows) working-directory: ${{github.workspace}}/attachments + if: runner.os == 'Windows' run: | cmake -B build -DCMAKE_BUILD_TYPE=Release ` -DVulkan_INCLUDE_DIR="$env:Vulkan_INCLUDE_DIR" ` -DVulkan_LIBRARY="$env:Vulkan_LIBRARY" ` - -DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" - if: runner.os == 'Windows' + -DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" ` + -DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" + + # Display CMake cache to debug Vulkan detection + if (Test-Path "build/CMakeCache.txt") { + Write-Host "CMake cache contents:" + Get-Content "build/CMakeCache.txt" | Select-String -Pattern "Vulkan" + } - - name: Configure CMake + - name: Configure CMake (Unix) working-directory: ${{github.workspace}}/attachments + if: runner.os != 'Windows' run: cmake -B build -DCMAKE_BUILD_TYPE=Release - name: Build From 638a945a8890e9ee6ba8cd04b62eff24587a4ced Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 17:53:19 -0700 Subject: [PATCH 05/19] Switch Vulkan SDK archive format to `.tar.xz` for improved compatibility and update extraction steps accordingly --- .github/workflows/workflow.yml | 17 ++++++++++------- attachments/00_base_code.cpp | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 680646fc..277db514 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -23,11 +23,11 @@ jobs: mkdir -p vulkan-sdk cd vulkan-sdk - # Download the SDK - curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz" + # Download the SDK - try .tar.xz format instead of .tar.gz + curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz" - # Extract the SDK - tar xzf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz + # Extract the SDK - use tar with J flag for xz compression + tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz # Set up environment variables echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV @@ -149,9 +149,12 @@ jobs: mkdir -p vulkan-sdk cd vulkan-sdk - # Download and extract the SDK tarball instead of using DMG - curl -L -o vulkansdk.tar.gz "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/mac/vulkansdk-macos-$VULKAN_VERSION.tar.gz" - tar -xzf vulkansdk.tar.gz + # Download the SDK + # Use the direct URL format with explicit version + curl -L -o vulkansdk.tar.xz "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/mac/vulkansdk-macos-$VULKAN_VERSION.tar.xz" + + # Extract the SDK - use tar with J flag for xz compression + tar -xJf vulkansdk.tar.xz # Set environment variables echo "VULKAN_SDK=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS" >> $GITHUB_ENV diff --git a/attachments/00_base_code.cpp b/attachments/00_base_code.cpp index 668ac686..62e62cad 100644 --- a/attachments/00_base_code.cpp +++ b/attachments/00_base_code.cpp @@ -1,3 +1,4 @@ +#include import vulkan_hpp; #include From 46c77c2cccae600242762bda102f80e5f03cefb4 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 18:02:12 -0700 Subject: [PATCH 06/19] Add Ninja build system support and switch Vulkan SDK archive to `.tar.gz` - Integrate `ninja-build` as a required dependency for Unix builds. - Update Vulkan SDK download to use `.tar.gz` format for macOS and adjust extraction steps accordingly. - Modify CMake configuration to use Ninja generator for Unix platforms. --- .github/workflows/workflow.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 277db514..464544d7 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -44,7 +44,8 @@ jobs: libglm-dev \ libtinyobjloader-dev \ libstb-dev \ - cmake + cmake \ + ninja-build # Build and install yaml-cpp from source git clone https://github.com/jbeder/yaml-cpp.git cd yaml-cpp @@ -151,10 +152,10 @@ jobs: # Download the SDK # Use the direct URL format with explicit version - curl -L -o vulkansdk.tar.xz "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/mac/vulkansdk-macos-$VULKAN_VERSION.tar.xz" + curl -L -o vulkansdk.tar.gz "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/mac/vulkansdk-macos-$VULKAN_VERSION.tar.gz" - # Extract the SDK - use tar with J flag for xz compression - tar -xJf vulkansdk.tar.xz + # Extract the SDK - use tar with z flag for gzip compression + tar -xzf vulkansdk.tar.gz # Set environment variables echo "VULKAN_SDK=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS" >> $GITHUB_ENV @@ -167,7 +168,7 @@ jobs: cd .. deps-install: | # Install available packages through brew - brew install glfw glm + brew install glfw glm ninja # Install tinyobjloader from source git clone https://github.com/tinyobjloader/tinyobjloader.git @@ -261,7 +262,7 @@ jobs: - name: Configure CMake (Unix) working-directory: ${{github.workspace}}/attachments if: runner.os != 'Windows' - run: cmake -B build -DCMAKE_BUILD_TYPE=Release + run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{github.workspace}}/attachments From 6200293cda142fc879fdbc4f3d291329f0a47360 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 18:08:33 -0700 Subject: [PATCH 07/19] Remove macOS build from CI workflow and enable C++ module scanning in CMake - Drop macOS-specific steps from the GitHub Actions workflow to streamline CI processes. - Enable `CMAKE_CXX_SCAN_FOR_MODULES` in CMake configuration for improved support of C++ module dependencies. --- .github/workflows/workflow.yml | 71 +--------------------------------- attachments/CMakeLists.txt | 3 ++ 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 464544d7..bf3e8b63 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest] include: - os: ubuntu-latest vulkan-install: | @@ -137,74 +137,6 @@ jobs: echo "31_compute_shader build failed" exit 1 } - - os: macos-latest - vulkan-install: | - # Install MoltenVK (Vulkan implementation for macOS) - brew install molten-vk - - # Get the latest SDK version - VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/mac.txt) - echo "Using Vulkan SDK version: $VULKAN_VERSION" - - # Create a temporary directory for the SDK - mkdir -p vulkan-sdk - cd vulkan-sdk - - # Download the SDK - # Use the direct URL format with explicit version - curl -L -o vulkansdk.tar.gz "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/mac/vulkansdk-macos-$VULKAN_VERSION.tar.gz" - - # Extract the SDK - use tar with z flag for gzip compression - tar -xzf vulkansdk.tar.gz - - # Set environment variables - echo "VULKAN_SDK=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS" >> $GITHUB_ENV - echo "PATH=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/bin:$PATH" >> $GITHUB_ENV - echo "DYLD_LIBRARY_PATH=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV - echo "VK_LAYER_PATH=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/share/vulkan/explicit_layer.d" >> $GITHUB_ENV - echo "VK_ICD_FILENAMES=$PWD/vulkansdk-macos-$VULKAN_VERSION/macOS/share/vulkan/icd.d/MoltenVK_icd.json" >> $GITHUB_ENV - - # Return to the original directory - cd .. - deps-install: | - # Install available packages through brew - brew install glfw glm ninja - - # Install tinyobjloader from source - git clone https://github.com/tinyobjloader/tinyobjloader.git - cd tinyobjloader - cmake -B build -DCMAKE_BUILD_TYPE=Release - cmake --build build --config Release - sudo cmake --install build - cd .. - - # Install stb headers - git clone https://github.com/nothings/stb.git - sudo mkdir -p /usr/local/include/stb - sudo cp stb/*.h /usr/local/include/stb/ - - test-cmd: | - # Check if some of the expected executables were built - if [ -f "00_base_code/00_base_code" ]; then - echo "00_base_code built successfully" - else - echo "00_base_code build failed" - exit 1 - fi - - if [ -f "15_hello_triangle/15_hello_triangle" ]; then - echo "15_hello_triangle built successfully" - else - echo "15_hello_triangle build failed" - exit 1 - fi - - if [ -f "31_compute_shader/31_compute_shader" ]; then - echo "31_compute_shader built successfully" - else - echo "31_compute_shader build failed" - exit 1 - fi runs-on: ${{ matrix.os }} @@ -217,7 +149,6 @@ jobs: path: | ~/.cache/pip ~/.vcpkg - ~/Library/Caches/Homebrew ${{ env.VCPKG_INSTALLATION_ROOT }} key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }} restore-keys: | diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt index efe2ea58..8fa2dfea 100644 --- a/attachments/CMakeLists.txt +++ b/attachments/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required (VERSION 3.29) +# Enable C++ module dependency scanning +set(CMAKE_CXX_SCAN_FOR_MODULES ON) + project (VulkanTutorial) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") From 4c35e20b9e715680a7525c4feb8c905dde41b37e Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 18:20:25 -0700 Subject: [PATCH 08/19] Enable per-target C++ module scanning in CMake configuration - Moved `CXX_SCAN_FOR_MODULES` property to individual targets (`VulkanCppModule` and chapter names) for improved modularity and control. --- attachments/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt index 8fa2dfea..0faee4e8 100644 --- a/attachments/CMakeLists.txt +++ b/attachments/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required (VERSION 3.29) -# Enable C++ module dependency scanning -set(CMAKE_CXX_SCAN_FOR_MODULES ON) - project (VulkanTutorial) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") @@ -28,6 +25,7 @@ target_link_libraries(VulkanCppModule ) set_target_properties(VulkanCppModule PROPERTIES CXX_STANDARD 20) +set_target_properties(VulkanCppModule PROPERTIES CXX_SCAN_FOR_MODULES ON) target_sources(VulkanCppModule PUBLIC @@ -103,6 +101,7 @@ function (add_chapter CHAPTER_NAME) set_target_properties (${CHAPTER_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CHAPTER_NAME}) set_target_properties (${CHAPTER_NAME} PROPERTIES CXX_STANDARD 20) + set_target_properties (${CHAPTER_NAME} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_link_libraries (${CHAPTER_NAME} Vulkan::cppm glfw) target_include_directories (${CHAPTER_NAME} PRIVATE ${STB_INCLUDEDIR}) From f2351986cb0c4114be3ee4e1612687badc8123ee Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Jul 2025 18:51:52 -0700 Subject: [PATCH 09/19] Add Clang support and enhance C++20 module configuration in workflow and CMake setup - Introduced `clang` installation in CI workflow for improved C++20 module support. - Updated CMake workflow to use Clang as the default compiler and enabled C++ module dependency scanning globally. - Refined target configurations by adding explicit module source files and consolidating module scanning settings. --- .github/workflows/workflow.yml | 12 ++++++++++-- attachments/CMakeLists.txt | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index bf3e8b63..5f782f6f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -45,7 +45,8 @@ jobs: libtinyobjloader-dev \ libstb-dev \ cmake \ - ninja-build + ninja-build \ + clang # Build and install yaml-cpp from source git clone https://github.com/jbeder/yaml-cpp.git cd yaml-cpp @@ -193,7 +194,14 @@ jobs: - name: Configure CMake (Unix) working-directory: ${{github.workspace}}/attachments if: runner.os != 'Windows' - run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release + run: | + # Use Clang for better C++20 module support + export CC=clang + export CXX=clang++ + + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ + -DCMAKE_CXX_FLAGS="-std=c++20" - name: Build working-directory: ${{github.workspace}}/attachments diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt index 0faee4e8..fd0bd453 100644 --- a/attachments/CMakeLists.txt +++ b/attachments/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required (VERSION 3.29) +# Enable C++ module dependency scanning +set(CMAKE_CXX_SCAN_FOR_MODULES ON) + project (VulkanTutorial) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") @@ -25,7 +28,6 @@ target_link_libraries(VulkanCppModule ) set_target_properties(VulkanCppModule PROPERTIES CXX_STANDARD 20) -set_target_properties(VulkanCppModule PROPERTIES CXX_SCAN_FOR_MODULES ON) target_sources(VulkanCppModule PUBLIC @@ -36,6 +38,12 @@ target_sources(VulkanCppModule "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm" ) +# Add the vulkan.cppm file directly as a source file +target_sources(VulkanCppModule + PRIVATE + "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm" +) + find_package (tinyobjloader REQUIRED) find_package (PkgConfig) @@ -101,7 +109,6 @@ function (add_chapter CHAPTER_NAME) set_target_properties (${CHAPTER_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CHAPTER_NAME}) set_target_properties (${CHAPTER_NAME} PROPERTIES CXX_STANDARD 20) - set_target_properties (${CHAPTER_NAME} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_link_libraries (${CHAPTER_NAME} Vulkan::cppm glfw) target_include_directories (${CHAPTER_NAME} PRIVATE ${STB_INCLUDEDIR}) From 7105e003f1ce34ad091bed1b0ba262e267a53c0d Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 07:53:37 -0700 Subject: [PATCH 10/19] Refine dependency caching in CI workflow for improved cross-platform support - Added OS-specific `Cache dependencies` steps for Windows and Ubuntu. - Adjusted cache paths to align with platform-specific build environments. --- .github/workflows/workflow.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5f782f6f..cb1351ba 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -144,17 +144,27 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Cache dependencies + - name: Cache dependencies (Windows) + if: runner.os == 'Windows' uses: actions/cache@v3 with: path: | - ~/.cache/pip - ~/.vcpkg ${{ env.VCPKG_INSTALLATION_ROOT }} key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }} restore-keys: | ${{ runner.os }}-deps- + - name: Cache dependencies (Ubuntu) + if: runner.os == 'Linux' + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/yaml-cpp/build + ${{ github.workspace }}/vulkan-sdk + key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }} + restore-keys: | + ${{ runner.os }}-deps- + - name: Install dependencies run: ${{ matrix.deps-install }} From 5e7b4f45c859a55509447d35f8639adce16d9d17 Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 08:08:45 -0700 Subject: [PATCH 11/19] Update shader compilation command to use absolute output path - Adjust `add_custom_command` in CMake to specify an absolute output path for `slang.spv`. --- attachments/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt index fd0bd453..d5388229 100644 --- a/attachments/CMakeLists.txt +++ b/attachments/CMakeLists.txt @@ -94,8 +94,7 @@ function (add_slang_shader_target TARGET) ) add_custom_command ( OUTPUT ${SHADERS_DIR}/slang.spv - COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o slang.spv - WORKING_DIRECTORY ${SHADERS_DIR} + COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o ${CMAKE_CURRENT_LIST_DIR}/${SHADERS_DIR}/slang.spv DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES} COMMENT "Compiling Slang Shaders" VERBATIM From 422555b486b75739970fbd3f4e3c3953a9d97974 Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 08:28:02 -0700 Subject: [PATCH 12/19] Refactor shader compilation functions to use absolute output paths and improve handling of individual shader sources in CMake --- attachments/CMakeLists.txt | 52 +++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt index d5388229..6b0ed677 100644 --- a/attachments/CMakeLists.txt +++ b/attachments/CMakeLists.txt @@ -64,42 +64,60 @@ find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin REQUIRED) function (add_shaders_target TARGET) cmake_parse_arguments ("SHADER" "" "CHAPTER_NAME" "SOURCES" ${ARGN}) set (SHADERS_DIR ${SHADER_CHAPTER_NAME}/shaders) + set (SHADERS_FULL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}) add_custom_command ( - OUTPUT ${SHADERS_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_DIR} + OUTPUT ${SHADERS_FULL_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_FULL_DIR} ) - add_custom_command ( - OUTPUT ${SHADERS_DIR}/frag.spv ${SHADERS_DIR}/vert.spv - COMMAND glslang::validator - ARGS --target-env vulkan1.0 ${SHADER_SOURCES} --quiet - WORKING_DIRECTORY ${SHADERS_DIR} - DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES} - COMMENT "Compiling Shaders" - VERBATIM + # Create a list to store the output files + set(SHADER_OUTPUTS "") + + # Create separate commands for each shader file to ensure they are compiled to the correct location + foreach(SHADER_SOURCE ${SHADER_SOURCES}) + get_filename_component(SHADER_NAME ${SHADER_SOURCE} NAME_WE) + get_filename_component(SHADER_EXT ${SHADER_SOURCE} EXT) + string(REPLACE "." "" SHADER_EXT ${SHADER_EXT}) + + # Add the output file to the list + list(APPEND SHADER_OUTPUTS ${SHADERS_FULL_DIR}/${SHADER_EXT}.spv) + + add_custom_command( + OUTPUT ${SHADERS_FULL_DIR}/${SHADER_EXT}.spv + COMMAND glslang::validator + ARGS --target-env vulkan1.0 ${SHADER_SOURCE} --quiet -o ${SHADERS_FULL_DIR}/${SHADER_EXT}.spv + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${SHADERS_FULL_DIR} ${SHADER_SOURCE} + COMMENT "Compiling ${SHADER_EXT} Shader" + VERBATIM ) - add_custom_target (${TARGET} DEPENDS ${SHADERS_DIR}/frag.spv ${SHADERS_DIR}/vert.spv) + endforeach() + + # Create the custom target that depends on all output files + add_custom_target (${TARGET} DEPENDS ${SHADER_OUTPUTS}) endfunction () function (add_slang_shader_target TARGET) cmake_parse_arguments ("SHADER" "" "CHAPTER_NAME" "SOURCES" ${ARGN}) set (SHADERS_DIR ${SHADER_CHAPTER_NAME}/shaders) + set (SHADERS_FULL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}) file(GLOB HAS_COMPUTE ${CHAPTER_SHADER}.comp) set (ENTRY_POINTS -entry vertMain -entry fragMain) if(HAS_COMPUTE) list(APPEND ENTRY_POINTS -entry compMain) endif() add_custom_command ( - OUTPUT ${SHADERS_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_DIR} + OUTPUT ${SHADERS_FULL_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_FULL_DIR} ) add_custom_command ( - OUTPUT ${SHADERS_DIR}/slang.spv - COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o ${CMAKE_CURRENT_LIST_DIR}/${SHADERS_DIR}/slang.spv - DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES} + OUTPUT ${SHADERS_FULL_DIR}/slang.spv + COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_FULL_DIR} + COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}/slang.spv + DEPENDS ${SHADER_SOURCES} COMMENT "Compiling Slang Shaders" VERBATIM ) - add_custom_target (${TARGET} DEPENDS ${SHADERS_DIR}/slang.spv) + add_custom_target (${TARGET} DEPENDS ${SHADERS_FULL_DIR}/slang.spv) endfunction() function (add_chapter CHAPTER_NAME) From 1dc7b0ccc018c0be511e98d0177992b4dd6a6546 Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 08:37:22 -0700 Subject: [PATCH 13/19] revert back to the simpler method that worked. --- attachments/CMakeLists.txt | 53 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt index 6b0ed677..fd0bd453 100644 --- a/attachments/CMakeLists.txt +++ b/attachments/CMakeLists.txt @@ -64,60 +64,43 @@ find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin REQUIRED) function (add_shaders_target TARGET) cmake_parse_arguments ("SHADER" "" "CHAPTER_NAME" "SOURCES" ${ARGN}) set (SHADERS_DIR ${SHADER_CHAPTER_NAME}/shaders) - set (SHADERS_FULL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}) add_custom_command ( - OUTPUT ${SHADERS_FULL_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_FULL_DIR} + OUTPUT ${SHADERS_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_DIR} ) - # Create a list to store the output files - set(SHADER_OUTPUTS "") - - # Create separate commands for each shader file to ensure they are compiled to the correct location - foreach(SHADER_SOURCE ${SHADER_SOURCES}) - get_filename_component(SHADER_NAME ${SHADER_SOURCE} NAME_WE) - get_filename_component(SHADER_EXT ${SHADER_SOURCE} EXT) - string(REPLACE "." "" SHADER_EXT ${SHADER_EXT}) - - # Add the output file to the list - list(APPEND SHADER_OUTPUTS ${SHADERS_FULL_DIR}/${SHADER_EXT}.spv) - - add_custom_command( - OUTPUT ${SHADERS_FULL_DIR}/${SHADER_EXT}.spv - COMMAND glslang::validator - ARGS --target-env vulkan1.0 ${SHADER_SOURCE} --quiet -o ${SHADERS_FULL_DIR}/${SHADER_EXT}.spv - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${SHADERS_FULL_DIR} ${SHADER_SOURCE} - COMMENT "Compiling ${SHADER_EXT} Shader" - VERBATIM + add_custom_command ( + OUTPUT ${SHADERS_DIR}/frag.spv ${SHADERS_DIR}/vert.spv + COMMAND glslang::validator + ARGS --target-env vulkan1.0 ${SHADER_SOURCES} --quiet + WORKING_DIRECTORY ${SHADERS_DIR} + DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES} + COMMENT "Compiling Shaders" + VERBATIM ) - endforeach() - - # Create the custom target that depends on all output files - add_custom_target (${TARGET} DEPENDS ${SHADER_OUTPUTS}) + add_custom_target (${TARGET} DEPENDS ${SHADERS_DIR}/frag.spv ${SHADERS_DIR}/vert.spv) endfunction () function (add_slang_shader_target TARGET) cmake_parse_arguments ("SHADER" "" "CHAPTER_NAME" "SOURCES" ${ARGN}) set (SHADERS_DIR ${SHADER_CHAPTER_NAME}/shaders) - set (SHADERS_FULL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}) file(GLOB HAS_COMPUTE ${CHAPTER_SHADER}.comp) set (ENTRY_POINTS -entry vertMain -entry fragMain) if(HAS_COMPUTE) list(APPEND ENTRY_POINTS -entry compMain) endif() add_custom_command ( - OUTPUT ${SHADERS_FULL_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_FULL_DIR} + OUTPUT ${SHADERS_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_DIR} ) add_custom_command ( - OUTPUT ${SHADERS_FULL_DIR}/slang.spv - COMMAND ${CMAKE_COMMAND} -E make_directory ${SHADERS_FULL_DIR} - COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}/slang.spv - DEPENDS ${SHADER_SOURCES} + OUTPUT ${SHADERS_DIR}/slang.spv + COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o slang.spv + WORKING_DIRECTORY ${SHADERS_DIR} + DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES} COMMENT "Compiling Slang Shaders" VERBATIM ) - add_custom_target (${TARGET} DEPENDS ${SHADERS_FULL_DIR}/slang.spv) + add_custom_target (${TARGET} DEPENDS ${SHADERS_DIR}/slang.spv) endfunction() function (add_chapter CHAPTER_NAME) From c3d12af3fb0ab06a3c612d92ddf3fb95c448df71 Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 08:39:31 -0700 Subject: [PATCH 14/19] Improve CI script by adding checks for existing directories before cloning/building yaml-cpp - Prevent redundant cloning by verifying the existence and content of the yaml-cpp directory. - Ensure the build directory is only created if it doesn't already exist. --- .github/workflows/workflow.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index cb1351ba..0dbf01f1 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -48,9 +48,16 @@ jobs: ninja-build \ clang # Build and install yaml-cpp from source - git clone https://github.com/jbeder/yaml-cpp.git + if [ ! -d "yaml-cpp" ] || [ -z "$(ls -A yaml-cpp)" ]; then + # Directory doesn't exist or is empty, clone the repository + rm -rf yaml-cpp # Remove directory if it exists but is empty + git clone https://github.com/jbeder/yaml-cpp.git + fi cd yaml-cpp - cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON + # Only create build directory if it doesn't exist + if [ ! -d "build" ]; then + cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON + fi cmake --build build --config Release -j4 sudo cmake --install build test-cmd: | From ccc96cb25028412d2dfd915c443a44fc28830200 Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 15:28:14 -0700 Subject: [PATCH 15/19] Switch Vulkan SDK back to `.tar.gz` format and simplify CI workflows - Revert Vulkan SDK archive back to `.tar.gz` format for improved compatibility. - Remove yaml-cpp build process from Ubuntu CI workflow to streamline dependency installation. - Replace manual Vulkan installation with Chocolatey in Windows CI workflow for simplicity. - Introduce improved caching for Vulkan SDK, dependencies, and build artifacts across platforms. --- .github/workflows/workflow.yml | 141 ++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 63 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 0dbf01f1..91d11979 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -23,11 +23,11 @@ jobs: mkdir -p vulkan-sdk cd vulkan-sdk - # Download the SDK - try .tar.xz format instead of .tar.gz - curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz" + # Download the SDK + curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz" - # Extract the SDK - use tar with J flag for xz compression - tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz + # Extract the SDK + tar -xzf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz # Set up environment variables echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV @@ -38,28 +38,13 @@ jobs: # Return to the original directory cd .. deps-install: | + # GitHub runners already have cmake, ninja-build, and clang installed sudo apt-get update sudo apt-get install -y \ libglfw3-dev \ libglm-dev \ libtinyobjloader-dev \ - libstb-dev \ - cmake \ - ninja-build \ - clang - # Build and install yaml-cpp from source - if [ ! -d "yaml-cpp" ] || [ -z "$(ls -A yaml-cpp)" ]; then - # Directory doesn't exist or is empty, clone the repository - rm -rf yaml-cpp # Remove directory if it exists but is empty - git clone https://github.com/jbeder/yaml-cpp.git - fi - cd yaml-cpp - # Only create build directory if it doesn't exist - if [ ! -d "build" ]; then - cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON - fi - cmake --build build --config Release -j4 - sudo cmake --install build + libstb-dev test-cmd: | # Check if some of the expected executables were built if [ -f "00_base_code/00_base_code" ]; then @@ -84,42 +69,16 @@ jobs: fi - os: windows-latest vulkan-install: | - # Download the Vulkan SDK installer - Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe" - - # Run the installer with silent options - Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow - - # Find the actual installed SDK version - $vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName - - if (-not $vulkanPath) { - $vulkanPath = "C:\VulkanSDK\latest" - } + # Install Vulkan SDK using Chocolatey (pre-installed on GitHub runners) + choco install vulkan-sdk -y - # Set environment variables with correct Windows-style paths + # Set environment variables + $vulkanPath = "C:\VulkanSDK\latest" echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - # Add Vulkan SDK to system PATH echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - # Set explicit CMake variables echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - # Display debug information - Write-Host "Vulkan SDK path: $vulkanPath" - if (Test-Path "$vulkanPath\Lib") { - Write-Host "Lib directory exists" - } else { - Write-Host "Lib directory does not exist" - } - if (Test-Path "$vulkanPath\Include") { - Write-Host "Include directory exists" - } else { - Write-Host "Include directory does not exist" - } deps-install: | vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV @@ -151,26 +110,51 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Cache dependencies (Windows) + # Cache vcpkg packages for Windows + - name: Cache vcpkg packages (Windows) if: runner.os == 'Windows' uses: actions/cache@v3 with: path: | - ${{ env.VCPKG_INSTALLATION_ROOT }} - key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }} + ${{ env.VCPKG_INSTALLATION_ROOT }}/installed + ${{ env.VCPKG_INSTALLATION_ROOT }}/packages + ${{ env.VCPKG_INSTALLATION_ROOT }}/buildtrees + key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }} + restore-keys: | + ${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}- + ${{ runner.os }}-vcpkg- + + # Cache Vulkan SDK for Windows + - name: Cache Vulkan SDK (Windows) + if: runner.os == 'Windows' + uses: actions/cache@v3 + with: + path: C:\VulkanSDK + key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }} + restore-keys: | + ${{ runner.os }}-vulkan-sdk- + + # Cache apt packages for Ubuntu + - name: Cache apt packages (Ubuntu) + if: runner.os == 'Linux' + uses: actions/cache@v3 + with: + path: /var/cache/apt/archives + key: ${{ runner.os }}-apt-${{ hashFiles('**/workflow.yml') }} restore-keys: | - ${{ runner.os }}-deps- + ${{ runner.os }}-apt- - - name: Cache dependencies (Ubuntu) + # Cache Vulkan SDK for Ubuntu + - name: Cache Vulkan SDK (Ubuntu) if: runner.os == 'Linux' uses: actions/cache@v3 with: path: | - ${{ github.workspace }}/yaml-cpp/build ${{ github.workspace }}/vulkan-sdk - key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }} + key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }} restore-keys: | - ${{ runner.os }}-deps- + ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}- + ${{ runner.os }}-vulkan-sdk- - name: Install dependencies run: ${{ matrix.deps-install }} @@ -183,15 +167,23 @@ jobs: run: | if (Test-Path $env:VULKAN_SDK) { echo "Vulkan SDK found at: $env:VULKAN_SDK" - echo "Contents of Lib directory:" - Get-ChildItem "$env:VULKAN_SDK\Lib" - echo "Contents of Include directory:" - Get-ChildItem "$env:VULKAN_SDK\Include" + echo "Vulkan SDK installation verified" } else { echo "Vulkan SDK not found!" exit 1 } + # Cache CMake build directory for Windows + - name: Cache build artifacts (Windows) + if: runner.os == 'Windows' + uses: actions/cache@v3 + with: + path: ${{github.workspace}}/attachments/build + key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }} + restore-keys: | + ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}- + ${{ runner.os }}-build- + - name: Configure CMake (Windows) working-directory: ${{github.workspace}}/attachments if: runner.os == 'Windows' @@ -208,6 +200,29 @@ jobs: Get-Content "build/CMakeCache.txt" | Select-String -Pattern "Vulkan" } + # Verify Vulkan Installation for Ubuntu + - name: Verify Vulkan Installation (Ubuntu) + if: runner.os == 'Linux' + run: | + if [ -d "$VULKAN_SDK" ]; then + echo "Vulkan SDK found at: $VULKAN_SDK" + echo "Vulkan SDK installation verified" + else + echo "Vulkan SDK not found!" + exit 1 + fi + + # Cache CMake build directory for Ubuntu + - name: Cache build artifacts (Ubuntu) + if: runner.os == 'Linux' + uses: actions/cache@v3 + with: + path: ${{github.workspace}}/attachments/build + key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }} + restore-keys: | + ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}- + ${{ runner.os }}-build- + - name: Configure CMake (Unix) working-directory: ${{github.workspace}}/attachments if: runner.os != 'Windows' From 99f2944401037175f11c8ee4ced5207c4d1f3771 Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 15:36:03 -0700 Subject: [PATCH 16/19] Switch Vulkan SDK to `.tar.xz` format and enhance CI workflows - Update Vulkan SDK to use `.tar.xz` archive format for Linux, updating download and extraction steps. - Replace Chocolatey-based Vulkan installation on Windows with a direct download and silent installer for better control. - Add comprehensive validation of Vulkan SDK installation across platforms, including checks for critical directories and files. --- .github/workflows/workflow.yml | 84 ++++++++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 91d11979..4de83e53 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -24,10 +24,10 @@ jobs: cd vulkan-sdk # Download the SDK - curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz" + curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz" - # Extract the SDK - tar -xzf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz + # Extract the SDK - use tar with J flag for xz compression + tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz # Set up environment variables echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV @@ -69,11 +69,53 @@ jobs: fi - os: windows-latest vulkan-install: | - # Install Vulkan SDK using Chocolatey (pre-installed on GitHub runners) - choco install vulkan-sdk -y + # Get the latest Vulkan SDK version + $vulkanVersion = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest/windows.txt" -UseBasicParsing).Content.Trim() + echo "Using Vulkan SDK version: $vulkanVersion" - # Set environment variables - $vulkanPath = "C:\VulkanSDK\latest" + # Download the Vulkan SDK installer with progress + echo "Downloading Vulkan SDK installer..." + $downloadUrl = "https://sdk.lunarg.com/sdk/download/$vulkanVersion/windows/VulkanSDK-$vulkanVersion-Installer.exe" + echo "Download URL: $downloadUrl" + + # Create a WebClient to show download progress + $webClient = New-Object System.Net.WebClient + $webClient.DownloadFile($downloadUrl, "$env:TEMP\vulkan-sdk.exe") + echo "Download completed to: $env:TEMP\vulkan-sdk.exe" + + # Verify the installer exists + if (Test-Path "$env:TEMP\vulkan-sdk.exe") { + echo "Installer file exists and is ready" + echo "File size: $((Get-Item "$env:TEMP\vulkan-sdk.exe").Length) bytes" + } else { + echo "Installer file does not exist! Download failed." + exit 1 + } + + # Run the installer with silent options + $installArgs = "--accept-licenses --default-answer --confirm-command install" + echo "Running installer with arguments: $installArgs" + Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList $installArgs -Wait -NoNewWindow + echo "Installer process completed" + + # Find the actual installed SDK version + echo "Checking for installed SDK..." + if (Test-Path "C:\VulkanSDK") { + echo "VulkanSDK directory exists" + Get-ChildItem "C:\VulkanSDK" | ForEach-Object { echo "Found: $($_.FullName)" } + $vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName + } else { + echo "VulkanSDK directory does not exist!" + } + + if (-not $vulkanPath) { + echo "Could not find specific version directory, using latest" + $vulkanPath = "C:\VulkanSDK\latest" + } + + echo "Using Vulkan SDK path: $vulkanPath" + + # Set environment variables with correct Windows-style paths echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append @@ -167,7 +209,33 @@ jobs: run: | if (Test-Path $env:VULKAN_SDK) { echo "Vulkan SDK found at: $env:VULKAN_SDK" - echo "Vulkan SDK installation verified" + + # Check for critical directories and files + $criticalPaths = @( + "$env:VULKAN_SDK\Include", + "$env:VULKAN_SDK\Lib", + "$env:VULKAN_SDK\Bin", + "$env:VULKAN_SDK\Include\vulkan\vulkan.h", + "$env:VULKAN_SDK\Lib\vulkan-1.lib", + "$env:VULKAN_SDK\Bin\glslangValidator.exe" + ) + + $allPathsExist = $true + foreach ($path in $criticalPaths) { + if (Test-Path $path) { + echo "✓ Found: $path" + } else { + echo "✗ Missing: $path" + $allPathsExist = $false + } + } + + if ($allPathsExist) { + echo "Vulkan SDK installation verified successfully" + } else { + echo "Vulkan SDK installation is incomplete!" + exit 1 + } } else { echo "Vulkan SDK not found!" exit 1 From ff03609ea32e008e11d2814ecae3ecb7012caefa Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 15:43:13 -0700 Subject: [PATCH 17/19] Simplify Vulkan SDK installation on Windows - Replace verbose manual steps with streamlined direct download and silent installation. - Remove redundant installation checks and improve debug output for validation. --- .github/workflows/workflow.yml | 52 +++++++++++----------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4de83e53..ad9dd134 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -69,58 +69,38 @@ jobs: fi - os: windows-latest vulkan-install: | - # Get the latest Vulkan SDK version - $vulkanVersion = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest/windows.txt" -UseBasicParsing).Content.Trim() - echo "Using Vulkan SDK version: $vulkanVersion" - - # Download the Vulkan SDK installer with progress - echo "Downloading Vulkan SDK installer..." - $downloadUrl = "https://sdk.lunarg.com/sdk/download/$vulkanVersion/windows/VulkanSDK-$vulkanVersion-Installer.exe" - echo "Download URL: $downloadUrl" - - # Create a WebClient to show download progress - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($downloadUrl, "$env:TEMP\vulkan-sdk.exe") - echo "Download completed to: $env:TEMP\vulkan-sdk.exe" - - # Verify the installer exists - if (Test-Path "$env:TEMP\vulkan-sdk.exe") { - echo "Installer file exists and is ready" - echo "File size: $((Get-Item "$env:TEMP\vulkan-sdk.exe").Length) bytes" - } else { - echo "Installer file does not exist! Download failed." - exit 1 - } + # Download the Vulkan SDK installer + Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe" # Run the installer with silent options - $installArgs = "--accept-licenses --default-answer --confirm-command install" - echo "Running installer with arguments: $installArgs" - Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList $installArgs -Wait -NoNewWindow - echo "Installer process completed" + Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow # Find the actual installed SDK version - echo "Checking for installed SDK..." - if (Test-Path "C:\VulkanSDK") { - echo "VulkanSDK directory exists" - Get-ChildItem "C:\VulkanSDK" | ForEach-Object { echo "Found: $($_.FullName)" } $vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName - } else { - echo "VulkanSDK directory does not exist!" - } if (-not $vulkanPath) { - echo "Could not find specific version directory, using latest" $vulkanPath = "C:\VulkanSDK\latest" } - echo "Using Vulkan SDK path: $vulkanPath" - # Set environment variables with correct Windows-style paths echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + # Display debug information + Write-Host "Vulkan SDK path: $vulkanPath" + if (Test-Path "$vulkanPath\Lib") { + Write-Host "Lib directory exists" + } else { + Write-Host "Lib directory does not exist" + } + if (Test-Path "$vulkanPath\Include") { + Write-Host "Include directory exists" + } else { + Write-Host "Include directory does not exist" + } deps-install: | vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV From 7da9b41ebac801114e0737ae9d174fea2976860c Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 15:56:36 -0700 Subject: [PATCH 18/19] Add Antora CI workflow for documentation build - Introduce `.github/workflows/build-antora-doc.yml` to automate Antora documentation builds in CI. - Include `antora-ci-playbook.yml` for specifying site configuration and build parameters. - Configure workflow to trigger on `push`, `pull_request`, and manual dispatch. - Add steps to install dependencies, build the UI bundle, and generate documentation. --- .github/workflows/build-antora-doc.yml | 50 ++++++++++++++++++++++++++ antora-ci-playbook.yml | 14 ++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/build-antora-doc.yml create mode 100644 antora-ci-playbook.yml diff --git a/.github/workflows/build-antora-doc.yml b/.github/workflows/build-antora-doc.yml new file mode 100644 index 00000000..b56af0cf --- /dev/null +++ b/.github/workflows/build-antora-doc.yml @@ -0,0 +1,50 @@ +# Copyright 2024 Sascha Willems +# SPDX-License-Identifier: CC-BY-4.0 +# This Antora playbook is used by the CI to make sure the Antora build works +name: "Build Antora documentation" +on: + workflow_dispatch: + pull_request: + types: [ opened, synchronize, reopened ] + push: + branches: [ main ] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: "recursive" + - name: "Get Antora UI bundle" + uses: actions/checkout@v4 + with: + repository: KhronosGroup/antora-ui-khronos + path: ./antora-ui-khronos + ref: main + - name: "Install npm" + uses: actions/setup-node@v4 + with: + node-version: 'latest' + cache: 'npm' + - name: "Install dependencies" + run: | + sudo apt-get update + sudo apt-get install -y asciidoctor + - name: "Build UI bundle" + working-directory: ./antora-ui-khronos + run: | + npx update-browserslist-db@latest + ./node_modules/gulp/bin/gulp.js --version + ./node_modules/gulp/bin/gulp.js bundle + - name: "Copy UI bundle" + run: cp ./antora-ui-khronos/build/ui-bundle.zip ./ + - name: "Build tutorial" + run: | + cd antora + make + - name: "Build Antora documentation" + working-directory: ./ + run: npx antora antora-ci-playbook.yml --stacktrace diff --git a/antora-ci-playbook.yml b/antora-ci-playbook.yml new file mode 100644 index 00000000..c9974396 --- /dev/null +++ b/antora-ci-playbook.yml @@ -0,0 +1,14 @@ +# Copyright 2024 Sascha Willems +# SPDX-License-Identifier: CC-BY-4.0 +# This Antora playbook is used by the CI to make sure the Antora build works +site: + title: Vulkan Tutorial Antora CI Playbook + start_page: tutorial::00_Introduction.adoc +content: + sources: + - url: ./ + branches: HEAD + start_path: antora +ui: + bundle: + url: ui-bundle.zip From 81d94f3050dd42a06f647bab806863b5fe928c3d Mon Sep 17 00:00:00 2001 From: swinston Date: Wed, 2 Jul 2025 16:04:53 -0700 Subject: [PATCH 19/19] Improve Antora CI workflow by adding cache-dependency-path for npm step --- .github/workflows/build-antora-doc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-antora-doc.yml b/.github/workflows/build-antora-doc.yml index b56af0cf..dd89faa3 100644 --- a/.github/workflows/build-antora-doc.yml +++ b/.github/workflows/build-antora-doc.yml @@ -29,6 +29,7 @@ jobs: with: node-version: 'latest' cache: 'npm' + cache-dependency-path: './antora-ui-khronos/package-lock.json' - name: "Install dependencies" run: | sudo apt-get update