| name: macOS | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| pull_request: | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.target}} | |
| runs-on: ${{matrix.os}} | |
| defaults: | |
| run: | |
| shell: bash -e -o pipefail {0} | |
| env: | |
| CCACHE_COMPRESS: 1 | |
| CCACHE_DIR: ${{github.workspace}}/ccache | |
| CCACHE_MAXSIZE: 500M | |
| CMAKE_GENERATOR: Ninja | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 4 | |
| matrix: | |
| os: | |
| - macos-15 | |
| build_type: | |
| - Release | |
| lib: | |
| - shared | |
| - static | |
| target: | |
| - host | |
| - ios | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Setup Dependencies (iOS) | |
| if: matrix.target == 'ios' | |
| run: | | |
| brew install \ | |
| ccache \ | |
| eigen \ | |
| ninja | |
| - name: Setup Dependencies (Host) | |
| if: matrix.target == 'host' | |
| run: | | |
| brew install \ | |
| ccache \ | |
| eigen \ | |
| google-benchmark \ | |
| metis \ | |
| ninja \ | |
| suite-sparse | |
| - name: Cache Build | |
| id: cache-build | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{env.CCACHE_DIR}} | |
| key: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.target}}-${{github.run_id}} | |
| restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.target}}- | |
| - name: Configure (iOS) | |
| if: matrix.target == 'ios' | |
| run: | | |
| cmake -S . -B build_${{matrix.build_type}} \ | |
| -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \ | |
| -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \ | |
| -DCMAKE_SYSTEM_NAME=iOS \ | |
| -DCMAKE_OSX_ARCHITECTURES=arm64 \ | |
| -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \ | |
| -DEigen3_DIR=$(brew --prefix)/share/eigen3/cmake \ | |
| -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install | |
| - name: Configure (Host) | |
| if: matrix.target == 'host' | |
| run: | | |
| cmake -S . -B build_${{matrix.build_type}} \ | |
| -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \ | |
| -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \ | |
| -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \ | |
| -DWITH_SUITESPARSE=ON | |
| - name: Build | |
| run: | | |
| cmake --build build_${{matrix.build_type}} \ | |
| --config ${{matrix.build_type}} | |
| - name: Test | |
| if: matrix.target == 'host' | |
| run: | | |
| ctest --test-dir build_${{matrix.build_type}} \ | |
| --build-config ${{matrix.build_type}} \ | |
| --output-on-failure \ | |
| -j$(sysctl -n hw.ncpu) | |
| - name: Install | |
| run: | | |
| cmake --build build_${{matrix.build_type}}/ \ | |
| --config ${{matrix.build_type}} \ | |
| --target install | |
| - name: Verify Install | |
| if: matrix.target == 'host' | |
| run: | | |
| cmake -S cmake/smoke_test -B build_smoke_test \ | |
| -DCMAKE_PREFIX_PATH=${{github.workspace}}/install | |
| cmake --build build_smoke_test | |
| ./build_smoke_test/smoke |