chore: simplify SDL2 guard in examples/CMakeLists.txt #11
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: macOS (Clang) | |
| os: macos-latest | |
| cmake_args: "" | |
| build_args: "" | |
| - name: Linux (GCC) | |
| os: ubuntu-latest | |
| cmake_args: "-DGGML_METAL=OFF -DSAM3_METAL=OFF" | |
| build_args: "" | |
| - name: Windows (MSVC) | |
| os: windows-latest | |
| cmake_args: "-DGGML_METAL=OFF -DSAM3_METAL=OFF -A x64 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows" | |
| build_args: "--config Release" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Ninja (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y ninja-build | |
| - name: Install Ninja (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install ninja | |
| - name: Install SDL2 (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: vcpkg install sdl2:x64-windows | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1 | |
| with: | |
| key: ci-${{ matrix.os }} | |
| - name: Configure | |
| run: > | |
| cmake -B build | |
| ${{ runner.os != 'Windows' && '-G Ninja' || '' }} | |
| ${{ matrix.cmake_args }} | |
| ${{ runner.os != 'Windows' && '-DCMAKE_BUILD_TYPE=Release' || '' }} | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: cmake --build build ${{ matrix.build_args }} --parallel | |
| - name: Verify build artifacts | |
| shell: bash | |
| run: | | |
| if [ -f build/libsam3.a ]; then | |
| echo "Found build/libsam3.a" | |
| elif [ -f build/Release/sam3.lib ]; then | |
| echo "Found build/Release/sam3.lib" | |
| elif [ -f build/sam3.lib ]; then | |
| echo "Found build/sam3.lib" | |
| else | |
| echo "ERROR: sam3 library not found" | |
| exit 1 | |
| fi | |
| if [ "$RUNNER_OS" = "Windows" ]; then | |
| for exe in sam3_image.exe sam3_video.exe; do | |
| if [ -f "build/examples/Release/$exe" ]; then | |
| echo "Found build/examples/Release/$exe" | |
| else | |
| echo "ERROR: $exe not built (GUI examples were silently skipped — likely SDL2 not found)" | |
| exit 1 | |
| fi | |
| done | |
| fi |