CMake config: also find_dependency(nlohmann_json), and freshen vcpkg.… #16
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 ] | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # --- dependencies --- | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev nlohmann-json3-dev | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install nlohmann-json # libcurl ships with macOS | |
| # --- configure --- | |
| - name: Configure (Linux/macOS, system packages) | |
| if: runner.os != 'Windows' | |
| run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release | |
| - name: Configure (Windows, vcpkg) | |
| if: runner.os == 'Windows' | |
| run: | | |
| # Sync the runner's vcpkg to the manifest's builtin-baseline so its | |
| # port/version database matches, then configure. | |
| $base = (Get-Content vcpkg.json | ConvertFrom-Json).'builtin-baseline' | |
| git -C "$env:VCPKG_INSTALLATION_ROOT" fetch --depth 1 origin $base | |
| git -C "$env:VCPKG_INSTALLATION_ROOT" checkout -f $base | |
| & "$env:VCPKG_INSTALLATION_ROOT\bootstrap-vcpkg.bat" -disableMetrics | |
| cmake -B build -S . "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | |
| # --- build + verify install/export --- | |
| - name: Build | |
| run: cmake --build build --config Release | |
| - name: Install (verify export) | |
| run: cmake --install build --config Release --prefix "${{ runner.temp }}/nml-install" |