From f5eda4a25b15155ba1d0d8d3588888152210bd87 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 24 Jul 2024 22:44:51 +0200 Subject: [PATCH 1/8] fix: bump minimum conan version required Resolves #600 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 2979b31a..95bded47 100644 --- a/conanfile.py +++ b/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): From d04d546b1759dc0aa053e475f5322fc4f0ec0921 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 10:04:07 +0200 Subject: [PATCH 2/8] fix: `target_compile_definitions` scope fixed for `import std;` --- src/core/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 611bfcc7..ce9db06b 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -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() From 9448ef52b9a5a3ebb5b50407d6e7f6db06d414a1 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 10:25:09 +0200 Subject: [PATCH 3/8] fix: `std_format` Conan option can be removed in `configure` --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 95bded47..3d9f165a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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;`" ) From a8b79ff57fcf12d15125232463f0d1024fe64386 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 10:28:39 +0200 Subject: [PATCH 4/8] ci: `import_std` disabled for CMake CI --- .github/workflows/ci-test-package-cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test-package-cmake.yml b/.github/workflows/ci-test-package-cmake.yml index 4b3cacec..baf58b59 100644 --- a/.github/workflows/ci-test-package-cmake.yml +++ b/.github/workflows/ci-test-package-cmake.yml @@ -235,7 +235,7 @@ jobs: 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=False' -o '&:std_format=${{ env.std_format }}' -o '&:contracts=${{ matrix.contracts }}' - name: Provide dependencies for the build shell: bash working-directory: src From 1788d9616fbc46bb57e81c1c5d68d2d5759afa2c Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 11:20:15 +0200 Subject: [PATCH 5/8] build: CMake's `verify_header_sets` disabled for `import std;` --- conanfile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 3d9f165a..3a8fd5f5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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"]) From 399c939c4f84f724c6d9625922220a1beaab9b33 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 12:01:05 +0200 Subject: [PATCH 6/8] ci: `import_std` conan option is now dynamically deduces from other options --- .github/workflows/ci-conan.yml | 5 +++-- .github/workflows/ci-test-package-cmake.yml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-conan.yml b/.github/workflows/ci-conan.yml index 93241774..52339b35 100644 --- a/.github/workflows/ci-conan.yml +++ b/.github/workflows/ci-conan.yml @@ -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" ])" >> $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 diff --git a/.github/workflows/ci-test-package-cmake.yml b/.github/workflows/ci-test-package-cmake.yml index baf58b59..810fd443 100644 --- a/.github/workflows/ci-test-package-cmake.yml +++ b/.github/workflows/ci-test-package-cmake.yml @@ -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" ])" >> $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 '&:import_std=False' -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 From c7c446250dff74dbcfbcbee723523811015eb420 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 12:21:36 +0200 Subject: [PATCH 7/8] fix: `import_std` setting fixed --- .github/workflows/ci-conan.yml | 2 +- .github/workflows/ci-test-package-cmake.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-conan.yml b/.github/workflows/ci-conan.yml index 52339b35..58df0880 100644 --- a/.github/workflows/ci-conan.yml +++ b/.github/workflows/ci-conan.yml @@ -238,7 +238,7 @@ 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" ])" >> $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: | diff --git a/.github/workflows/ci-test-package-cmake.yml b/.github/workflows/ci-test-package-cmake.yml index 810fd443..df1cae9f 100644 --- a/.github/workflows/ci-test-package-cmake.yml +++ b/.github/workflows/ci-test-package-cmake.yml @@ -231,7 +231,7 @@ 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" ])" >> $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: | From 0850a200cd04208b41b9f0b1a0529a6be99b114f Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Jul 2024 13:13:51 +0200 Subject: [PATCH 8/8] fix: `import_std` setting fixed for clang-tidy --- .github/workflows/ci-clang-tidy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-clang-tidy.yml b/.github/workflows/ci-clang-tidy.yml index 658d3090..a9147356 100644 --- a/.github/workflows/ci-clang-tidy.yml +++ b/.github/workflows/ci-clang-tidy.yml @@ -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: |