mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 20:04:27 +02:00
Merge branch 'master' into chiphogg/sqrt-mag#474
This commit is contained in:
3
.github/workflows/ci-clang-tidy.yml
vendored
3
.github/workflows/ci-clang-tidy.yml
vendored
@@ -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: |
|
||||
|
5
.github/workflows/ci-conan.yml
vendored
5
.github/workflows/ci-conan.yml
vendored
@@ -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
|
||||
|
3
.github/workflows/ci-test-package-cmake.yml
vendored
3
.github/workflows/ci-test-package-cmake.yml
vendored
@@ -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
|
||||
|
11
conanfile.py
11
conanfile.py
@@ -30,7 +30,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
|
||||
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):
|
||||
@@ -239,7 +239,7 @@ class MPUnitsConan(ConanFile):
|
||||
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;`"
|
||||
)
|
||||
@@ -252,7 +252,9 @@ class MPUnitsConan(ConanFile):
|
||||
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
|
||||
@@ -287,7 +289,8 @@ class MPUnitsConan(ConanFile):
|
||||
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"])
|
||||
|
||||
|
@@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user