Skip to content

Commit

Permalink
Merge pull request #2897 from conan-io/release/1.57.0
Browse files Browse the repository at this point in the history
Conan 1.57.0 docs
  • Loading branch information
czoido authored Jan 12, 2023
2 parents 7e80e46 + a411a86 commit 09be234
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 75 deletions.
1 change: 1 addition & 0 deletions .ci/publish.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// TODO: Move to a file and avoid modifying CI script
Map<String, String> versions = [
'release/1.57.0': '1.57',
'release/1.56.0': '1.56',
'release/1.55.0': '1.55',
'release/1.54.0': '1.54',
Expand Down
21 changes: 21 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ Check https://github.com/conan-io/conan for issues and more details about develo
Conan 1.56 shouldn't break any existing 1.0 recipe or command line invocation. If it does, please submit
a report on GitHub. Read more about the :ref:`Conan stability commitment<stability>`.

1.57.0 (12-Jan-2023)
--------------------

- Feature: AutotoolsToolchain helper functions: `update_configure_args`, `update_make_args`, and `update_autoreconf_args` can also add new values `#12889 <https://github.com/conan-io/conan/pull/12889>`_ . Docs `here <https://github.com/conan-io/docs/pull/2895>`__
- Feature: Add `unix_path_package_info_legacy` function for those cases in which it is used in `package_info` in recipes that require compatibility with Conan 1.x. In Conan 2, path conversions should not be performed in the `package_info` method. `#12887 <https://github.com/conan-io/conan/pull/12887>`_ . Docs `here <https://github.com/conan-io/docs/pull/2894>`__
- Feature: Added to AutotoolsToolchain helper functions: `update_configure_args`, `update_make_args`, and `update_autoreconf_args` to update/prune flags effortlessly. `#12884 <https://github.com/conan-io/conan/pull/12884>`_ . Docs `here <https://github.com/conan-io/docs/pull/2895>`__
- Feature: Allow skip the generation of conanvcvars.bat with empty ``tools.microsoft.msbuild:installation_path`` `#12882 <https://github.com/conan-io/conan/pull/12882>`_ . Docs `here <https://github.com/conan-io/docs/pull/2892>`__
- Feature: Adds new `raise_invalid` argument for `check_min_vs` to avoid raising if the check fails. `#12880 <https://github.com/conan-io/conan/pull/12880>`_ . Docs `here <https://github.com/conan-io/docs/pull/2890>`__
- Feature: Adds a conf variable for supplying linker scripts to the linker using the `-T` flag. `#12854 <https://github.com/conan-io/conan/pull/12854>`_ . Docs `here <https://github.com/conan-io/docs/pull/2887>`__
- Feature: CMakeToolchain also write CMake Test Presets. `#12846 <https://github.com/conan-io/conan/pull/12846>`_ . Docs `here <https://github.com/conan-io/docs/pull/2889>`__
- Feature: Add the ability to provide a `--component` argument with the `cmake.install` function. `#12762 <https://github.com/conan-io/conan/pull/12762>`_ . Docs `here <https://github.com/conan-io/docs/pull/2893>`__
- Fix: `AutotoolsToolchain.configure_args` are adequately initialized. `#12884 <https://github.com/conan-io/conan/pull/12884>`_ . Docs `here <https://github.com/conan-io/docs/pull/2895>`__
- Fix: Deprecate ``c++2a`` for gcc 12, replace with ``c++20``. `#12796 <https://github.com/conan-io/conan/pull/12796>`_
- Bugfix: `AutotoolsToolchain.configure_args` was overwriting Conan's pre-calculated arguments. `#12884 <https://github.com/conan-io/conan/pull/12884>`_ . Docs `here <https://github.com/conan-io/docs/pull/2895>`__
- Bugfix: Fix ``remove_broken_symlinks`` failing at relative paths symlinks. `#12876 <https://github.com/conan-io/conan/pull/12876>`_
- Bugfix: Fix KeyError 'buildPresets', the field is optional according to the specification. `#12874 <https://github.com/conan-io/conan/pull/12874>`_
- Bugfix: Fix bug to pass a valid GNU triplet when using AutotoolsToolchain and cross-building on Windows. `#12870 <https://github.com/conan-io/conan/pull/12870>`_
- Bugfix: Fix XcodeDeps in "editable" mode root package_folder=None. `#12841 <https://github.com/conan-io/conan/pull/12841>`_
- Bugfix: Make ``cmake_layout`` to use single-config folder for generated files. `#12829 <https://github.com/conan-io/conan/pull/12829>`_ . Docs `here <https://github.com/conan-io/docs/pull/2891>`__
- Bugfix: Allow ``compatibility()`` for lockfiles. `#12778 <https://github.com/conan-io/conan/pull/12778>`_

1.56.0 (21-Dec-2022)
--------------------

Expand Down
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
]

# The short X.Y version.
version = "1.56"
version = "1.57"
# The full version, including alpha/beta/rc tags.
release = u'1.56.0'
release = u'1.57.0'

dir_path = os.path.dirname(os.path.realpath(__file__))
if not os.path.exists(os.path.join(dir_path, "versions.json")):
Expand Down
2 changes: 1 addition & 1 deletion creating_packages/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Let's explain a little bit about this recipe:
the Conan ``settings`` and ``options`` to CMake syntax.

- The ``build()`` method uses the ``CMake`` wrapper to call CMake commands, it is a thin layer that will manage
to pass in this case the ``-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake`` argument, plus other possible arguments,
to pass in this case the ``-DCMAKE_TOOLCHAIN_FILE=<path>/conan_toolchain.cmake`` argument, plus other possible arguments,
like ``-DCMAKE_BUILD_TYPE=<config>`` if necessary. It will configure the project and build it from source. The actual
arguments that will be used are obtained from a generated ``CMakePresets.json`` file.

Expand Down
4 changes: 2 additions & 2 deletions developing_packages/editable_packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Now the ``say/0.1@user/channel`` package is in editable mode, lets build it loca
# Linux, we will only build 1 configuration
$ conan install .
$ cd build/Release
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
$ cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
$ cmake --build .
Expand Down Expand Up @@ -114,7 +114,7 @@ In this case we can build the ``hello`` application as usual:
# Linux, we will only build 1 configuration
$ conan install .
$ cd build/Release
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
$ cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
$ cmake --build .
$ ./hello
say/0.1: Hello World Release!
Expand Down
58 changes: 12 additions & 46 deletions integrations/cross_platform/android.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ Use a regular profile for the *host* context:
compiler.libcxx=c++_shared
build_type=Release
and add Android NDK to the ``PATH`` or populate the ``CONAN_CMAKE_ANDROID_NDK`` environment variable.
[conf]
tools.android:ndk_path=<path/to/myandroid/ndk>
Together with the files created by the generators that make it possible to find and link the
requirements, :command:`conan install` command will generate a toolchain file like the following one:
Expand All @@ -119,16 +121,17 @@ requirements, :command:`conan install` command will generate a toolchain file li
set(CMAKE_SYSTEM_VERSION 23)
set(CMAKE_ANDROID_ARCH_ABI x86_64)
set(CMAKE_ANDROID_STL_TYPE c++_shared)
set(CMAKE_ANDROID_NDK <path/provided/via/environment/variable>)
set(CMAKE_ANDROID_NDK <path/to/myandroid/ndk>)
With this toolchain file you can execute CMake's command to generate the binaries:

.. code-block:: bash
conan install <conanfile> --profile:host=profile_host --profile:build=default
cmake . -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cd build/Release
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
Using Docker images
Expand Down Expand Up @@ -198,7 +201,11 @@ However, when building CMake projects, there are several approaches available, a
Using toolchain from Android NDK
--------------------------------

This is the official way recommended by Android developers.
.. warning::

This method is deprecated. Use the one above using ``CMakeToolchain``, the generated ``conan_toolchain.cmake``
and the conf ``tools.android:ndk_path=<path/to/myandroid/ndk>``


For this, you will need a small CMake toolchain file:

Expand Down Expand Up @@ -232,46 +239,5 @@ And then, you may use the following profile:
In the profile, ``CONAN_CMAKE_TOOLCHAIN_FILE`` points to the CMake toolchain file listed above.


Using CMake built-in Android NDK support
----------------------------------------

.. warning::

This workflow is not supported by Android and is often broken with new NDK releases or when using older versions of CMake.
This workflow is **strongly discouraged** and will not work with Gradle.

For this approach, you don't need to specify CMake toolchain file at all. It's enough to indicate ``os`` is Android
and Conan will automatically set up all required CMake
`variables <https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-android>`__ for you.

Therefore, the following conan profile could be used for ``ARMv8``:

.. code-block:: text
include(default)
[settings]
arch=armv8
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=7.0
os=Android
os.api_level=21
[tool_requires]
[options]
[env]
ANDROID_NDK_ROOT=/home/conan/android-ndk-r18b
The only way you have to configure is ``ANDROID_NDK_ROOT`` which is a path to the Android NDK installation.

Once profile is configured, you should see the following output during the CMake build:

.. code-block:: text
-- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected Clang toolchain 'aarch64-linux-android-clang' with GCC toolchain 'aarch64-linux-android-4.9'
It means native CMake integration has successfully found Android NDK and configured the build.

.. |android_logo| image:: ../../images/android_logo.png
:width: 180px
14 changes: 11 additions & 3 deletions migrating_to_2.0/recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,18 @@ other build systems, even a custom one, remember you should generate everything
If we are using that recipe for our project we can build it by typing:

.. code-block:: bash
$ conan install .
# This will generate the config files from the dependencies and the toolchain
$ cmake . -DCMAKE_TOOLCHAIN_FILE=./cmake-build-release/conan/conan_toolchain.cmake
$ conan install .
# Windows
$ cd build
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
$ cmake --build . --config=Release
# Linux
$ cd build/Release
$ cmake ../.. -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
$ cmake --build .
You can check all the generators and toolchains for different build systems in the :ref:`tools reference page<conan_tools>`.
Expand Down
7 changes: 4 additions & 3 deletions reference/conanfile/tools/cmake/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Available since: `1.32.0 <https://github.com/conan-io/conan/releases/tag/1.32.0>

The ``CMake`` build helper is a wrapper around the command line invocation of cmake. It will abstract the
calls like ``cmake --build . --config Release`` into Python method calls. It will also add the argument
``-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake`` to the ``configure()`` call, as well as other possible
``-DCMAKE_TOOLCHAIN_FILE=<path>/conan_toolchain.cmake`` to the ``configure()`` call, as well as other possible
arguments like ``-DCMAKE_BUILD_TYPE=<config>``. The arguments that will be used are obtained from a
generated ``CMakePresets.json`` file.

Expand Down Expand Up @@ -68,7 +68,7 @@ configure()
Reads the ``CMakePresets.json`` file generated by the :ref:`CMakeToolchain<conan-cmake-toolchain>` to get:

- The generator, to append ``-G="xxx"``.
- The path to the toolchain and append ``-DCMAKE_TOOLCHAIN_FILE=/path/conan_toolchain.cmake``
- The path to the toolchain and append ``-DCMAKE_TOOLCHAIN_FILE=<path>/conan_toolchain.cmake``
- The declared ``cache variables`` and append ``-Dxxx``.
- ``build_script_folder``: Relative path to the folder containing the root *CMakeLists.txt*
- ``cli_args``: List of extra arguments provided when calling to CMake.
Expand Down Expand Up @@ -110,14 +110,15 @@ install()

.. code:: python
def install(self, build_type=None):
def install(self, build_type=None, component=None):
Equivalent to run ``cmake --build . --target=install``

- ``build_type``: Use it only to override the value defined in the ``settings.build_type``. It
can fail if the build is single configuration (e.g. Unix Makefiles), as in that case the build
type must be specified at configure time, not build type.
- ``component``: Passes the ``--component=<component>`` argument to the CMake install command.


test()
Expand Down
2 changes: 1 addition & 1 deletion reference/conanfile/tools/cmake/cmakedeps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,4 @@ tell CMake how to map the configurations from the current project to the importe
cd build-coverage/
conan install .. -s build_type=Debug
cmake .. -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_MAP_IMPORTED_CONFIG_COVERAGE=Debug
cmake .. -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_TOOLCHAIN_FILE=<path>/conan_toolchain.cmake -DCMAKE_MAP_IMPORTED_CONFIG_COVERAGE=Debug
32 changes: 21 additions & 11 deletions reference/conanfile/tools/cmake/cmaketoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CMakeToolchain
Available since: `1.32.0 <https://github.com/conan-io/conan/releases/tag/1.32.0>`_

The ``CMakeToolchain`` is the toolchain generator for CMake. It will generate toolchain files that can be used in the
command line invocation of CMake with the ``-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake``. This generator translates
command line invocation of CMake with the ``-DCMAKE_TOOLCHAIN_FILE=<path>/conan_toolchain.cmake``. This generator translates
the current package configuration, settings, and options, into CMake toolchain syntax.


Expand Down Expand Up @@ -294,19 +294,17 @@ with local development flows, than when the package is created in the cache.

.. code:: bash
# Lets start in the folder containing the conanfile.py
$ mkdir build && cd build
# Install both debug and release deps and create the toolchain
$ conan install ..
$ conan install .. -s build_type=Debug
# the conan_toolchain.cmake is common for both configurations
$ conan install .
$ conan install . -s build_type=Debug
If you are using a multi-configuration generator:
If you are using a multi-configuration generator (e.g. Windows MSVC):

.. code:: bash
$ cd build
# Need to pass the generator WITHOUT the platform, that matches your default settings
$ cmake .. -G "Visual Studio 15" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
$ cmake .. -G "Visual Studio 15" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
# Now you can open the IDE, select Debug or Release config and build
# or, in the command line
$ cmake --build . --config Release
Expand All @@ -321,13 +319,14 @@ If you are using a single-configuration generator:

.. code:: bash
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
$ cmake --build
$ cd build/Release
$ cmake ../.. -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
$ cmake --build .
It is recommended to use the ``cmake_layout(self)`` in the ``layout()`` method of your ``conanfile.py``. If a layout
is declared, the ``CMakeUserPresets.json`` file will be generated in the same folder of your ``CMakeLists.txt`` file,
so you can use the ``--preset`` argument from ``cmake >= 3.23`` or use an IDE:
so you can use the ``--preset`` argument for configuring, building, and testing from ``cmake >= 3.23`` or use an IDE:


.. code:: bash
Expand All @@ -339,13 +338,20 @@ so you can use the ``--preset`` argument from ``cmake >= 3.23`` or use an IDE:
# For single-configuration generator
$ cmake --preset debug
$ cmake --build --preset debug
$ ctest --preset debug
$ cmake --preset release
$ cmake --build --preset release
$ ctest --preset release
# For multi-configuration generator
$ cmake --preset default
$ cmake --build --preset debug
$ ctest --preset debug
$ cmake --build --preset release
$ ctest --preset release
conf
Expand All @@ -368,6 +374,9 @@ conf
- ``tools.build:sharedlinkflags`` list of extra linker flags that will be appended to ``CMAKE_SHARED_LINKER_FLAGS_INIT``.
- ``tools.build:exelinkflags`` list of extra linker flags that will be appended to ``CMAKE_EXE_LINKER_FLAGS_INIT``.
- ``tools.build:defines`` list of preprocessor definitions that will be used by ``add_definitions()``.
- ``tools.build:linker_scripts`` list of linker scripts, each of which will be prepended with ``-T`` and appended to
``CMAKE_EXE_LINKER_FLAGS_INIT``. Only use this flag with linkers that supports specifying linker scripts with the ``-T`` flag, such as
``ld``, ``gold``, and ``lld``.
- ``tools.build:tools.apple:enable_bitcode`` boolean value to enable/disable Bitcode Apple Clang flags, e.g., ``CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE``.
- ``tools.build:tools.apple:enable_arc`` boolean value to enable/disable ARC Apple Clang flags, e.g., ``CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC``.
- ``tools.build:tools.apple:enable_visibility`` boolean value to enable/disable Visibility Apple Clang flags, e.g., ``CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN``.
Expand Down Expand Up @@ -406,6 +415,7 @@ The following predefined blocks are available, and added in this order:
- ``apple_system``: Defines ``CMAKE_OSX_ARCHITECTURES``, ``CMAKE_OSX_SYSROOT`` for Apple systems.
- ``fpic``: Defines the ``CMAKE_POSITION_INDEPENDENT_CODE`` when there is a ``options.fPIC``
- ``arch_flags``: Defines C/C++ flags like ``-m32, -m64`` when necessary.
- ``linker_scripts``: Defines the flags for any provided linker scripts.
- ``libcxx``: Defines ``-stdlib=libc++`` flag when necessary as well as ``_GLIBCXX_USE_CXX11_ABI``.
- ``vs_runtime``: Defines the ``CMAKE_MSVC_RUNTIME_LIBRARY`` variable, as a generator expression for multiple configurations.
- ``cppstd``: defines ``CMAKE_CXX_STANDARD``, ``CMAKE_CXX_EXTENSIONS``
Expand Down
Loading

0 comments on commit 09be234

Please sign in to comment.