name: CMake on: push: paths: - "src/**" - "ext/**" - "CMakeLists.txt" pull_request: branches: [ "master" ] env: ARTIFACT_NAME: tmx2gba BUILD_TYPE: RelWithDebInfo jobs: build: strategy: matrix: config: - { name: "MacOS 13.0 Universal", os: macos-13, artifact: macos-universal, arch: arm64;x86_64 } - { name: "Windows MSVC x86", os: windows-latest, artifact: windows-x86, arch: x86 } - { name: "Windows MSVC x64", os: windows-latest, artifact: windows-x64 } - { name: "Windows MSVC ARM64", os: windows-latest, artifact: windows-arm64, arch: amd64_arm64 } - { name: "Ubuntu", artifact: "linux", os: ubuntu-latest } runs-on: ${{matrix.config.os}} steps: - uses: actions/checkout@v4 # Since ninja isn't used it will take less time if this step is skipped - uses: lukka/get-cmake@latest if: ${{!startsWith(matrix.config.os, 'windows')}} - uses: TheMrMilchmann/setup-msvc-dev@v3 if: ${{startsWith(matrix.config.os, 'windows')}} with: arch: ${{matrix.config.arch && matrix.config.arch || 'x64'}} - name: Configure CMake run: >- cmake -B build -G "${{startsWith(matrix.config.os, 'windows') && 'NMake Makefiles' || 'Ninja'}}" ${{(startsWith(matrix.config.os, 'macos') && matrix.config.arch) && format('-DCMAKE_OSX_ARCHITECTURES="{0}"', matrix.config.arch) || ''}} ${{matrix.config.extra}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build run: cmake --build build --config ${{env.BUILD_TYPE}} - uses: actions/upload-artifact@v4 with: name: ${{env.ARTIFACT_NAME}}-${{matrix.config.artifact}} path: build/src/${{env.ARTIFACT_NAME}}${{startsWith(matrix.config.os, 'windows') && '.exe' || ''}}