Conan Documentation Release 1.7.4
Total Page:16
File Type:pdf, Size:1020Kb
conan Documentation Release 1.7.4 conan Sep 24, 2021 CONTENTS 1 Introduction 3 1.1 Open Source...............................................3 1.2 Decentralized package manager.....................................3 1.3 Binary management...........................................4 1.4 Cross platform, build system agnostic..................................4 1.5 Stable...................................................5 2 Install 7 2.1 Install with pip (recommended).....................................7 2.2 Install from brew (OSX).........................................8 2.3 Install from AUR (Arch Linux).....................................8 2.4 Install the binaries............................................8 2.5 Initial configuration...........................................8 2.6 Install from source............................................9 2.7 Python 2 Deprecation Notice.......................................9 3 Getting Started 11 3.1 A Timer Using POCO Libraries..................................... 11 3.2 Installing Dependencies......................................... 12 3.3 Building the Timer Example....................................... 14 3.4 Inspecting Dependencies......................................... 14 3.5 Searching Packages........................................... 15 3.6 Building with Other Configurations................................... 15 4 Using packages 17 4.1 Installing dependencies......................................... 17 4.2 Using profiles............................................... 21 4.3 Workflows................................................ 23 5 Creating Packages 27 5.1 Getting Started.............................................. 27 5.2 Recipe and Sources in a Different Repo................................. 31 5.3 Recipe and Sources in the Same Repo.................................. 32 5.4 Packaging Existing Binaries....................................... 34 5.5 Understanding Packaging........................................ 36 5.6 Defining Package ABI Compatibility.................................. 38 5.7 Inspecting Packages........................................... 45 5.8 Packaging Approaches.......................................... 45 5.9 Package Creator Tools.......................................... 50 6 Uploading Packages 53 i 6.1 Remotes................................................. 53 6.2 Uploading Packages to Remotes..................................... 54 6.3 Using Bintray............................................... 55 6.4 Artifactory Community Edition for C/C++............................... 60 6.5 Running conan_server.......................................... 61 7 Developing Packages 67 7.1 Package development flow........................................ 67 7.2 Workspaces [experimental]....................................... 71 8 Package apps and devtools 75 8.1 Running and deploying packages.................................... 75 8.2 Creating conan packages to install dev tools............................... 78 8.3 Build requirements............................................ 81 9 Mastering conan 87 9.1 Python requires: reusing python code in recipes............................. 87 9.2 Use conanfile.py for consumers..................................... 89 9.3 Conditional settings, options and requirements............................. 91 9.4 Version ranges.............................................. 93 9.5 Build policies............................................... 94 9.6 Environment variables.......................................... 95 9.7 Virtual Environments........................................... 96 9.8 Logging.................................................. 98 9.9 Sharing the settings and other configuration............................... 100 9.10 Conan local cache: concurrency, Continuous Integration, isolation................... 100 10 Systems and cross building 103 10.1 Cross building.............................................. 103 10.2 Windows Subsystems.......................................... 111 11 Integrations 115 11.1 CMake.................................................. 115 11.2 Autotools: configure/make........................................ 124 11.3 Visual Studio............................................... 124 11.4 Apple/Xcode............................................... 127 11.5 Compilers on command line....................................... 129 11.6 Android Studio.............................................. 131 11.7 CLion................................................... 136 11.8 Ninja, NMake, Borland......................................... 141 11.9 pkg-config and .pc files....................................... 141 11.10 Boost Build................................................ 145 11.11 QMake.................................................. 145 11.12 Premake................................................. 146 11.13 qbs.................................................... 147 11.14 Meson Build............................................... 148 11.15 Docker.................................................. 148 11.16 Git.................................................... 148 11.17 Jenkins.................................................. 149 11.18 Travis Ci................................................. 151 11.19 Appveyor................................................. 153 11.20 Gitlab................................................... 155 11.21 Circle CI................................................. 156 11.22 YouCompleteMe (vim).......................................... 158 11.23 SCons................................................... 158 ii 11.24 Custom integrations........................................... 159 11.25 Linting conanfile.py........................................... 163 12 Howtos 165 12.1 How to package header-only libraries.................................. 165 12.2 How to launch conan install from cmake................................ 167 12.3 How to create and reuse packages based on Visual Studio....................... 168 12.4 Creating and reusing packages based on Makefiles........................... 171 12.5 How to manage the GCC >= 5 ABI................................... 173 12.6 Using Visual Studio 2017 - CMake integration............................. 174 12.7 How to manage C++ standard...................................... 177 12.8 How to use docker to create and cross build C and C++ conan packages................ 178 12.9 How to reuse Python code in recipes................................... 181 12.10 How to create and share a custom generator with generator packages................. 184 12.11 How to manage shared libraries..................................... 188 12.12 How to reuse cmake install for package() method............................ 193 12.13 How to collaborate on other users’ packages.............................. 193 12.14 How to link with Apple Frameworks.................................. 194 12.15 How to package Apple Frameworks................................... 195 12.16 How to collect licenses of dependencies................................. 195 12.17 How to capture package version from SCM: git............................. 196 12.18 How to capture package version from text or build files......................... 196 12.19 How to use Conan as other language package manager......................... 197 12.20 How to manage SSL (TLS) certificates................................. 202 12.21 How to check the version of the Conan client inside a conanfile.................... 203 12.22 Use a generic CI with Conan and Artifactory.............................. 204 13 Reference 205 13.1 Commands................................................ 205 13.2 conanfile.txt............................................... 248 13.3 conanfile.py............................................... 250 13.4 Generators................................................ 278 13.5 Profiles.................................................. 295 13.6 Build helpers............................................... 299 13.7 Tools................................................... 315 13.8 Configuration files............................................ 336 13.9 Environment variables.......................................... 341 14 Videos and links 349 15 FAQ 351 15.1 Upgrading to conan 1.0......................................... 351 15.2 General.................................................. 353 15.3 Using conan............................................... 354 15.4 Troubleshooting............................................. 356 16 Changelog 359 16.1 1.7.4 (18-September-2018)........................................ 359 16.2 1.7.3 (6-September-2018)........................................ 359 16.3 1.7.2 (4-September-2018)........................................ 359 16.4 1.7.1 (31-August-2018)......................................... 359 16.5 1.7.0 (29-August-2018)......................................... 359 16.6 1.6.1 (27-July-2018)........................................... 360 16.7 1.6.0 (19-July-2018)........................................... 361 16.8 1.5.2 (5-July-2018)............................................ 362 iii 16.9 1.5.1 (29-June-2018)........................................... 362 16.10 1.5.0 (27-June-2018)........................................... 362 16.11 1.4.5 (22-June-2018)........................................... 363 16.12 1.4.4 (11-June-2018)........................................... 363 16.13 1.4.3 (6-June-2018)........................................... 363 16.14 1.4.2 (4-June-2018)..........................................