Skip to content

Commit afc49bd

Browse files
committed
update to Conan 2
1 parent 60f5fa6 commit afc49bd

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

_static/conan-docs-logo-2.png

21.5 KB
Loading

_static/conan-docs-logo-2.svg

+1-1
Loading

changelog.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
=========
33

4-
For a more detailed description of the major changes that Conan 2.0 brings, compared with Conan 1.X, please read :ref:`whatsnew`
4+
For a more detailed description of the major changes that Conan 2 brings, compared with Conan 1.X, please read :ref:`whatsnew`
55

66
2.1.0 (15-Feb-2024)
77
-------------------

index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Conan 2.0 - C and C++ Package Manager Documentation
2-
===================================================
1+
Conan 2 - C and C++ Package Manager Documentation
2+
=================================================
33

44
Welcome! This is the user documentation for Conan, an open source, decentralized C/C++ package manager that works in all platforms and with all build systems and compilers. Other relevant resources:
55

installation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ There are different ways to install Conan:
1515
Install with pip (recommended)
1616
------------------------------
1717

18-
To install latest Conan 2.0 pre-release version using ``pip``, you need a Python >= 3.6
18+
To install latest Conan 2 version using ``pip``, you need a Python >= 3.6
1919
distribution installed on your machine. Modern Python distros come with pip pre-installed.
2020
However, if necessary you can install pip by following the instructions in `pip docs`_.
2121

integrations/clion.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Several options are marked as default. Let's review them:
6464

6565
- There's also a checkbox allowing Conan to modify the default CLion settings and run
6666
CMake sequentially instead of in parallel. This is necessary because the Conan cache
67-
isn't concurrent yet in Conan 2.0.
67+
isn't concurrent yet in Conan 2.
6868

6969
If you're using the Conan plugin, you typically wouldn't uncheck these options. After
7070
setting your preferences, click the OK button to finalize the configuration.

reference/conanfile/attributes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ alias
203203

204204
.. warning::
205205

206-
While aliases can technically still be used in Conan 2.0, their usage is not recommended
206+
While aliases can technically still be used in Conan 2, their usage is not recommended
207207
and they may be fully removed in future releases. Users are encouraged to adapt to the
208208
:ref:`newer versioning features<devops_versioning>` for a more standardized and efficient
209209
package management experience.
210210

211-
In Conan 2.0, the `alias` attribute remains a part of the recipe, allowing users to define
211+
In Conan 2, the `alias` attribute remains a part of the recipe, allowing users to define
212212
an alias for a package version. Normally, you would create one using the ``conan new``
213213
command with the ``alias`` template and the exporting the recipe with conan export:
214214

reference/conanfile/attributes/requirements.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ conanfile.py method to learn a more flexible way to add them.
9595
build_requires
9696
--------------
9797
98-
`build_requires` are used in Conan 2.0 to provide compatibility with the Conan 1.X syntax,
98+
`build_requires` are used in Conan 2 to provide compatibility with the Conan 1.X syntax,
9999
but their use is discouraged in Conan 2 and will be deprecated in future 2.X releases.
100100
Please use `tool_requires` instead of `build_requires` in your Conan 2 recipes.
101101

reference/tools/cmake/cmakedeps.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Generated files
7070
- **Other necessary *.cmake**: files like version, flags and directory data or configuration.
7171

7272

73-
Note that it will also generate a **conandeps_legacy.cmake** file. This is a file that provides a behavior similar to the Conan 1 ``cmake`` generator, allowing to include this file with ``include(${CMAKE_BINARY_DIR}/generators/conandeps_legacy.cmake)``, and providing a single CMake ``CONANDEPS_LEGACY`` variable that allows to link with all the direct and transitive dependencies without explicitly enumerating them like: ``target_link_libraries(app ${CONANDEPS_LEGACY})``. This is a convenience provided for Conan 1.X users to upgrade to Conan 2.0 without changing their overall developer flow, but it is not recommended otherwise, and using the CMake canonical flow of explicitly using ``find_package()`` and ``target_link_libraries(... pkg1::pkg1 pkg2::pkg2)`` with targets is the correct approach.
73+
Note that it will also generate a **conandeps_legacy.cmake** file. This is a file that provides a behavior similar to the Conan 1 ``cmake`` generator, allowing to include this file with ``include(${CMAKE_BINARY_DIR}/generators/conandeps_legacy.cmake)``, and providing a single CMake ``CONANDEPS_LEGACY`` variable that allows to link with all the direct and transitive dependencies without explicitly enumerating them like: ``target_link_libraries(app ${CONANDEPS_LEGACY})``. This is a convenience provided for Conan 1.X users to upgrade to Conan 2 without changing their overall developer flow, but it is not recommended otherwise, and using the CMake canonical flow of explicitly using ``find_package()`` and ``target_link_libraries(... pkg1::pkg1 pkg2::pkg2)`` with targets is the correct approach.
7474

7575

7676
Customization

reference/tools/files/packaging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ conan.tools.files AutoPackager
55

66
.. warning::
77

8-
This feature is **deprecated**, and will be removed in future Conan 2.0.X version.
8+
This feature is **deprecated**, and will be removed in future Conan 2.X version.
99
It was used to automatically deduce what to ``copy()`` in the ``package()`` method.
1010

1111
The recommended approach is to use explicit ``copy()`` calls in the ``package()`` method, as explained

whatsnew.rst

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
.. _whatsnew:
22

3-
What's new in Conan 2.0
4-
========================
3+
What's new in Conan 2
4+
=====================
55

6-
Conan 2.0 comes with many exciting improvements based on the lessons learned in the last years with Conan 1.X.
7-
Also, a lot of effort has been made to backport necessary things to Conan 1.X to make the upgrade easier: Recipes using latest 1.X integrations will be compatible with Conan 2.0, and binaries for both versions will not collide and be able to live in the same server repositories.
6+
Conan 2 comes with many exciting improvements based on the lessons learned in the last years with Conan 1.X.
7+
Also, a lot of effort has been made to backport necessary things to Conan 1.X to make the upgrade easier: Recipes using latest 1.X integrations will be compatible with Conan 2, and binaries for both versions will not collide and be able to live in the same server repositories.
88

99

10-
Conan 2.0 migration guide
11-
-------------------------
12-
If you are using Conan 1.X, please read the `Conan 2.0 Migration guide <https://docs.conan.io/en/latest/conan_v2.html>`_ , to start preparing your package recipes to 2.0 and be aware of some changes while you still work in Conan 1.X. That guide summarizes the above mentioned backports to make the upgrade easier.
10+
Conan 2 migration guide
11+
-----------------------
12+
If you are using Conan 1.X, please read the `Conan 2 Migration guide <https://docs.conan.io/en/latest/conan_v2.html>`_ , to start preparing your package recipes to 2.0 and be aware of some changes while you still work in Conan 1.X. That guide summarizes the above mentioned backports to make the upgrade easier.
1313

1414

1515
New graph model
1616
---------------
17-
Conan 2.0 defines new requirement traits (headers, libs, build, run, test, package_id_mode, options, transitive_headers, transitive_libs) and package types (static, shared, application, header-only) to better represent the relations that happen with C and C++ binaries, like executables or shared libraries linking static libraries or shared libraries.
17+
Conan 2 defines new requirement traits (headers, libs, build, run, test, package_id_mode, options, transitive_headers, transitive_libs) and package types (static, shared, application, header-only) to better represent the relations that happen with C and C++ binaries, like executables or shared libraries linking static libraries or shared libraries.
1818

1919
Read more:
2020

@@ -34,7 +34,7 @@ Read more:
3434

3535
New build system integrations
3636
-----------------------------
37-
Introduced in latest Conan 1.X, Conan 2.0 will use modern build system integrations like ``CMakeDeps`` and ``CMakeToolchain`` that are fully transparent CMake integration (i.e. the consuming ``CMakeLists.txt`` doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE integration, for example via CMakePresets.json.
37+
Introduced in latest Conan 1.X, Conan 2 will use modern build system integrations like ``CMakeDeps`` and ``CMakeToolchain`` that are fully transparent CMake integration (i.e. the consuming ``CMakeLists.txt`` doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE integration, for example via CMakePresets.json.
3838

3939
Read more:
4040

@@ -43,12 +43,12 @@ Read more:
4343

4444
New custom user commands
4545
------------------------
46-
Conan 2.0 allows extending Conan with custom user commands, written in python that can be called as ``conan xxxx``. These commands can be shared and installed with ``conan config install``, and have layers of commands and subcommands. The custom user commands use the new 2.0 public Python API to implement their functionality.
46+
Conan 2 allows extending Conan with custom user commands, written in python that can be called as ``conan xxxx``. These commands can be shared and installed with ``conan config install``, and have layers of commands and subcommands. The custom user commands use the new 2.0 public Python API to implement their functionality.
4747

4848

4949
New CLI
5050
-------
51-
Conan 2.0 has redesigned the CLI for better consistency, removing ambiguities, and improving the user experience. The new CLI also sends all the information, warning, and error messages to stderr, while keeping the final result in stdout, allowing multiple output formats like ``--format=html`` or ``--format=json`` and using redirects to create files ``--format=json > myfile.json``. The information provided by the CLI will be more structured and thorough so that it can be used more easily for automation, especially in CI/CD systems.
51+
Conan 2 has redesigned the CLI for better consistency, removing ambiguities, and improving the user experience. The new CLI also sends all the information, warning, and error messages to stderr, while keeping the final result in stdout, allowing multiple output formats like ``--format=html`` or ``--format=json`` and using redirects to create files ``--format=json > myfile.json``. The information provided by the CLI will be more structured and thorough so that it can be used more easily for automation, especially in CI/CD systems.
5252

5353
Read more:
5454

@@ -57,24 +57,24 @@ Read more:
5757

5858
New deployers
5959
-------------
60-
Conan 2.0 implements “deployers”, which can be called in the command line as ``conan install …. --deployer=mydeploy``, typically to perform copy operations from the Conan cache to user folders. Such deployers can be built-in (“full_deploy” and “direct_deploy” are provided so far), or user-defined, which can be shared and managed with ``conan config install``. Deployers run before generators, and they can change the target folders. For example, if the ``--deployer=full_deploy`` deployer runs before ``CMakeDeps``, the files generated by ``CMakeDeps`` will point to the local copy in the user folder done by the ``full_deploy`` deployer, and not to the Conan cache.
60+
Conan 2 implements “deployers”, which can be called in the command line as ``conan install …. --deployer=mydeploy``, typically to perform copy operations from the Conan cache to user folders. Such deployers can be built-in (“full_deploy” and “direct_deploy” are provided so far), or user-defined, which can be shared and managed with ``conan config install``. Deployers run before generators, and they can change the target folders. For example, if the ``--deployer=full_deploy`` deployer runs before ``CMakeDeps``, the files generated by ``CMakeDeps`` will point to the local copy in the user folder done by the ``full_deploy`` deployer, and not to the Conan cache.
6161

6262
Deployers can be multi-configuration. Running ``conan install . --deployer=full_deploy`` repeatedly for different profiles, can achieve a fully self-contained project, including all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build.
6363

6464

6565
New package_id
6666
--------------
67-
Conan 2.0 defines a new, dynamic ``package_id`` that is a great improvement over the limitations of Conan 1.X. This ``package_id`` will take into account the package types and types of requirements to implement a more meaningful strategy, depending on the scenario. For example, it is well known that when an application ``myapp`` is linking a static library ``mylib``, any change in the binary of the static library ``mylib`` requires re-building the application ``myapp``. So Conan will default to a mode like ``full_mode`` that will generate a new ``myapp`` ``package_id``, for every change in the ``mylib`` recipe or binary. While a dependency between a static library ``mylib_a`` that is used by``mylib_b`` in general does not imply that a change in ``mylib_b`` always needs a rebuild of ``mylib_a``, and that relationship can default to a ``minor_mode`` mode. In Conan 2.0, the one doing modifications to ``mylib_a`` can better express whether the consumer ``mylib_b`` needs to rebuild or not, based on the version bump (patch version bump will not trigger a rebuild while a minor version bump will trigger it)
67+
Conan 2 defines a new, dynamic ``package_id`` that is a great improvement over the limitations of Conan 1.X. This ``package_id`` will take into account the package types and types of requirements to implement a more meaningful strategy, depending on the scenario. For example, it is well known that when an application ``myapp`` is linking a static library ``mylib``, any change in the binary of the static library ``mylib`` requires re-building the application ``myapp``. So Conan will default to a mode like ``full_mode`` that will generate a new ``myapp`` ``package_id``, for every change in the ``mylib`` recipe or binary. While a dependency between a static library ``mylib_a`` that is used by``mylib_b`` in general does not imply that a change in ``mylib_b`` always needs a rebuild of ``mylib_a``, and that relationship can default to a ``minor_mode`` mode. In Conan 2, the one doing modifications to ``mylib_a`` can better express whether the consumer ``mylib_b`` needs to rebuild or not, based on the version bump (patch version bump will not trigger a rebuild while a minor version bump will trigger it)
6868

6969
Furthermore the default versioning scheme in Conan has been generalized to any number of digits and letters, as opposed to the official “semver” that uses just 3 fields.
7070

7171
compatibility.py
7272
----------------
73-
Conan 2.0 features a new extension mechanism to define binary compatibility at a global level. A ``compatibility.py`` file in the Conan cache will be used to define which fallbacks of binaries should be used in case there is some missing binary for a given package. Conan will provide a default one to account for ``cppstd`` compatibility, and executables compatibility, but this extension is fully configurable by the user (and can also be shared and managed with ``conan config install``)
73+
Conan 2 features a new extension mechanism to define binary compatibility at a global level. A ``compatibility.py`` file in the Conan cache will be used to define which fallbacks of binaries should be used in case there is some missing binary for a given package. Conan will provide a default one to account for ``cppstd`` compatibility, and executables compatibility, but this extension is fully configurable by the user (and can also be shared and managed with ``conan config install``)
7474

7575
New lockfiles
7676
-------------
77-
Lockfiles in Conan 2.0 have been greatly simplified and made way more flexible. Lockfiles are now modeled as lists of sorted references, which allow one single lockfile being used for multiple configurations, merging lockfiles, applying partially defined lockfiles, being strict or non-strict, adding user defined constraints to lockfiles, and much more.
77+
Lockfiles in Conan 2 have been greatly simplified and made way more flexible. Lockfiles are now modeled as lists of sorted references, which allow one single lockfile being used for multiple configurations, merging lockfiles, applying partially defined lockfiles, being strict or non-strict, adding user defined constraints to lockfiles, and much more.
7878

7979
Read more:
8080

@@ -116,7 +116,7 @@ A new ``sign.py`` extension has been added to implement signing and verifying of
116116

117117
Package immutability optimizations
118118
----------------------------------
119-
The thorough use of ``revisions`` (already introduced in Conan 1.X as opt-in in `<https://docs.conan.io/en/latest/versioning/revisions.html>`_) in Conan 2.0, together with the declaration of artifacts **immutability** allows for improved processes, downloading, installing and updated dependencies as well as uploading dependencies.
119+
The thorough use of ``revisions`` (already introduced in Conan 1.X as opt-in in `<https://docs.conan.io/en/latest/versioning/revisions.html>`_) in Conan 2, together with the declaration of artifacts **immutability** allows for improved processes, downloading, installing and updated dependencies as well as uploading dependencies.
120120

121121
The ``revisions`` allow accurate traceability of artifacts, and thus allows better update flows. For example, it will be easier to get different binaries for different configurations from different repositories, as long as they were created from the same recipe revision.
122122

0 commit comments

Comments
 (0)