From 862e39ec9724c66bdead0d8a0368174f44211288 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sat, 10 Feb 2024 12:19:44 +0100 Subject: [PATCH] refactor: :boom: Conan config options renamed to `user.mp-units.*` --- .github/workflows/ci-conan.yml | 4 +-- .github/workflows/ci-test-package-cmake.yml | 2 +- .github/workflows/codeql.yml | 2 +- .gitpod.yml | 32 +++++++++---------- .gitpod/conan/global.conf | 1 + CONTRIBUTING.md | 10 +++++- conanfile.py | 8 ++--- .../getting_started/installation_and_usage.md | 20 ++++++------ 8 files changed, 44 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci-conan.yml b/.github/workflows/ci-conan.yml index 52b4955c..6a154b8b 100644 --- a/.github/workflows/ci-conan.yml +++ b/.github/workflows/ci-conan.yml @@ -47,7 +47,7 @@ jobs: # name: "MSVC 14.2", # os: windows-2019, # compiler: { type: VISUAL, version: 16, cc: "", cxx: "" }, - # conan-config: "-c user.build:skip_la=True", + # conan-config: "-c user.mp-units.build:skip_la=True", # } # - { # name: "MSVC 14.3", @@ -212,7 +212,7 @@ jobs: 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.build:all=True -o cxx_modules=${{ matrix.config.cxx_modules }} -o use_fmtlib=${{ env.use_fmtlib }} ${{ matrix.config.conan-config }} + -c user.mp-units.build:all=True -o cxx_modules=${{ matrix.config.cxx_modules }} -o use_fmtlib=${{ env.use_fmtlib }} ${{ 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 a24bbefb..82000cb9 100644 --- a/.github/workflows/ci-test-package-cmake.yml +++ b/.github/workflows/ci-test-package-cmake.yml @@ -205,7 +205,7 @@ jobs: - name: Install Conan dependencies shell: bash run: | - conan install . -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.build:all=False \ + 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 use_fmtlib=${{ env.use_fmtlib }} mv CMakeUserPresets.json src - name: Configure mp-units CMake diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d8464ae8..6f29802c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -105,7 +105,7 @@ jobs: conan profile detect --force conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss mkdir _lgtm_build_dir && cd _lgtm_build_dir - conan build .. -s compiler.cppstd=20 -c user.build:all=True -o use_fmtlib=True -b missing + conan build .. -s compiler.cppstd=20 -c user.mp-units.build:all=True -o use_fmtlib=True -b missing - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.gitpod.yml b/.gitpod.yml index 82da5910..155b6c8a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -71,17 +71,17 @@ tasks: gp sync-await python-init conan profile detect conan config install $PWD/.gitpod/conan - conan install . -pr gcc12 -c user.build:all=True -o use_fmtlib=True -b missing - conan install . -pr gcc12 -c user.build:all=True -o use_fmtlib=True -b missing -s build_type=Debug + conan install . -pr gcc12 -o use_fmtlib=True -b missing + conan install . -pr gcc12 -o use_fmtlib=True -b missing -s build_type=Debug gp sync-done conan-gcc12-20 - conan install . -pr gcc13 -c user.build:all=True -b missing - conan install . -pr gcc13 -c user.build:all=True -b missing -s build_type=Debug + conan install . -pr gcc13 -b missing + conan install . -pr gcc13 -b missing -s build_type=Debug gp sync-done conan-gcc13-20 - conan install . -pr clang16 -c user.build:all=True -o use_fmtlib=True -b missing - conan install . -pr clang16 -c user.build:all=True -o use_fmtlib=True -b missing -s build_type=Debug + conan install . -pr clang16 -o use_fmtlib=True -b missing + conan install . -pr clang16 -o use_fmtlib=True -b missing -s build_type=Debug gp sync-done conan-clang16-20 - conan install . -pr clang17 -c user.build:all=True -o cxx_modules=True -b missing - conan install . -pr clang17 -c user.build:all=True -o cxx_modules=True -b missing -s build_type=Debug + conan install . -pr clang17 -o cxx_modules=True -b missing + conan install . -pr clang17 -o cxx_modules=True -b missing -s build_type=Debug gp sync-done conan-clang17-20 conan remote login -p $ARTIFACTORY_TOKEN conan-gitpod-mp-units $ARTIFACTORY_USER conan upload "*" -r conan-gitpod-mp-units -c @@ -89,29 +89,29 @@ tasks: init: | gp sync-await conan-gcc12-20 source ${PYTHON_VENV}/bin/activate - conan build . -pr gcc12 -c user.build:all=True -o use_fmtlib=True - conan build . -pr gcc12 -c user.build:all=True -o use_fmtlib=True -s build_type=Debug + conan build . -pr gcc12 -o use_fmtlib=True + conan build . -pr gcc12 -o use_fmtlib=True -s build_type=Debug echo "🛠️ gcc-12 pre-build done for C++20, header files, and libfmt! You can close this terminal and use 'Build' button in the VSCode status bar for incremental builds. 🛠️" - name: gcc-13-20 init: | gp sync-await conan-gcc13-20 source ${PYTHON_VENV}/bin/activate - conan build . -pr gcc13 -c user.build:all=True - conan build . -pr gcc13 -c user.build:all=True -s build_type=Debug + conan build . -pr gcc13 + conan build . -pr gcc13 -s build_type=Debug echo "🛠️ gcc-13 pre-build done for C++20 and header files! You can close this terminal and use 'Build' button in the VSCode status bar for incremental builds. 🛠️" - name: clang-16-20 init: | gp sync-await conan-clang16-20 source ${PYTHON_VENV}/bin/activate - conan build . -pr clang16 -c user.build:all=True -o use_fmtlib=True - conan build . -pr clang16 -c user.build:all=True -o use_fmtlib=True -s build_type=Debug + conan build . -pr clang16 -o use_fmtlib=True + conan build . -pr clang16 -o use_fmtlib=True -s build_type=Debug echo "🛠️ clang-16 pre-build done for C++20, header files, and libfmt! You can close this terminal and use 'Build' button in the VSCode status bar for incremental builds. 🛠️" - name: clang-17-20 init: | gp sync-await conan-clang17-20 source ${PYTHON_VENV}/bin/activate - conan build . -pr clang17 -c user.build:all=True -o cxx_modules=True - conan build . -pr clang17 -c user.build:all=True -o cxx_modules=True -s build_type=Debug + conan build . -pr clang17 -o cxx_modules=True + conan build . -pr clang17 -o cxx_modules=True -s build_type=Debug echo "🛠️ clang-17 pre-build done for C++20! You can close this terminal and use 'Build' button in the VSCode status bar for incremental builds. 🛠️" - name: documentation init: | diff --git a/.gitpod/conan/global.conf b/.gitpod/conan/global.conf index 6840876c..29ce8bd5 100644 --- a/.gitpod/conan/global.conf +++ b/.gitpod/conan/global.conf @@ -1,2 +1,3 @@ tools.cmake.cmaketoolchain:generator=Ninja Multi-Config tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.version", "settings.compiler.cppstd"] +user.mp-units.build:all=True diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 32f4730b..ae27af60 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,13 +56,21 @@ After the script is done please make sure to stage all those changes to git comm The simplest way to verify if all targets build correctly and all unit tests pass is to run: ```bash -conan build . -pr -s compiler.cppstd=23 -o cxx_modules=True -c user.build:all=True -b missing +conan build . -pr -s compiler.cppstd=23 -o cxx_modules=True -c user.mp-units.build:all=True -b missing ``` as described in the [Installation and Usage](https://mpusz.github.io/mp-units/latest/getting_started/installation_and_usage/#contributing-or-just-building-all-the-tests-and-examples) chapter of our documentation. +_Hint:_ To ensure that that we always build all the targets and to save some typing of the Conan commands, +it is a good practice to set the following in the `~/.conan2/global.conf`: + +```text +user.mp-units.build:all=True +``` + + ### Backward Compatibility Before submission, please remember to check if the code compiles fine on the supported compilers. diff --git a/conanfile.py b/conanfile.py index 2825223b..aab04f5c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -83,7 +83,7 @@ class MPUnitsConan(ConanFile): return { "gcc": "12", "clang": "16", - "apple-clang": "15" + "apple-clang": "15", # , "msvc": "192" } @@ -91,18 +91,18 @@ class MPUnitsConan(ConanFile): def _std_format_minimum_compilers_version(self): return { "gcc": "13", - "clang": "17" + "clang": "17", # , "apple-clang": "15" # , "msvc": "192" } @property def _build_all(self): - return bool(self.conf.get("user.build:all", default=False)) + return bool(self.conf.get("user.mp-units.build:all", default=False)) @property def _skip_la(self): - return bool(self.conf.get("user.build:skip_la", default=False)) + return bool(self.conf.get("user.mp-units.build:skip_la", default=False)) def set_version(self): content = load(self, os.path.join(self.recipe_folder, "src/CMakeLists.txt")) diff --git a/docs/getting_started/installation_and_usage.md b/docs/getting_started/installation_and_usage.md index 0ebf89c6..1dca2e2a 100644 --- a/docs/getting_started/installation_and_usage.md +++ b/docs/getting_started/installation_and_usage.md @@ -194,9 +194,9 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"} ### Conan configuration properties -[`user.build:all`](#user-build-all){ #user-build-all } +[`user.mp-units.build:all`](#user.mp-units.build-all){ #user.mp-units.build-all } -: [:octicons-tag-24: 0.8.0][build all support] · :octicons-milestone-24: `True`/`False` (Default: `False`) +: [:octicons-tag-24: 2.2.0][build all support] · :octicons-milestone-24: `True`/`False` (Default: `False`) Enables compilation of all the source code, including tests and examples. To support this, it requires some additional Conan build dependencies described in [Repository Structure and Dependencies](#repository-structure-and-dependencies). @@ -204,19 +204,19 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"} [`tools.build:skip_test`](https://docs.conan.io/2/reference/commands/config.html?highlight=tools.build:skip_test#conan-config-list) configuration property is set to `True`). - [build all support]: https://github.com/mpusz/mp-units/releases/tag/v0.8.0 + [build all support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 -[`user.build:skip_la`](#user-skip-la){ #user-skip-la } +[`user.mp-units.build:skip_la`](#user-skip-la){ #user-skip-la } -: [:octicons-tag-24: 0.8.0][skip la support] · :octicons-milestone-24: `True`/`False` (Default: `False`) +: [:octicons-tag-24: 2.2.0][skip la support] · :octicons-milestone-24: `True`/`False` (Default: `False`) - If `user.build:all` is enabled, among others, Conan installs the external + If `user.mp-units.build:all` is enabled, among others, Conan installs the external [wg21-linear_algebra](https://conan.io/center/recipes/wg21-linear_algebra) dependency and enables the compilation of linear algebra-based tests and usage examples. Such behavior can be disabled with this option. - [skip la support]: https://github.com/mpusz/mp-units/releases/tag/v0.8.0 + [skip la support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 ### CMake options @@ -453,11 +453,11 @@ In case you would like to build all the **mp-units** source code (with unit test you should: 1. Use the _CMakeLists.txt_ from the top-level directory. -2. Run Conan with [`user.build:all`](#user-build-all) = `True`. +2. Run Conan with [`user.mp-units.build:all`](#user.mp-units.build-all) = `True`. ```shell git clone https://github.com/mpusz/mp-units.git && cd units -conan build . -pr -s compiler.cppstd=23 -o cxx_modules=True -c user.build:all=True -b missing +conan build . -pr -s compiler.cppstd=23 -o cxx_modules=True -c user.mp-units.build:all=True -b missing ``` The above will download and install all of the dependencies needed for the development of the library, @@ -504,7 +504,7 @@ After that, you can either: To test CMake installation and Conan packaging or create a Conan package run: ```shell -conan create . --user --channel -pr -s compiler.cppstd=20 -o cxx_modules=True -c user.build:all=True -b missing +conan create . --user --channel -pr -s compiler.cppstd=20 -o cxx_modules=True -c user.mp-units.build:all=True -b missing ``` The above will create a Conan package and run tests provided in _./test_package_ directory.