Fix windows game engine #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SimpleEngine CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'attachments/simple_engine/**' | |
| - '.github/workflows/simple_engine.yml' | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'attachments/simple_engine/**' | |
| - '.github/workflows/simple_engine.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-simple-engine: | |
| name: SimpleEngine (${{ matrix.os }} • ${{ matrix.build_type }} • module=${{ matrix.enable_module }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| build_type: [Debug, Release] | |
| enable_module: [OFF, ON] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| # ----------------------- | |
| # Linux: set up Vulkan SDK similar to workflow.yml | |
| # ----------------------- | |
| - name: Install Vulkan SDK (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/linux.txt) | |
| echo "Using Vulkan SDK version: $VULKAN_VERSION" | |
| mkdir -p vulkan-sdk | |
| cd vulkan-sdk | |
| curl -sSLO "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz" | |
| tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz | |
| 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 | |
| cd .. | |
| - name: Install Dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| ninja-build \ | |
| clang \ | |
| libglfw3-dev \ | |
| libglm-dev \ | |
| libxrandr-dev \ | |
| libxinerama-dev \ | |
| libxcursor-dev \ | |
| libxi-dev \ | |
| libopenal-dev | |
| - name: Install project deps via script (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| working-directory: attachments/simple_engine | |
| run: | | |
| if [ -x ./install_dependencies_linux.sh ]; then | |
| ./install_dependencies_linux.sh || true | |
| fi | |
| # ----------------------- | |
| # Windows dependencies | |
| # ----------------------- | |
| - name: Install vcpkg and dependencies (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| git clone https://github.com/microsoft/vcpkg.git $env:USERPROFILE\vcpkg | |
| & $env:USERPROFILE\vcpkg\bootstrap-vcpkg.bat | |
| $triplet = 'x64-windows' | |
| # Use manifest mode; vcpkg.json at repo root defines dependencies | |
| & $env:USERPROFILE\vcpkg\vcpkg.exe install --triplet $triplet | |
| echo "CMAKE_TOOLCHAIN_FILE=$env:USERPROFILE\vcpkg\scripts\buildsystems\vcpkg.cmake" >> $env:GITHUB_ENV | |
| echo "VCPKG_TARGET_TRIPLET=$triplet" >> $env:GITHUB_ENV | |
| - name: Install project deps via script (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: cmd | |
| working-directory: attachments/simple_engine | |
| run: | | |
| if exist install_dependencies_windows.bat call install_dependencies_windows.bat || exit /b 0 | |
| # Install LunarG Vulkan SDK on Windows and export environment variables for our FindVulkan.cmake | |
| - name: Install Vulkan SDK (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| choco install vulkan-sdk -y --no-progress | |
| $sdkDir = Get-ChildItem -Path 'C:\VulkanSDK' -ErrorAction SilentlyContinue | Sort-Object Name -Descending | Select-Object -First 1 | |
| if (-not $sdkDir) { throw "Vulkan SDK was not installed to C:\VulkanSDK" } | |
| echo "Using Vulkan SDK: $($sdkDir.FullName)" | |
| echo "VULKAN_SDK=$($sdkDir.FullName)" >> $env:GITHUB_ENV | |
| echo "PATH=$($sdkDir.FullName)\Bin;$env:PATH" >> $env:GITHUB_ENV | |
| # ----------------------- | |
| # Configure & Build | |
| # ----------------------- | |
| # Configure on Ubuntu without modules: GCC + Unix Makefiles | |
| - name: "Configure (Ubuntu • non-module: GCC + Makefiles)" | |
| if: matrix.os == 'ubuntu-latest' && matrix.enable_module == 'OFF' | |
| run: | | |
| cmake -S attachments/simple_engine \ | |
| -B build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DENABLE_CPP20_MODULE=${{ matrix.enable_module }} | |
| # Configure on Ubuntu with modules enabled: use Clang + Ninja (required for C++ modules) | |
| - name: "Configure (Ubuntu • module: Clang + Ninja)" | |
| if: matrix.os == 'ubuntu-latest' && matrix.enable_module == 'ON' | |
| run: | | |
| cmake -S attachments/simple_engine \ | |
| -B build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} \ | |
| -G Ninja \ | |
| -DCMAKE_C_COMPILER=clang \ | |
| -DCMAKE_CXX_COMPILER=clang++ \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DENABLE_CPP20_MODULE=${{ matrix.enable_module }} | |
| - name: Configure (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| cmake -S attachments/simple_engine ` | |
| -B build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} ` | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` | |
| -DENABLE_CPP20_MODULE=${{ matrix.enable_module }} ` | |
| -DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" ` | |
| -DVCPKG_TARGET_TRIPLET="$env:VCPKG_TARGET_TRIPLET" | |
| - name: Build | |
| run: | | |
| cmake --build build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} --config ${{ matrix.build_type }} | |
| - name: Package (Release only) | |
| if: matrix.build_type == 'Release' | |
| run: | | |
| cmake --build build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} --target package --config ${{ matrix.build_type }} |