Merge pull request #810 from henryborchers/improve-compile-times #4
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: Build_libs | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| library_type: [static, shared] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| include: | |
| - os: ubuntu-latest | |
| cmake_preset_name: conan-release | |
| conan_home: "/home/runner/.conan2" | |
| - os: macos-latest | |
| cmake_preset_name: conan-release | |
| conan_home: "/Users/runner/.conan2" | |
| - os: windows-latest | |
| cmake_preset_name: conan-default | |
| conan_home: "C:/Users/runneradmin/.conan2" | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CONAN_HOME: ${{ matrix.conan_home }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| cache: 'pip' # caching pip dependencies | |
| - name: "Cache Conan dependencies" | |
| uses: actions/cache@v4 | |
| with: | |
| path: "${{matrix.conan_home}}" | |
| key: ${{ runner.os }}-conan-${{ hashFiles('.github/workflows/conanfile.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conan- | |
| - name: "install dependencies" # use conan package manager to install c and c++ dependencies | |
| # conanfile.txt is copied to the root because for some reason, conan doesn't seem to create the top | |
| # CMakeUserPresets.json if you have the conanfile.txt in another directory than the path you call conan from. | |
| # | |
| # "cmake -E copy" is used to copy the file is because it has the same interface across all operating systems. | |
| run: | | |
| pip install --disable-pip-version-check uv | |
| uvx conan profile detect --exist-ok | |
| cmake -E copy .github/workflows/conanfile.txt conanfile.txt | |
| uvx conan install -of build --build=missing -g CMakeDeps -g CMakeToolchain conanfile.txt | |
| - name: Configure cmake | |
| run: | | |
| cmake --preset ${{ matrix.cmake_preset_name }} -D BUILD_SHARED_LIBS=${{ matrix.library_type == 'static' && 'NO' || 'YES'}} | |
| - name: Build | |
| run: | | |
| cmake --build --preset conan-release | |
| - name: Install | |
| run: | | |
| cmake --install build --prefix sample_prefix |