diff --git a/.github/job_matrix.py b/.github/job_matrix.py index c490095415..37cfef3f44 100644 --- a/.github/job_matrix.py +++ b/.github/job_matrix.py @@ -119,7 +119,7 @@ def for_github(self): # expose individual ConanOptions fields as top-level matrix properties # (needed for YAML conditions and cache keys) ret.update(features) - ret["conan-config"] = " ".join(f"-o '&:{k}={v}'" for k, v in features.items()) + options = " ".join(f"-o '&:{k}={v}'" for k, v in features.items()) ret["config-summary-str"] = self.infostr(adjusted=False) # Pre-build the -s flags so workflows and repro scripts can use them directly # without sed-patching the auto-detected Conan profile. @@ -141,6 +141,13 @@ def for_github(self): ret["conan-build-folder"] = ( f"{_COMPILER_TYPE_MAP[self.toolchain.compiler.type]}-{self.toolchain.compiler.version}-{self.std}" ) + cc = self.toolchain.compiler.cc + cxx = self.toolchain.compiler.cxx + if cc and cxx: + conf = f'-c \'tools.build:compiler_executables={{"c": "{cc}", "cpp": "{cxx}"}}\'' + ret["conan-args"] = f"{conf} {options}" + else: + ret["conan-args"] = options return ret def _formatters(): diff --git a/.github/workflows/ci-clang-tidy.yml b/.github/workflows/ci-clang-tidy.yml index 2b65e6e72c..414e6d691f 100644 --- a/.github/workflows/ci-clang-tidy.yml +++ b/.github/workflows/ci-clang-tidy.yml @@ -147,7 +147,7 @@ jobs: conan build . -b missing ${{ matrix.conan-settings }} \ -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \ -c user.mp-units.build:all=True -c user.mp-units.analyze:clang-tidy=True -c tools.build:skip_test=True \ - ${{ matrix.conan-config }} 2>&1 | tee /tmp/clang-tidy.log + ${{ matrix.conan-args }} 2>&1 | tee /tmp/clang-tidy.log exit ${PIPESTATUS[0]} - name: Emit clang-tidy annotations if: failure() @@ -185,5 +185,5 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "**Local repro** (in the provided '.devcontainer' or GitHub CodeSpaces environment):" >> $GITHUB_STEP_SUMMARY echo '```sh' >> $GITHUB_STEP_SUMMARY - echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True -c user.mp-units.analyze:clang-tidy=True -c tools.build:skip_test=True ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY + echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True -c user.mp-units.analyze:clang-tidy=True -c tools.build:skip_test=True ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/ci-conan.yml b/.github/workflows/ci-conan.yml index d1f53435b1..cce79f0d13 100644 --- a/.github/workflows/ci-conan.yml +++ b/.github/workflows/ci-conan.yml @@ -170,7 +170,7 @@ jobs: conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \ -b mp-units/* -b missing ${{ matrix.conan-settings }} \ -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.mp-units.build:all=True \ - ${{ matrix.conan-config }} + ${{ matrix.conan-args }} - name: Create Conan package if: matrix.toolchain.compiler.type == 'MSVC' shell: bash @@ -178,7 +178,7 @@ jobs: conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \ -b mp-units/* -b missing ${{ matrix.conan-settings }} \ -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.mp-units.build:all=False \ - ${{ matrix.conan-config }} + ${{ matrix.conan-args }} - name: Obtain package reference id: get-package-ref shell: bash @@ -208,7 +208,7 @@ jobs: echo "**Local repro** (in the provided '.devcontainer' or GitHub CodeSpaces environment):" >> $GITHUB_STEP_SUMMARY echo '```sh' >> $GITHUB_STEP_SUMMARY [ "${{ matrix.toolchain.compiler.type }}" != "MSVC" ] && ALL="True" || ALL="False" - echo "conan create . -b mp-units/* -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=${ALL} ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY + echo "conan create . -b mp-units/* -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=${ALL} ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY outputs: diff --git a/.github/workflows/ci-freestanding.yml b/.github/workflows/ci-freestanding.yml index fcbe194ab9..86b4226bc6 100644 --- a/.github/workflows/ci-freestanding.yml +++ b/.github/workflows/ci-freestanding.yml @@ -162,7 +162,7 @@ jobs: conan build . -b missing ${{ matrix.conan-settings }} \ -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \ -c user.mp-units.build:all=True \ - ${{ matrix.conan-config }} + ${{ matrix.conan-args }} - name: Clean Conan cache before backup shell: bash run: | @@ -178,5 +178,5 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "**Local repro** (in the provided '.devcontainer' or GitHub CodeSpaces environment):" >> $GITHUB_STEP_SUMMARY echo '```sh' >> $GITHUB_STEP_SUMMARY - echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY + echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/ci-test-package-cmake.yml b/.github/workflows/ci-test-package-cmake.yml index 7de13c9b39..9efca6a516 100644 --- a/.github/workflows/ci-test-package-cmake.yml +++ b/.github/workflows/ci-test-package-cmake.yml @@ -174,7 +174,7 @@ jobs: run: | conan install . -b missing ${{ matrix.conan-settings }} \ -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \ - -c user.mp-units.build:all=False ${{ matrix.conan-config }} + -c user.mp-units.build:all=False ${{ matrix.conan-args }} - name: Provide dependencies for the build shell: bash working-directory: src @@ -290,7 +290,7 @@ jobs: BUILD_TYPE_LOWER=$(echo "${{ matrix.build_type }}" | tr '[:upper:]' '[:lower:]') echo '```sh' >> $GITHUB_STEP_SUMMARY echo "echo 'tools.cmake.cmake_layout:build_folder_vars=[\"settings.compiler\", \"settings.compiler.version\", \"settings.compiler.cppstd\"]' >> ~/.conan2/global.conf" >> $GITHUB_STEP_SUMMARY - echo "conan install . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=False ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY + echo "conan install . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=False ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY echo "echo '{\"version\":4,\"include\":[\"../CMakeUserPresets.json\"]}' > src/CMakeUserPresets.json" >> $GITHUB_STEP_SUMMARY echo "echo '{\"version\":4,\"include\":[\"../CMakeUserPresets.json\"]}' > test_package/CMakeUserPresets.json" >> $GITHUB_STEP_SUMMARY echo "(cd src && source ../build/${{ matrix.conan-build-folder }}/generators/conanbuild.sh && cmake --preset conan-${{ matrix.conan-build-folder }} -DCMAKE_INSTALL_PREFIX=../out && cmake --build --preset conan-${{ matrix.conan-build-folder }}-${BUILD_TYPE_LOWER} --target install)" >> $GITHUB_STEP_SUMMARY