Deployers¶
Deployers are a mechanism to facilitate copying files form one folder, usually the Conan cache, to user folders.
While Conan provides two built-in ones (full_deploy
and direct_deploy
), users can easily manage their own
with conan config install
.
Deployers run before generators, and they can change the target folders.
For example, if the --deploy=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. Multiple deployers can be specified by supplying more than one --deploy=
argument,
and they will be ran in order of appearance.
Deployers can be multi-configuration. Running conan install . --deploy=full_deploy
repeatedly for different profiles
can achieve a fully self-contained project, including all the artifacts, binaries, and build files.
This project will be completely independent of Conan and no longer require it at all to build.
Built-in deployers¶
full_deploy¶
Deploys each package folder of every dependency to your recipe’s output_folder
in a subfolder tree based on:
- The build context
- The dependency name and version
- The build type
- The build arch
Then every dependency will end up in a folder such as:
[OUTPUT_FOLDER]/host/dep/0.1/Release/x86_64
direct_deploy¶
Same as full_deploy
, but only processes your recipe’s direct dependencies.
Warning
The built-in deployers are in preview. See the Conan stability section for more information.
Custom deployers¶
Custom deployers can be managed via conan config install
. When looking for a specific deployer,
Conan will look in these locations for the deployer in the following order:
- Absolute paths
- Relative to cwd
- In the
[CONAN_HOME]/extensions/deploy
folder - As built-in deployers
Conan will look for a deploy()
method to call for each installed file.
The function signature of your custom deployers should be as follows:
def deploy(graph, output_folder: str):
(Note that the arguments are passed as named parameters, so both the graph
and output_folder
names are mandatory)
You can access your conanfile object with graph.root.conanfile
.
See ConanFile.dependencies for information on how to iterate over its dependencies.
Your custom deployer can now be invoked as if it were a built-in deployer using the filename in which it’s found,
in this case conan install . --deploy=my_custom_deployer
. Note that supplying the .py extension is optional.
See the custom deployers section for examples on how to implement your own deployers.