|
| 1 | +name: Build |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + release: |
| 6 | + types: published |
| 7 | +jobs: |
| 8 | + build-cmake: |
| 9 | + name: ${{ matrix.case.name }} |
| 10 | + runs-on: ${{ matrix.case.os }} |
| 11 | + container: ${{ matrix.case.container }} |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + case: |
| 17 | + - { name: 'Windows (DirectX 9)', os: 'windows-latest', platform: 'D3D9' } |
| 18 | + - { name: 'Windows (GL3, glfw)', os: 'windows-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' } |
| 19 | + - { name: 'Windows (GL3, SDL2)', os: 'windows-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' } |
| 20 | + - { name: 'Windows (null)', os: 'windows-latest', platform: 'NULL' } |
| 21 | + - { name: 'macOS (GL3, glfw)', os: 'macos-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' } |
| 22 | + - { name: 'macOS (GL3, SDL2)', os: 'macos-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' } |
| 23 | + - { name: 'macOS (null)', os: 'macos-latest', platform: 'NULL' } |
| 24 | + - { name: 'Ubuntu (GL3, glfw)', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' } |
| 25 | + - { name: 'Ubuntu (GL3, SDL2)', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' } |
| 26 | + - { name: 'Ubuntu (null)', os: 'ubuntu-latest', platform: 'NULL' } |
| 27 | + - { name: 'PlayStation 2', os: 'ubuntu-latest', platform: 'PS2', ps2: true, container: 'ps2dev/ps2dev:latest', cmake-toolchain-file: 'cmake/ps2/cmaketoolchain/toolchain_ps2_ee.cmake' } |
| 28 | + - { name: 'Nintendo Switch', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'GLFW', glfw-nobuild: true, container: 'devkitpro/devkita64:latest', cmake-toolchain-file: '/opt/devkitpro/cmake/Switch.cmake' } |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - uses: actions/setup-python@v4 |
| 33 | + with: |
| 34 | + python-version: '3.x' |
| 35 | + - name: 'Install PS2 dependencies' |
| 36 | + if: ${{ matrix.case.ps2 }} |
| 37 | + run: | |
| 38 | + apk add cmake gmp mpc1 mpfr4 make pkgconf git |
| 39 | + - name: 'Setup SDL2' |
| 40 | + if: ${{ matrix.case.gl3_gfxlib == 'SDL2' }} |
| 41 | + uses: libsdl-org/setup-sdl@main |
| 42 | + with: |
| 43 | + version: 2-latest |
| 44 | + install-linux-dependencies: true |
| 45 | + cmake-toolchain-file: ${{ matrix.case.cmake-toolchain-file }} |
| 46 | + - name: 'Setup GLFW' |
| 47 | + if: ${{ matrix.case.gl3_gfxlib == 'GLFW' && !matrix.case.glfw-nobuild }} |
| 48 | + shell: sh |
| 49 | + run: | |
| 50 | + ${{ (runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install -y libwayland-dev libxkbcommon-dev xorg-dev') || '' }} |
| 51 | + git clone "https://github.com/glfw/glfw.git" glfw-source --depth 1 |
| 52 | + cmake -S glfw-source -B glfw-build -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DGLFW_INSTALL=ON -DCMAKE_INSTALL_PREFIX=glfw-prefix -DCMAKE_TOOLCHAIN_FILE="${{ matrix.case.cmake-toolchain-file }}" -DCMAKE_BUILD_TYPE=Release |
| 53 | + cmake --build glfw-build --config Release |
| 54 | + cmake --install glfw-build --config Release |
| 55 | + echo "glfw3_ROOT=${{ github.workspace}}/glfw-prefix" >${GITHUB_ENV} |
| 56 | + - name: 'Configure (CMake)' |
| 57 | + shell: sh |
| 58 | + run: | |
| 59 | + cmake -S . -B build \ |
| 60 | + -DLIBRW_PLATFORM=${{ matrix.case.platform }} \ |
| 61 | + -DLIBRW_GL3_GFXLIB=${{ matrix.case.gl3_gfxlib }} \ |
| 62 | + -DCMAKE_TOOLCHAIN_FILE=${{ matrix.case.cmake-toolchain-file }} \ |
| 63 | + -DCMAKE_BUILD_TYPE=Release \ |
| 64 | + -DCMAKE_POLICY_DEFAULT_CMP0074=NEW |
| 65 | + - name: 'Build (CMake)' |
| 66 | + run: | |
| 67 | + cmake --build build --config Release --verbose |
| 68 | + - name: 'Create binary package (CPack)' |
| 69 | + run: | |
| 70 | + cd build |
| 71 | + cpack . -C Release |
| 72 | + - name: 'Archive binary package (GitHub artifacts)' |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: ${{ matrix.case.os }}-${{ matrix.case.platform }}${{ (matrix.case.gl3_gfxlib != '' && format('-{0}', matrix.case.gl3_gfxlib)) || '' }} |
| 76 | + path: build/*.tar.xz |
| 77 | + if-no-files-found: error |
0 commit comments