PengZheng commented on code in PR #820:
URL: https://github.com/apache/celix/pull/820#discussion_r2846813235
##########
documents/building/README.md:
##########
@@ -69,45 +66,69 @@ sudo apt-get install -yq --no-install-recommends \
ninja-build
#Install conan
-pip3 install -U conan
+pip3 install -U conan
```
-Configure conan default profile using automatic detection of the system
+Configure the Conan default profile using automatic detection of the system:
```bash
conan profile detect
```
-Create Apache Celix package - and build the dependencies - in the Conan cache:
+Conan 2 uses a two-step workflow: first generate the CMake presets and
toolchain files with `conan install`,
+then configure and build with CMake. The project provides convenient presets
when you run `conan install`.
+
+Create a build directory and install dependencies (this will generate
CMakePresets.json / CMakeUserPresets.json in the source or build folder):
+
```bash
cd <celix_source_dir>
-conan create . --build missing -o build_all=True
-#Optionally build with CMake->Ninja, instead of CMake->Make. Note this
includes building dependencies with Ninja.
-conan create . --build missing -o build_all=True -c
tools.cmake.cmaketoolchain:generator=Ninja
+# Create an output folder for the conan-generated files
+conan install . --build=missing --profile:build default --profile:host debug \
+ -o "celix/*:build_all=True" \
+ -o "celix/*:enable_testing=True" \
+ -o "celix/*:enable_ccache=True" \
+ --conf tools.cmake.cmaketoolchain:generator=Ninja
```
-Note installing Apache Celix is not required when using Conan, because Conan
will install the Apache Celix package
-in the local Conan cache.
+Notes:
+- Use `--profile:host debug` or `--profile:host default` depending on the host
(target) profile you want to generate builds for.
+- Replace or add `-o` options to selectively enable/disable bundles (see
below).
+
+Configure and build using the generated CMake preset (Conan will create
presets named like `conan-debug` when
+using `--profile:host debug`, assuming the build_type is `Debug`):
-It is also possible to only build a selection of the Apache Celix bundles
and/or libs. This can be done by providing
-build options for the required parts instead of the `build_all=True` option.
For example to only build the Apache Celix
-framework library and the Apache Celix utils library use the following command:
```bash
-conan create . --build missing -o build_framework=True -o build_utils=True
+# Configure with a conan-generated preset (conan-debug in this case)
+cmake --preset conan-debug
+# Build
+cmake --build build/Debug --parallel
```
-To see a complete overview of the available build options use the following
command:
+When using Conan you typically do not "install" Celix system-wide; Conan
places package artifacts in the local Conan
+cache and the generated build files allow you to produce executables and run
tests.
+
+It is also possible to only build a selection of the Apache Celix bundles
and/or libraries.
+This can be done by passing per-package options instead of building
everything.
+For example, to only build the framework and utils libraries:
+```bash
+conan install . --build=missing --profile:build default --profile:host debug \
+ -o "celix/*:build_framework=True" \
+ -o "celix/*:build_utils=True"
+cmake --preset conan-debug
+cmake --build build/Debug --parallel
Review Comment:
```suggest
cmake --build --preset conan-debug --parallel
```
##########
documents/building/README.md:
##########
@@ -69,45 +66,69 @@ sudo apt-get install -yq --no-install-recommends \
ninja-build
#Install conan
-pip3 install -U conan
+pip3 install -U conan
```
-Configure conan default profile using automatic detection of the system
+Configure the Conan default profile using automatic detection of the system:
```bash
conan profile detect
```
-Create Apache Celix package - and build the dependencies - in the Conan cache:
+Conan 2 uses a two-step workflow: first generate the CMake presets and
toolchain files with `conan install`,
+then configure and build with CMake. The project provides convenient presets
when you run `conan install`.
+
+Create a build directory and install dependencies (this will generate
CMakePresets.json / CMakeUserPresets.json in the source or build folder):
+
```bash
cd <celix_source_dir>
-conan create . --build missing -o build_all=True
-#Optionally build with CMake->Ninja, instead of CMake->Make. Note this
includes building dependencies with Ninja.
-conan create . --build missing -o build_all=True -c
tools.cmake.cmaketoolchain:generator=Ninja
+# Create an output folder for the conan-generated files
+conan install . --build=missing --profile:build default --profile:host debug \
+ -o "celix/*:build_all=True" \
+ -o "celix/*:enable_testing=True" \
+ -o "celix/*:enable_ccache=True" \
+ --conf tools.cmake.cmaketoolchain:generator=Ninja
```
-Note installing Apache Celix is not required when using Conan, because Conan
will install the Apache Celix package
-in the local Conan cache.
+Notes:
+- Use `--profile:host debug` or `--profile:host default` depending on the host
(target) profile you want to generate builds for.
+- Replace or add `-o` options to selectively enable/disable bundles (see
below).
+
+Configure and build using the generated CMake preset (Conan will create
presets named like `conan-debug` when
+using `--profile:host debug`, assuming the build_type is `Debug`):
-It is also possible to only build a selection of the Apache Celix bundles
and/or libs. This can be done by providing
-build options for the required parts instead of the `build_all=True` option.
For example to only build the Apache Celix
-framework library and the Apache Celix utils library use the following command:
```bash
-conan create . --build missing -o build_framework=True -o build_utils=True
+# Configure with a conan-generated preset (conan-debug in this case)
+cmake --preset conan-debug
+# Build
+cmake --build build/Debug --parallel
```
-To see a complete overview of the available build options use the following
command:
+When using Conan you typically do not "install" Celix system-wide; Conan
places package artifacts in the local Conan
+cache and the generated build files allow you to produce executables and run
tests.
+
+It is also possible to only build a selection of the Apache Celix bundles
and/or libraries.
+This can be done by passing per-package options instead of building
everything.
+For example, to only build the framework and utils libraries:
+```bash
+conan install . --build=missing --profile:build default --profile:host debug \
+ -o "celix/*:build_framework=True" \
+ -o "celix/*:build_utils=True"
+cmake --preset conan-debug
+cmake --build build/Debug --parallel
Review Comment:
```suggestion
cmake --build --preset conan-debug --parallel
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]