Conan2 support #36
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
name: ${{ matrix.settings.name }} ${{ matrix.configuration }} | |
runs-on: ${{ matrix.settings.os }} | |
strategy: | |
matrix: | |
configuration: [ "Release", "Debug" ] | |
settings: | |
- { | |
name: "Ubuntu GCC-12", | |
os: ubuntu-latest, | |
compiler: { type: GCC, version: 12, conan: "gcc", cc: "gcc-12", cxx: "g++-12", std: 20 }, | |
lib: "libstdc++11" | |
} | |
# - { | |
# name: "Ubuntu Clang-15 + libc++", | |
# os: ubuntu-latest, | |
# compiler: { type: CLANG, version: 15, conan: "clang", cc: "clang-15", cxx: "clang++-15", std: 20, toolchain: "clang-libc++.cmake" }, | |
# lib: "libc++", | |
# } | |
- { | |
name: "Visual Studio 2019", | |
os: windows-latest, | |
compiler: { type: VISUAL, version: 16, conan: "mscv", cc: "cl", cxx: "cl", std: 20 }, | |
} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache Conan data | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-conan-data | |
with: | |
path: ${{github.workspace}}/.conan2/p | |
key: ${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-${{ matrix.settings.lib }} | |
restore-keys: | | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}- | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}- | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}- | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}- | |
- name: Add msbuild to PATH | |
if: matrix.settings.os == 'windows-latest' | |
uses: microsoft/[email protected] | |
with: | |
vs-version: "16.5" | |
- name: Install Latest GCC | |
if: matrix.settings.compiler.type == 'GCC' | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: ${{ matrix.settings.compiler.version }} | |
platform: x64 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install Python requirements | |
run: | | |
pip install -r ./requirements.txt | |
- name: Configure Conan | |
shell: bash | |
run: | | |
conan profile detect --force | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.configuration }}/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.settings.compiler.std }}/' .conan2/profiles/default | |
if [[ "${{ matrix.settings.compiler.type }}" == "GCC" || "${{ matrix.settings.compiler.type }}" == "CLANG" ]]; then | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler=.*/compiler=${{ matrix.settings.compiler.conan }}/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.version=.*/compiler.version=${{ matrix.settings.compiler.version }}/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ matrix.settings.lib }}/' .conan2/profiles/default | |
fi | |
conan profile show -pr default | |
- name: Configure Install | |
if: matrix.settings.os == 'windows-latest' | |
shell: bash | |
run: | | |
conan install "${{github.workspace}}" --build missing -pr:b default -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c tools.env.virtualenv:powershell=True | |
- name: Configure Install | |
if: matrix.settings.os != 'windows-latest' | |
shell: bash | |
run: | | |
conan install "${{github.workspace}}" --build missing -pr:b default -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" | |
- name: Configure CMake | |
if: matrix.settings.os == 'windows-latest' | |
shell: cmd | |
run: | | |
call build\conanvcvars.bat | |
call build\conanbuild.ps1 | |
cmake --preset conan-default | |
- name: Configure CMake | |
if: matrix.settings.os != 'windows-latest' | |
shell: bash | |
run: | | |
source build/generators/conanbuild.sh | |
cmake --preset conan-default | |
- name: Conan Preset | |
shell: bash | |
run: echo "CONAN_PRESET=conan-$(echo ${{matrix.configuration}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build | |
if: matrix.settings.os == 'windows-latest' | |
shell: cmd | |
run: | | |
call build\conanbuild.ps1 | |
cmake --build --preset ${{ env.CONAN_PRESET }} | |
- name: Build | |
if: matrix.settings.os != 'windows-latest' | |
shell: bash | |
run: | | |
source build/generators/conanbuild.sh | |
cmake --build --preset ${{ env.CONAN_PRESET }} |