Add cmake build system #38
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: CMake Build and Test | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| build_type: [Release] | |
| shared_libs: [ON, OFF] | |
| fortran: [OFF] | |
| include: | |
| # Add a Fortran build on each platform (shared only) | |
| - os: ubuntu-latest | |
| build_type: Release | |
| shared_libs: ON | |
| fortran: ON | |
| - os: macos-latest | |
| build_type: Release | |
| shared_libs: ON | |
| fortran: ON | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libyaml-dev gfortran | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install libyaml gcc | |
| - name: Configure | |
| run: > | |
| cmake -B build | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} | |
| -DAST_BUILD_FORTRAN=${{ matrix.fortran }} | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure |