
* Drop Conan 1.x from docs Signed-off-by: Uilian Ries <uilianries@gmail.com> * Revert .c3i folder deletion Signed-off-by: Uilian Ries <uilianries@gmail.com> * Add info about CLA Signed-off-by: Uilian Ries <uilianries@gmail.com> * Restore community resources Signed-off-by: Uilian Ries <uilianries@gmail.com> * Fix markdown reference leftover Signed-off-by: Uilian Ries <uilianries@gmail.com> * Fix first time contribution title Signed-off-by: Uilian Ries <uilianries@gmail.com> * Fix 3 steps Signed-off-by: Uilian Ries <uilianries@gmail.com> * how to write a good recipe Signed-off-by: Uilian Ries <uilianries@gmail.com> * Linter and hooks displayed in Checks Signed-off-by: Uilian Ries <uilianries@gmail.com> * Re-add build() and package() Signed-off-by: Uilian Ries <uilianries@gmail.com> * May accept build scripts based on effort Signed-off-by: Uilian Ries <uilianries@gmail.com> * Clarify patch on source folder Signed-off-by: Uilian Ries <uilianries@gmail.com> * Rephrase adding old versions Signed-off-by: Uilian Ries <uilianries@gmail.com> * Only required patch fields should be included Signed-off-by: Uilian Ries <uilianries@gmail.com> * Remove community tools Signed-off-by: Uilian Ries <uilianries@gmail.com> * Restore supported platforms Signed-off-by: Uilian Ries <uilianries@gmail.com> * How to consume a graph of shared libraries Signed-off-by: Uilian Ries <uilianries@gmail.com> * Fix typo in build_and_package.md Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es> * Fix typo in build_and_package.md Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es> * Grammar fix in conanfile_attributes.md Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es> * Grammar fix in conanfile_attributes.md Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es> * Point correct link to version ranges Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es> * Add note about waiting fresh bump version Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es> --------- Signed-off-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
3.7 KiB
Build and Package
This document gathers all the relevant information regarding the general lines to follow while writing either the build()
or the package()
methods.
Both methods often use build helpers to build binaries and install them into the package_folder
.
Contents
Build Method
For the build()
method, the general scope used to build artifacts. Please, read
the official reference to the build() method and the
Build packages: the build() method.
Package Method
The package()
method is used to copy the artifacts to the package_folder
. Please, read the official reference to the
package() method and the
Package files: the package() method.
Build System Examples
The Conan's documentation is always a good place for technical details. General patterns about how they can be used for OSS in ConanCenterIndex can be found in the package templates sections. These are excellent to copy and start from.
Header Only
If you are looking for header-only projects, you can take a look on header-only template. Also, Conan Docs have a section about how to package header-only libraries.
CMake
For C/C++ projects which use CMake for building, you can take a look on cmake package template.
Autotools
There is an autotools package template amiable to start from.
No Upstream Build Scripts
For cases where a project only offers source files but does not provide a build script, you can add CMake support. However, it is essential to first contact the upstream maintainers and open a pull request (PR) offering building support. If your PR is rejected because the author does not want any kind of build script, or if the project is abandoned, Conan Center Index (CCI) will consider accepting your build script based on the effort required to maintain it, as we aim to avoid adding scripts that may require significant ongoing maintenance. Take a look at Bzip2 as example.
System Packages
Note
: For exceptional cases where only system packages can be used and a regular Conan package may result in an incompatible and fragile package, a separated system package may be created. See the FAQs for more.
The package_manager can easily manage a system package manager (e.g. apt,
pacman, brew, choco) and install packages which are missing on Conan Center but available for most distributions. It is key to correctly fill in the cpp_info
for the consumers of a system package to have access to whatever was installed.
As example there is xorg.