-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3237 from conan-io/release/2.0
Update develop2 with Release/2.0
- Loading branch information
Showing
14 changed files
with
270 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.. _examples_extensions_builtin_deployers: | ||
|
||
|
||
Builtin deployers | ||
================= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
dev/development_deploy |
134 changes: 134 additions & 0 deletions
134
examples/extensions/deployers/dev/development_deploy.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
.. _examples_extensions_builtin_deployers_development: | ||
|
||
|
||
Creating a Conan-agnostic deploy of dependencies for developer use | ||
================================================================== | ||
|
||
With the ``full_deploy`` deployer it is possible to create a Conan-agnostic copy of dependencies that can be used by developers without even having Conan installed in their computers. | ||
|
||
Let's see it with an example. All the source code is in the | ||
`examples2.0 Github repository <https://github.com/conan-io/examples2>`_ | ||
|
||
.. code-block:: bash | ||
$ git clone https://github.com/conan-io/examples2.git | ||
$ cd examples2/examples/extensions/deployers/development_deploy | ||
In the folder we can find the following ``conanfile.txt``: | ||
|
||
.. code-block:: ini | ||
[requires] | ||
zlib/1.2.13 | ||
[tool_requires] | ||
cmake/3.25.3 | ||
[generators] | ||
CMakeDeps | ||
CMakeToolchain | ||
[layout] | ||
cmake_layout | ||
The folder also contains a standard ``CMakeLists.txt`` and a ``main.cpp`` source file that can create | ||
an executable that links with ``zlib`` library. | ||
|
||
We can install the Debug and Release dependencies, and deploy a local copy of the packages with: | ||
|
||
.. code-block:: bash | ||
$ conan install . --deploy=full_deploy --build=missing | ||
$ conan install . --deploy=full_deploy -s build_type=Debug --build=missing | ||
This will create the following folders: | ||
|
||
.. code-block:: text | ||
├──src | ||
├──build | ||
│ ├──generators | ||
| └── ZLibConfig.cmake | ||
├──full_deploy | ||
│ ├──build | ||
│ │ └──cmake | ||
│ │ └──3.25.3 | ||
│ │ └──x86_64 | ||
│ │ ├──bin | ||
│ │ | ||
│ └──host | ||
│ └──zlib | ||
│ └──1.2.13 | ||
│ ├──Debug | ||
│ │ └──x86_64 | ||
│ │ ├──include | ||
│ │ ├──lib | ||
│ └──Release | ||
│ └──x86_64 | ||
│ ├──include | ||
│ ├──lib | ||
This folder is fully self-contained. It contains both the necessary tools (like ``cmake`` executable), the headers and compiled libraries of ``zlib`` and the necessary files like ``ZLibConfig.cmake`` in the ``build/generators`` folder, that point to the binaries inside ``full_deploy`` with a relative path. | ||
|
||
The Conan cache can be removed, and even Conan uninstalled, then the folder could be moved elsewhere in the computer or copied to another computer, assuming it has the same configuration of OS, compiler, etc. | ||
|
||
.. code-block:: bash | ||
$ cd .. | ||
$ cp -R development_deploy /some/other/place | ||
$ cd /some/other/place | ||
And the files could be used by developers as: | ||
|
||
.. code-block:: bash | ||
:caption: Windows | ||
$ cd build | ||
# Activate the environment to use CMake 3.25 | ||
$ generators\conanbuild.bat | ||
$ cmake --version | ||
cmake version 3.25.3 | ||
# Configure, should match the settings used at install | ||
$ cmake .. -G \"Visual Studio 17 2022\" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake | ||
$ cmake --build . --config Release | ||
$ Release\compressor.exe | ||
ZLIB VERSION: 1.2.13 | ||
The environment scripts in Linux and OSX are not relocatable, because they contain absolute paths and the ``sh`` shell `does not have any way to provide access to the current script directory for sourced files <https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh/29835459#29835459>`_. | ||
|
||
This shouldn't be a big blocker, as a "search and replace" with ``sed`` in the generators folder can fix it: | ||
|
||
.. code-block:: bash | ||
:caption: Linux | ||
$ cd build/Release/generators | ||
# Fix folders in Linux | ||
$ sed -i 's,{old_folder},{new_folder},g' * | ||
# Fix folders in MacOS | ||
$ sed -i '' 's,{old_folder},{new_folder},g' * | ||
$ source conanbuild.sh | ||
$ cd .. | ||
$ cmake --version | ||
cmake version 3.25.3 | ||
$ cmake ../.. -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | ||
$ cmake --build . | ||
$ ./compressor | ||
ZLIB VERSION: 1.2.13 | ||
.. note:: | ||
|
||
**Best practices** | ||
|
||
The fact that this flow is possible doesn't mean that it is recommended for the majority of cases. | ||
It has some limitations: | ||
|
||
- It is less efficient, requiring an extra copy of dependencies | ||
- Only ``CMakeDeps`` and ``CMakeToolchain`` are relocatable at this moment. For other build system integrations, please create a ticket in Github | ||
- Linux and OSX shell scripts are not relocatable and require a manual ``sed`` | ||
- The binary variability is limited to Release/Debug. The generated files are exclusively for the current configuration, changing any other setting (os, compiler, architecture) will require a different deploy | ||
|
||
In the general case, normal usage of the cache is recommended. This "relocatable development deployment" | ||
could be useful for distributing final products that looks like an SDK, to consumers of a project not using Conan. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Knowledge | |
:maxdepth: 2 | ||
|
||
|
||
knowledge/cheatsheet | ||
knowledge/guidelines | ||
knowledge/faq | ||
knowledge/videos | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*********** | ||
Cheat sheet | ||
*********** | ||
|
||
This is a visual cheat sheet for basic Conan commands and | ||
concepts which users can print out and use as a handy reference. It is available | ||
as both a PDF and PNG. | ||
|
||
:download:`PDF Format <../images/cheatsheet/conan2-cheatsheet-v5.pdf>` | ||
|
||
:download:`PNG Format <../images/cheatsheet/conan2-cheatsheet-v5.png>` | ||
|
||
.. image:: ../images/cheatsheet/conan2-cheatsheet-v5.png | ||
:height: 600 px | ||
:width: 800 px | ||
:align: center |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.