Skip to content

Commit

Permalink
Merge branch 'master' into chiphogg/sqrt-mag#474
Browse files Browse the repository at this point in the history
  • Loading branch information
chiphogg committed Jul 30, 2024
2 parents 3a6fac9 + 0850a20 commit e2829de
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci-clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ jobs:
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default
conan profile show -pr default
- run: echo "std_format=$([ "${{ matrix.formatting }}" == "std::format" ] && echo "True" || echo "False")" >> $GITHUB_ENV
- run: echo "import_std=$([ "${{ matrix.config.cxx_modules }}" == "True" ] && [ "${{ matrix.config.contracts }}" == "none" ] && [ "${{ matrix.formatting }}" == "std::format" ] && echo "True" || echo "False")" >> $GITHUB_ENV
- name: Run clang-tidy
shell: bash
run: |
conan build . -b missing -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 \
'-o &:cxx_modules=${{ matrix.config.cxx_modules }}' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}' ${{ matrix.config.conan-config }}
'-o &:cxx_modules=${{ matrix.config.cxx_modules }}' -o '&:import_std=${{ env.import_std }}' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}' ${{ matrix.config.conan-config }}
- name: Clean Conan cache before backup
shell: bash
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci-conan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,13 @@ jobs:
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default
conan profile show -pr default
- run: echo "std_format=$([ "${{ matrix.formatting }}" == "std::format" ] && echo "True" || echo "False")" >> $GITHUB_ENV
- run: echo "import_std=$([ "${{ matrix.config.cxx_modules }}" == "True" ] && [ "${{ matrix.config.contracts }}" == "none" ] && [ "${{ matrix.formatting }}" == "std::format" ] && echo "True" || echo "False")" >> $GITHUB_ENV
- name: Create Conan package
shell: bash
run: |
conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \
-b mp-units/* -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \
-c user.mp-units.build:all=True -o '&:cxx_modules=${{ matrix.config.cxx_modules }}' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}' ${{ matrix.config.conan-config }}
-b mp-units/* -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.mp-units.build:all=True \
-o '&:cxx_modules=${{ matrix.config.cxx_modules }}' -o '&:import_std=${{ env.import_std }}' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}' ${{ matrix.config.conan-config }}
- name: Obtain package reference
id: get-package-ref
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-test-package-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ jobs:
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default
conan profile show -pr default
- run: echo "std_format=$([ "${{ matrix.formatting }}" == "std::format" ] && echo "True" || echo "False")" >> $GITHUB_ENV
- run: echo "import_std=$([ "${{ matrix.config.cxx_modules }}" == "True" ] && [ "${{ matrix.config.contracts }}" == "none" ] && [ "${{ matrix.formatting }}" == "std::format" ] && echo "True" || echo "False")" >> $GITHUB_ENV
- name: Install Conan dependencies
shell: bash
run: |
conan install . -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.mp-units.build:all=False \
-o '&:cxx_modules=${{ matrix.config.cxx_modules }}' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}'
-o '&:cxx_modules=${{ matrix.config.cxx_modules }}' -o '&:import_std=${{ env.import_std }}' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}'
- name: Provide dependencies for the build
shell: bash
working-directory: src
Expand Down
11 changes: 7 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from conan.tools.files import copy, load, rmdir
from conan.tools.scm import Version

required_conan_version = ">=2.0.0"
required_conan_version = ">=2.0.15"


class MPUnitsConan(ConanFile):
Expand Down Expand Up @@ -239,7 +239,7 @@ def validate(self):
raise ConanInvalidConfiguration(
"'contracts' should be set to 'none' to use `import std;`"
)
if not self.options.std_format:
if not self.options.get_safe("std_format", default=True):
raise ConanInvalidConfiguration(
"'std_format' should be enabled to use `import std;`"
)
Expand All @@ -252,7 +252,9 @@ def generate(self):
tc.absolute_paths = True # only needed for CMake CI
if self._build_all:
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
tc.cache_variables["CMAKE_VERIFY_INTERFACE_HEADER_SETS"] = True
tc.cache_variables[
"CMAKE_VERIFY_INTERFACE_HEADER_SETS"
] = not self.options.import_std
tc.cache_variables["MP_UNITS_DEV_BUILD_LA"] = not self._skip_la
if self._run_clang_tidy:
tc.cache_variables["MP_UNITS_DEV_CLANG_TIDY"] = True
Expand Down Expand Up @@ -287,7 +289,8 @@ def build(self):
if self._build_all or self.options.cxx_modules:
cmake.build()
if self._build_all:
cmake.build(target="all_verify_interface_header_sets")
if not self.options.import_std:
cmake.build(target="all_verify_interface_header_sets")
if can_run(self):
cmake.ctest(cli_args=["--output-on-failure"])

Expand Down
4 changes: 2 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ if(${projectPrefix}BUILD_CXX_MODULES)
endif()

if(${projectPrefix}BUILD_IMPORT_STD)
target_compile_definitions(mp-units-core PUBLIC ${projectPrefix}IMPORT_STD)
target_compile_definitions(mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}IMPORT_STD)
# https://github.com/llvm/llvm-project/issues/75057
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
target_compile_options(mp-units-core PUBLIC "-Wno-deprecated-declarations")
target_compile_options(mp-units-core ${${projectPrefix}TARGET_SCOPE} "-Wno-deprecated-declarations")
endif()
endif()

Expand Down

0 comments on commit e2829de

Please sign in to comment.