refactor: 💥 Conan config options renamed to user.mp-units.*

This commit is contained in:
Mateusz Pusz
2024-02-10 12:19:44 +01:00
parent d4dde886cb
commit 862e39ec97
8 changed files with 44 additions and 35 deletions

View File

@ -47,7 +47,7 @@ jobs:
# name: "MSVC 14.2", # name: "MSVC 14.2",
# os: windows-2019, # os: windows-2019,
# compiler: { type: VISUAL, version: 16, cc: "", cxx: "" }, # 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", # name: "MSVC 14.3",
@ -212,7 +212,7 @@ jobs:
run: | run: |
conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \ conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \
-b mp-units/* -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \ -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 - name: Obtain package reference
id: get-package-ref id: get-package-ref
shell: bash shell: bash

View File

@ -205,7 +205,7 @@ jobs:
- name: Install Conan dependencies - name: Install Conan dependencies
shell: bash shell: bash
run: | 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 }} -o cxx_modules=${{ matrix.config.cxx_modules }} -o use_fmtlib=${{ env.use_fmtlib }}
mv CMakeUserPresets.json src mv CMakeUserPresets.json src
- name: Configure mp-units CMake - name: Configure mp-units CMake

View File

@ -105,7 +105,7 @@ jobs:
conan profile detect --force conan profile detect --force
conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
mkdir _lgtm_build_dir && cd _lgtm_build_dir 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 - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v2

View File

@ -71,17 +71,17 @@ tasks:
gp sync-await python-init gp sync-await python-init
conan profile detect conan profile detect
conan config install $PWD/.gitpod/conan 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 -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 -s build_type=Debug
gp sync-done conan-gcc12-20 gp sync-done conan-gcc12-20
conan install . -pr gcc13 -c user.build:all=True -b missing conan install . -pr gcc13 -b missing
conan install . -pr gcc13 -c user.build:all=True -b missing -s build_type=Debug conan install . -pr gcc13 -b missing -s build_type=Debug
gp sync-done conan-gcc13-20 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 -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 -s build_type=Debug
gp sync-done conan-clang16-20 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 -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 -s build_type=Debug
gp sync-done conan-clang17-20 gp sync-done conan-clang17-20
conan remote login -p $ARTIFACTORY_TOKEN conan-gitpod-mp-units $ARTIFACTORY_USER conan remote login -p $ARTIFACTORY_TOKEN conan-gitpod-mp-units $ARTIFACTORY_USER
conan upload "*" -r conan-gitpod-mp-units -c conan upload "*" -r conan-gitpod-mp-units -c
@ -89,29 +89,29 @@ tasks:
init: | init: |
gp sync-await conan-gcc12-20 gp sync-await conan-gcc12-20
source ${PYTHON_VENV}/bin/activate source ${PYTHON_VENV}/bin/activate
conan build . -pr gcc12 -c user.build:all=True -o use_fmtlib=True conan build . -pr gcc12 -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 -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. 🛠️" 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 - name: gcc-13-20
init: | init: |
gp sync-await conan-gcc13-20 gp sync-await conan-gcc13-20
source ${PYTHON_VENV}/bin/activate source ${PYTHON_VENV}/bin/activate
conan build . -pr gcc13 -c user.build:all=True conan build . -pr gcc13
conan build . -pr gcc13 -c user.build:all=True -s build_type=Debug 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. 🛠️" 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 - name: clang-16-20
init: | init: |
gp sync-await conan-clang16-20 gp sync-await conan-clang16-20
source ${PYTHON_VENV}/bin/activate source ${PYTHON_VENV}/bin/activate
conan build . -pr clang16 -c user.build:all=True -o use_fmtlib=True conan build . -pr clang16 -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 -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. 🛠️" 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 - name: clang-17-20
init: | init: |
gp sync-await conan-clang17-20 gp sync-await conan-clang17-20
source ${PYTHON_VENV}/bin/activate source ${PYTHON_VENV}/bin/activate
conan build . -pr clang17 -c user.build:all=True -o cxx_modules=True conan build . -pr clang17 -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 -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. 🛠️" 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 - name: documentation
init: | init: |

View File

@ -1,2 +1,3 @@
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.version", "settings.compiler.cppstd"] tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.version", "settings.compiler.cppstd"]
user.mp-units.build:all=True

View File

@ -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: The simplest way to verify if all targets build correctly and all unit tests pass is to run:
```bash ```bash
conan build . -pr <your_conan_profile> -s compiler.cppstd=23 -o cxx_modules=True -c user.build:all=True -b missing conan build . -pr <your_conan_profile> -s compiler.cppstd=23 -o cxx_modules=True -c user.mp-units.build:all=True -b missing
``` ```
as described in the 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) [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. 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 ### Backward Compatibility
Before submission, please remember to check if the code compiles fine on the supported compilers. Before submission, please remember to check if the code compiles fine on the supported compilers.

View File

@ -83,7 +83,7 @@ class MPUnitsConan(ConanFile):
return { return {
"gcc": "12", "gcc": "12",
"clang": "16", "clang": "16",
"apple-clang": "15" "apple-clang": "15",
# , "msvc": "192" # , "msvc": "192"
} }
@ -91,18 +91,18 @@ class MPUnitsConan(ConanFile):
def _std_format_minimum_compilers_version(self): def _std_format_minimum_compilers_version(self):
return { return {
"gcc": "13", "gcc": "13",
"clang": "17" "clang": "17",
# , "apple-clang": "15" # , "apple-clang": "15"
# , "msvc": "192" # , "msvc": "192"
} }
@property @property
def _build_all(self): 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 @property
def _skip_la(self): 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): def set_version(self):
content = load(self, os.path.join(self.recipe_folder, "src/CMakeLists.txt")) content = load(self, os.path.join(self.recipe_folder, "src/CMakeLists.txt"))

View File

@ -194,9 +194,9 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
### Conan configuration properties ### 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 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). [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) [`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`). 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) [wg21-linear_algebra](https://conan.io/center/recipes/wg21-linear_algebra)
dependency and enables the compilation of linear algebra-based tests and usage examples. dependency and enables the compilation of linear algebra-based tests and usage examples.
Such behavior can be disabled with this option. 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 ### CMake options
@ -453,11 +453,11 @@ In case you would like to build all the **mp-units** source code (with unit test
you should: you should:
1. Use the _CMakeLists.txt_ from the top-level directory. 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 ```shell
git clone https://github.com/mpusz/mp-units.git && cd units git clone https://github.com/mpusz/mp-units.git && cd units
conan build . -pr <your_conan_profile> -s compiler.cppstd=23 -o cxx_modules=True -c user.build:all=True -b missing conan build . -pr <your_conan_profile> -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, 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: To test CMake installation and Conan packaging or create a Conan package run:
```shell ```shell
conan create . --user <username> --channel <channel> -pr <your_conan_profile> -s compiler.cppstd=20 -o cxx_modules=True -c user.build:all=True -b missing conan create . --user <username> --channel <channel> -pr <your_conan_profile> -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. The above will create a Conan package and run tests provided in _./test_package_ directory.