### Conan install output example Source: https://github.com/conan-io/docs/blob/develop2/tutorial/consuming_packages/use_tools_as_conan_packages.rst Example output from the 'conan install' command, showing dependency graph computation and package installation. ```text -------- Computing dependency graph ---------- cmake/3.27.9: Not found in local cache, looking in remotes... cmake/3.27.9: Checking remote: conancenter cmake/3.27.9: Trying with 'conancenter'... Downloading conanmanifest.txt Downloading conanfile.py cmake/3.27.9: Downloaded recipe revision 3e3d8f3a848b2a60afafbe7a0955085a Graph root conanfile.txt: /Users/user/Documents/developer/conan/examples2/tutorial/consuming_packages/tool_requires/conanfile.txt Requirements zlib/1.3.1#f1fadf0d3b196dc0332750354ad8ab7b - Cache Build requirements cmake/3.27.9#3e3d8f3a848b2a60afafbe7a0955085a - Downloaded (conancenter) -------- Computing necessary packages ---------- Requirements zlib/1.3.1#f1fadf0d3b196dc0332750354ad8ab7b:2a823fda5c9d8b4f682cb27c30caf4124c5726c8#48bc7191ec1ee467f1e951033d7d41b2 - Cache Build requirements cmake/3.27.9#3e3d8f3a848b2a60afafbe7a0955085a:f2f48d9745706caf77ea883a5855538256e7f2d4#6c519070f013da19afd56b52c465b596 - Download (conancenter) -------- Installing packages ---------- Installing (downloading, building) binaries... cmake/3.27.9: Retrieving package f2f48d9745706caf77ea883a5855538256e7f2d4 from remote 'conancenter' ``` -------------------------------- ### Conan Install Output Example Source: https://github.com/conan-io/docs/blob/develop2/tutorial/consuming_packages/build_simple_cmake_project.rst An example of the output from the 'conan install' command, showing the dependency graph computation, package installation, and generator output for CMake. ```bash $ conan install . --output-folder=build --build=missing ... -------- Computing dependency graph ---------- zlib/1.3.1: Not found in local cache, looking in remotes... zlib/1.3.1: Checking remote: conancenter zlib/1.3.1: Trying with 'conancenter'... Downloading conanmanifest.txt Downloading conanfile.py Downloading conan_export.tgz Decompressing conan_export.tgz zlib/1.3.1: Downloaded recipe revision f1fadf0d3b196dc0332750354ad8ab7b Graph root conanfile.txt: /home/conan/examples2/tutorial/consuming_packages/simple_cmake_project/conanfile.txt Requirements zlib/1.3.1#f1fadf0d3b196dc0332750354ad8ab7b - Downloaded (conancenter) -------- Computing necessary packages ---------- Requirements zlib/1.3.1#f1fadf0d3b196dc0332750354ad8ab7b:cdc9a35e010a17fc90bb845108cf86cfcbce64bf#dd7bf2a1ab4eb5d1943598c09b616121 - Download (conancenter) -------- Installing packages ---------- Installing (downloading, building) binaries... zlib/1.3.1: Retrieving package cdc9a35e010a17fc90bb845108cf86cfcbce64bf from remote 'conancenter' Downloading conanmanifest.txt Downloading conaninfo.txt Downloading conan_package.tgz Decompressing conan_package.tgz zlib/1.3.1: Package installed cdc9a35e010a17fc90bb845108cf86cfcbce64bf zlib/1.3.1: Downloaded package revision dd7bf2a1ab4eb5d1943598c09b616121 -------- Finalizing install (deploy, generators) ---------- conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: Generating aggregated env files ``` -------------------------------- ### Clone Project and Install Dependencies Source: https://github.com/conan-io/docs/blob/develop2/examples/dev_flow/debug/debugging_visual.rst Clone the example project and install dependencies, ensuring shared libraries and debug symbols are built. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/consuming_packages/simple_cmake_project conan install . -o=":*:shared=True" -s build_type=Debug --build="zlib/*" ... Install finished successfully # CMake presets require CMake>=3.23 cmake --preset=conan-default ``` -------------------------------- ### Conan Install and CMake Build Example Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/package_layout.rst Demonstrates installing a consumer project that depends on the 'say' package and then building it with CMake. It shows how Conan integrates with CMake to find package components and how the build process proceeds. ```bash $ cd ../hello $ conan install . -s build_type=Release # Linux, MacOS $ cmake --preset conan-release --log-level=VERBOSE # Windows $ cmake --preset conan-default --log-level=VERBOSE ... -- Conan: Target declared 'say::say' -- Conan: Library say found p/say8938ceae216fc/p/lib/libsay.a -- Created target CONAN_LIB::say_say_RELEASE STATIC IMPORTED -- Conan: Found: p/p/say8938ceae216fc/p/lib/libsay.a -- Configuring done ... $ cmake --build --preset conan-release [ 50%] Building CXX object CMakeFiles/hello.dir/src/hello.cpp.o [100%] Linking CXX executable hello [100%] Built target hello ``` -------------------------------- ### Configuration Output Example Source: https://github.com/conan-io/docs/blob/develop2/reference/config_files/profiles.rst Example of the configuration output after applying a profile. ```bash ... Configuration: [settings] [options] [tool_requires] [conf] user.myconf.build:cflags=! user.myconf.build:ldflags=['--prefix prefix-value', '--flag1 value1', '--flag2 value2'] ... ``` -------------------------------- ### Install System Packages with Apt Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/system/package_manager.rst Example of how to install system packages using the Apt tool. Allows overriding default Conan architecture mappings to system-specific ones. ```python def system_requirements(self): apt = Apt(self, arch_names={"": "apt_arch_setting"}) apt.install(["libgl-dev"]) ``` -------------------------------- ### Install system packages with Apt (basic) Source: https://github.com/conan-io/docs/blob/develop2/reference/conanfile/methods/system_requirements.rst A basic example of using the Apt helper to install specified system packages. This snippet does not include update or check flags. ```python from conan import ConanFile from conan.tools.system.package_manager import Apt class MyPkg(ConanFile): settings = "arch" def system_requirements(self): apt = Apt(self) apt.install(["pkg1", "pkg2"]) ``` -------------------------------- ### Clone example repository Source: https://github.com/conan-io/docs/blob/develop2/examples/tools/meson/build_simple_meson_project.rst Clone the example repository to get the source files for the Meson project. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/tools/meson/mesontoolchain/simple_meson_project ``` -------------------------------- ### Install Conan Configuration and Build Packages Source: https://github.com/conan-io/docs/blob/develop2/integrations/github.rst This example installs a custom Conan configuration from a URL, caches packages, builds a package, and uploads it. It requires remote authentication using GitHub secrets. ```yaml name: Build and upload Conan package on: push: branches: - 'main' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Install and setup Conan uses: conan-io/setup-conan@v1 with: config_urls: https://mycompany.com/conan/configs.git cache_packages: true - name: Build and upload package run: | conan create . -pr:a myprofile --build=missing conan remote login artifactory developer -p ${{ secrets.MY_CONAN_PASSWORD }} conan upload "*" --confirm --remote artifactory ``` -------------------------------- ### Clone and Navigate to Example Project Source: https://github.com/conan-io/docs/blob/develop2/examples/conanfile/layout/conanfile_in_subfolder.rst This command clones the example repository and navigates into the specific directory for the conanfile layout example. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/conanfile/layout/conanfile_in_subfolder ``` -------------------------------- ### Global Configuration Example Source: https://github.com/conan-io/docs/blob/develop2/reference/config_files/profiles.rst Example of global.conf defining lists for build flags. ```text # Defining several lists user.myconf.build:ldflags=["--flag1 value1"] user.myconf.build:cflags=["--flag1 value1"] ``` -------------------------------- ### Conan Install Command (Windows) Source: https://github.com/conan-io/docs/blob/develop2/tutorial/consuming_packages/the_flexibility_of_conanfile_py.rst Example command to install dependencies and configure the build environment for a project using conanfile.py on Windows. ```bash $ conan install . --output-folder=build --build=missing $ cd build $ conanbuild.bat # assuming Visual Studio 15 2017 is your VS version and that it matches your default profile ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/package_layout.rst Clone the example repository to follow along with the tutorial. Navigate to the package_layout directory. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/developing_packages/package_layout ``` -------------------------------- ### Conan install command examples Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/microsoft/msbuildtoolchain.rst Install Conan packages with different build types to generate corresponding MSBuild properties files. ```bash conan install . # default is Release conan install . -s build_type=Debug ``` -------------------------------- ### Clone Example Project Source: https://github.com/conan-io/docs/blob/develop2/examples/tools/google/bazeltoolchain/build_simple_bazel_project.rst Clone the repository containing the example project files. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/tools/google/bazeltoolchain/6_x/string_formatter ``` -------------------------------- ### Clone Example Project Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/other_types_of_packages/header_only_packages.rst Clone the example project from GitHub to follow along with the tutorial. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/other_packages/header_only_gtest ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/examples/conanfile/layout/third_party_libraries.rst Clone the example repository to follow along with the documentation. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/conanfile/layout/third_party_libraries ``` -------------------------------- ### Profile Configuration for Zlib-like Libraries Source: https://github.com/conan-io/docs/blob/develop2/reference/config_files/profiles.rst This example shows how to use a partial match pattern ('zlib*') to apply settings to all libraries whose names start with 'zlib', including variations like 'zlibng' or versioned names. ```text [settings] zlib*:compiler=clang zlib*:compiler.version=3.5 zlib*:compiler.libcxx=libstdc++11 ``` -------------------------------- ### Clone example sources Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/build_packages.rst Clone the example sources from the examples2 repository to follow along with the tutorial. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/tutorial/creating_packages/build_method ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/examples/tools/files/patches/patch_sources.rst Clone the example repository to follow along with the patching examples. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples/tools/files/patches ``` -------------------------------- ### Install system packages with Apt Source: https://github.com/conan-io/docs/blob/develop2/reference/conanfile/methods/system_requirements.rst This snippet demonstrates how to use the Apt helper to install system development packages. The `update=True` argument ensures the package list is updated before installation, and `check=True` verifies the installation. ```python from conan import ConanFile from conan.tools.system.package_manager import Apt class OpenCV(ConanFile): name = "opencv" version = "4.0" def system_requirements(self): apt = Apt(self) apt.install(["libgtk-3-dev"], update=True, check=True) ``` -------------------------------- ### Clone Example Sources Source: https://github.com/conan-io/docs/blob/develop2/examples/extensions/commands/clean/custom_command_clean_revisions.rst Clone the example repository to access the custom command source files. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/extensions/commands/clean ``` -------------------------------- ### Cloning Example Project Source: https://github.com/conan-io/docs/blob/develop2/examples/conanfile/layout/multiple_subprojects.rst Clone the example project from GitHub to follow along with the demonstration. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/conanfile/layout/multiple_subprojects ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/examples/config_files/settings/settings_user.rst Clone the example repository to follow along with the customization steps. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/config_files/settings_user ``` -------------------------------- ### Example Project Structure Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/local_package_development_flow.rst This is the initial directory structure of the example project before running any Conan commands. ```text . ├── conanfile.py └── test_package ├── CMakeLists.txt ├── conanfile.py └── src └── example.cpp ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/examples/extensions/deployers/sources/custom_deployer_sources.rst Clone the example repository to access the custom deployer and conanfile. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/extensions/deployers/sources ``` -------------------------------- ### Install a specific configuration file from a local path Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/config.rst Installs a single configuration file (e.g., settings.yml) from a local directory. This is useful for applying specific configuration changes without installing a full configuration set. ```text $ conan config install my_settings/settings.yml ``` -------------------------------- ### Example conanfile.txt for lockfile creation Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/lock/create.rst This is an example conanfile.txt used to demonstrate the creation of a lockfile. ```text [requires] fmt/9.0.0 [tool_requires] cmake/3.23.5 ``` -------------------------------- ### Clone the example project Source: https://github.com/conan-io/docs/blob/develop2/examples/dev_flow/debug/step_into_dependencies.rst Clone the example project from GitHub to follow along with the debugging steps. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/consuming_packages/simple_cmake_project ``` -------------------------------- ### Clone Example Sources Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/other_types_of_packages/package_prebuilt_binaries.rst Clone the example repository to follow along with the tutorial. Navigate to the specific directory for pre-built binaries. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/other_packages/prebuilt_binaries ``` -------------------------------- ### Conanfile Install Configuration Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/local_package_development_flow.rst Example `conanfile.py` snippet showing the `generators` attribute set to 'CMakeDeps' and the `layout` and `generate` methods for CMake toolchain setup. ```python class helloRecipe(ConanFile): ... generators = "CMakeDeps" ... def layout(self): cmake_layout(self, src_folder="src") def generate(self): tc = CMakeToolchain(self) tc.generate() ... ``` -------------------------------- ### Profile Configuration Example Source: https://github.com/conan-io/docs/blob/develop2/reference/binary_model/settings_and_options.rst An example of how to define configuration variables within a Conan profile. ```text [conf] user.my-pkg:verbosity=silent ``` -------------------------------- ### Clone Header-Only Examples Repository Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/other_types_of_packages/header_only_packages.rst Clone the example repository to follow along with the header-only package tutorial. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/tutorial/creating_packages/other_packages/header_only ``` -------------------------------- ### Full Deployer Example Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/install.rst Copies all dependency binaries to the current user folder. This is useful for deploying all necessary files for an application. ```text # does a full copy of the dependencies binaries to the current user folder $ conan install . --deployer=full_deploy ``` -------------------------------- ### Install Mapviewer without Rebuild Source: https://github.com/conan-io/docs/blob/develop2/ci_tutorial/products_pipeline/single_configuration.rst Install the 'mapviewer/1.0' package. This example shows a successful installation where dependencies are met without requiring a rebuild. ```bash $ conan install --requires=mapviewer/1.0 ... Requirements graphics/1.0#24b395ba17da96288766cc83accc98f5 - Downloaded (develop) mapviewer/1.0#c4660fde083a1d581ac554e8a026d4ea - Downloaded (develop) mathlib/1.0#f2b05681ed843bf50d8b7b7bdb5163ea - Downloaded (develop) ... Install finished successfully # Activate the environment and run the executable # Use "conanbuild.bat && mapviewer" in Windows $ source conanrun.sh && mapviewer ... graphics/1.0: Checking if things collide (Release)! mapviewer/1.0:serving the game (Release)! ``` -------------------------------- ### Test Package Source Code Example Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/test_conan_packages.rst A minimal C++ example demonstrating how to use the packaged library. ```cpp #include "hello.h" int main() { hello(); } ``` -------------------------------- ### Execute Project Setup Script Source: https://github.com/conan-io/docs/blob/develop2/ci_tutorial/project_setup.rst Run the 'project_setup.py' script to clean server repositories, build initial dependencies, and upload them to the 'develop' repository. This script also cleans the local Conan cache. ```bash python project_setup.py ``` -------------------------------- ### Install Package from Remote Repository Source: https://github.com/conan-io/docs/blob/develop2/tutorial/conan_repositories/uploading_packages.rst Install the 'hello/1.0' package specifically from the 'my_local_server' remote repository. ```bash $ conan install --requires=hello/1.0 -r=my_local_server ``` -------------------------------- ### Build and Run 'hello' Project Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/editable_packages.rst Builds and runs the 'hello' project, demonstrating release and debug outputs on Windows, and release output on Linux/macOS. ```bash $ cd ../hello # Windows $ cd build $ cmake --build --preset conan-release $ cmake --build --preset conan-debug $ Release\hello.exe say/1.0: Bye World Release! $ Debug\hello.exe say/1.0: Bye World Debug! # Linux, macOS $ cmake --build --preset conan-release $ ./hello say/1.0: Bye World Release! ``` -------------------------------- ### Run the Application Source: https://github.com/conan-io/docs/blob/develop2/examples/tools/google/bazeltoolchain/build_simple_bazel_project.rst Executes the built 'demo' application. ```bash ./bazel-bin/main/demo ``` -------------------------------- ### Conan install commands for XcodeDeps Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/apple/xcodedeps.rst Example commands to run 'conan install' to generate XcodeDeps configuration files for different build types. ```bash $ conan install conanfile.py # default is Release $ conan install conanfile.py -s build_type=Debug ``` -------------------------------- ### Clone Examples Repository Source: https://github.com/conan-io/docs/blob/develop2/ci_tutorial/project_setup.rst Clone the 'examples2' repository and navigate to the 'ci/game' directory to access the tutorial's code. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/ci/game ``` -------------------------------- ### Bash Command for Conan Install on Windows (Fails) Source: https://github.com/conan-io/docs/blob/develop2/reference/conanfile/methods/validate.rst Example of attempting to install a Conan package on Windows, which fails because the package is marked as invalid for the Windows configuration. ```bash $ conan install --requires=pkg/1.0 -s os=Windows # FAILS ... ERROR: There are invalid packages: pkg/1.0: Invalid: Windows not supported ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/tutorial/consuming_packages/build_simple_cmake_project.rst Clone the example repository to follow along with the tutorial. Navigate to the specific project directory. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/tutorial/consuming_packages/simple_cmake_project ``` -------------------------------- ### Install Configuration Packages with URLs from conanconfig.yml Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/config.rst Installs configuration packages and specifies repository URLs within the `conanconfig.yml` file. This is useful for initial Conan setup. ```yaml packages: - myconf_a/0.1 - myconf_b/0.1 - myconf_c/[>=1 <2] urls: - https://my/conan/remote/repo/url ``` -------------------------------- ### Building and Running the 'hello' Subproject Source: https://github.com/conan-io/docs/blob/develop2/examples/conanfile/layout/multiple_subprojects.rst Commands to install and build the 'hello' subproject locally, demonstrating that it correctly uses the common folder resources. The output confirms successful execution. ```bash $ conan install hello $ conan build hello ... [100%] Built target hello conanfile.py (hello/1.0): RUN: ./hello hello WORLD ``` -------------------------------- ### Clone Example Repository Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/add_dependencies_to_packages.rst Clone the example repository to follow along with the tutorial. Navigate to the specific directory for adding dependencies. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/add_requires ``` -------------------------------- ### Generated XcodeDeps files structure Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/apple/xcodedeps.rst Example file structure generated by XcodeDeps after running 'conan install'. ```bash . ├── conan_config.xcconfig ├── conan_libpng.xcconfig ├── conan_libpng_libpng.xcconfig ├── conan_libpng_libpng_debug_x86_64.xcconfig ├── conan_libpng_libpng_release_x86_64.xcconfig └── conandeps.xcconfig ``` -------------------------------- ### Clone Example Project Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/preparing_the_build.rst Clone the example project from GitHub to follow along with the tutorial. Navigate into the prepared directory. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/preparing_the_build ``` -------------------------------- ### List and Install Packages from Local Repository Source: https://github.com/conan-io/docs/blob/develop2/tutorial/conan_repositories/setup_local_recipes_index.rst Demonstrates how to list all available packages from the 'mylocalrepo' and install a specific package ('hello/0.1') from it. The '--build=missing' flag ensures that any missing dependencies are built. ```bash conan list "*" -r=mylocalrepo ``` ```bash conan install --requires=hello/0.1 -r=mylocalrepo --build=missing ``` -------------------------------- ### Using android_abi in ConanFile Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/android.rst Example of how to import and use the android_abi function within a ConanFile's generate() method to get the ABI for the current build context. ```python from conan.tools.android import android_abi class Pkg(ConanFile): def generate(self): abi = android_abi(self) ``` -------------------------------- ### Example .conanignore file syntax Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/config.rst Demonstrates the syntax for a .conanignore file, which filters files and folders during configuration installation. It uses fnmatch patterns to exclude files, with '!' for negation. ```text # Ignore all files * # But copy the file named "settings.yml" !settings.yml ``` -------------------------------- ### Example global.conf Entries Source: https://github.com/conan-io/docs/blob/develop2/reference/config_files/global_conf.rst Demonstrates typical entries for tools and user configurations in the global.conf file. ```text tools.build:verbosity=verbose tools.microsoft.msbuild:max_cpu_count=2 tools.microsoft.msbuild:vs_version = 16 tools.build:jobs=10 # User conf variable user.confvar:something=False ``` -------------------------------- ### Link Conan Dependencies in CMake Source: https://github.com/conan-io/docs/blob/develop2/integrations/clion.rst Example of how to find and link Conan-provided libraries in a CMakeLists.txt file. Ensure the Conan plugin is installed and configured in CLion for this to work seamlessly. ```cmake find_package(CURL) add_executable(project_name main.cpp) target_link_libraries(project_name CURL::libcurl) ``` -------------------------------- ### Example XcodeToolchain generated files Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/apple/xcodetoolchain.rst After running 'conan install', XcodeToolchain generates several .xcconfig files, including main configuration, build-specific toolchain files, and global flags. ```bash $ conan install conanfile.py # default is Release $ conan install conanfile.py -s build_type=Debug ``` ```bash . ├── conan_config.xcconfig ├── conantoolchain_release_x86_64.xcconfig ├── conantoolchain_debug_x86_64.xcconfig ├── conantoolchain.xcconfig └── conan_global_flags.xcconfig ``` -------------------------------- ### Conan Create Command Output for Static Library Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/define_package_information.rst Example output from the `conan create` command when building a static library. It shows the installation of the static library file and its successful packaging. ```bash $ conan create . --build=missing ... -- Install configuration: "Release" -- Installing: /Users/user/.conan2/p/tmp/a311fcf8a63f3206/p/lib/libhello-static.a -- Installing: /Users/user/.conan2/p/tmp/a311fcf8a63f3206/p/include/hello.h hello/1.0 package(): Packaged 1 '.h' file: hello.h hello/1.0 package(): Packaged 1 '.a' file: libhello-static.a hello/1.0: Package 'fd7c4113dad406f7d8211b3470c16627b54ff3af' created ... -- Build files have been written to: /Users/user/.conan2/p/tmp/a311fcf8a63f3206/b/build/Release hello/1.0: CMake command: cmake --build "/Users/user/.conan2/p/tmp/a311fcf8a63f3206/b/build/Release" -- -j16 hello/1.0: RUN: cmake --build "/Users/user/.conan2/p/tmp/a311fcf8a63f3206/b/build/Release" -- -j16 [ 25%] Building CXX object CMakeFiles/hello.dir/src/hello.cpp.o [ 50%] Linking CXX static library libhello-static.a [ 50%] Built target hello [ 75%] Building CXX object tests/CMakeFiles/test_hello.dir/test.cpp.o [100%] Linking CXX executable test_hello [100%] Built target test_hello hello/1.0: RUN: tests/test_hello ... [ 50%] Building CXX object CMakeFiles/example.dir/src/example.cpp.o [100%] Linking CXX executable example [100%] Built target example -------- Testing the package: Running test() -------- hello/1.0 (test package): Running test() hello/1.0 (test package): RUN: ./example hello/1.0: Hello World Release! (with color!) ``` -------------------------------- ### Example Intel Profile Configuration Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/intel.rst This profile configuration specifies settings for the Intel-CC compiler, including its mode, version, and libcxx. It also sets build environment variables and the installation path for Intel oneAPI. ```text [settings] ... compiler=intel-cc compiler.mode=dpcpp compiler.version=2021.3 compiler.libcxx=libstdc++ build_type=Release [buildenv] CC=dpcpp CXX=dpcpp [conf] tools.intel:installation_path=/opt/intel/oneapi ``` -------------------------------- ### Dockerfile for ROS2 Kilted Environment Source: https://github.com/conan-io/docs/blob/develop2/integrations/ros.rst This Dockerfile sets up an Ubuntu environment with ROS2 Kilted, necessary tools like curl and git, and installs Conan. It's useful for running the ROS integration examples. ```docker FROM osrf/ros:kilted-desktop RUN apt-get update && apt-get install -y \ curl \ python3-pip \ git \ ros-kilted-nav2-msgs \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --upgrade pip && pip3 install conan==2.* RUN conan profile detect CMD ["bash"] ``` -------------------------------- ### Autotools Package Recipe Example Source: https://github.com/conan-io/docs/blob/develop2/examples/tools/autotools/create_your_first_package.rst This Python snippet shows the essential parts of a conanfile.py for an Autotools project. It includes layout definition, toolchain generation, build steps using Autotools helper, and package installation. ```python exports_sources = "configure.ac", "Makefile.am", "src/*" def layout(self): basic_layout(self) def generate(self): at_toolchain = AutotoolsToolchain(self) at_toolchain.generate() def build(self): autotools = Autotools(self) autotools.autoreconf() autotools.configure() autotools.make() def package(self): autotools = Autotools(self) autotools.install() fix_apple_shared_install_name(self) ``` -------------------------------- ### Conan create command Source: https://github.com/conan-io/docs/blob/develop2/examples/graph/tool_requires/using_protobuf.rst Command to create a Conan package. This example shows building the package with missing dependencies and includes the output of the build process, highlighting the requirements and installation steps for protobuf and the custom library. ```shell $ conan create . --build missing ... Requirements myaddresser/1.0#71305099cc4dc0b08bb532d4f9196ac1:c4e35584cc696eb5dd8370a2a6d920fb2a156438 - Build protobuf/3.18.1#ac69396cd9fbb796b5b1fc16473ca354:e60fa1e7fc3000cc7be2a50a507800815e3f45e0#0af7d905b0df3225a3a56243841e041b - Cache zlib/1.2.13#13c96f538b52e1600c40b88994de240f:d0599452a426a161e02a297c6e0c5070f99b4909#69b9ece1cce8bc302b69159b4d437acd - Cache Build requirements protobuf/3.18.1#ac69396cd9fbb796b5b1fc16473ca354:e60fa1e7fc3000cc7be2a50a507800815e3f45e0#0af7d905b0df3225a3a56243841e041b - Cache ... -- Install configuration: "Release" -- Installing: /Users/myuser/.conan2/p/b/myser03f790a5a5533/p/lib/libmyaddresser.a -- Installing: /Users/myuser/.conan2/p/b/myser03f790a5a5533/p/include/myaddresser.h -- Installing: /Users/myuser/.conan2/p/b/myser03f790a5a5533/p/include/addressbook.pb.h myaddresser/1.0: package(): Packaged 2 '.h' files: myaddresser.h, addressbook.pb.h myaddresser/1.0: package(): Packaged 1 '.a' file: libmyaddresser.a .... ======== Testing the package: Executing test ======== myaddresser/1.0 (test package): Running test() myaddresser/1.0 (test package): RUN: ./example myaddresser(): created a person with id 1337 ``` -------------------------------- ### Example Build Order JSON Source: https://github.com/conan-io/docs/blob/develop2/ci_tutorial/products_pipeline/build_order.rst Illustrates the structure of the 'game_build_order.json' file, showing package references, dependencies, and build arguments. ```json { "order_by": "recipe", "reduced": true, "order": [ [ { "ref": "engine/1.0#fba6659c9dd04a4bbdc7a375f22143cb", "packages": [ [ { "package_id": "de738ff5d09f0359b81da17c58256c619814a765", "binary": "Build", "build_args": "--requires=engine/1.0 --build=engine/1.0" } ] ] } ], [ { "ref": "game/1.0#1715574045610faa2705017c71d0000e", "depends": [ "engine/1.0#fba6659c9dd04a4bbdc7a375f22143cb" ], "packages": [ [ { "package_id": "bac7cd2fe1592075ddc715563984bbe000059d4c", "binary": "Build", "build_args": "--requires=game/1.0 --build=game/1.0" } ] ] } ] ] } ``` -------------------------------- ### Qbs Project File Configuration Source: https://github.com/conan-io/docs/blob/develop2/reference/tools/qbs/qbsdeps.rst Example of a project.qbs file demonstrating how to declare a dependency using the Depends item and configure qbs module providers for Conan. ```js CppApplication { Depends { name: "hello"; version: "0.1" } files: "main.c" qbs.installPrefix: "" install: true qbsModuleProviders: "conan" moduleProviders.conan.installDirectory: "build" ``` -------------------------------- ### Clone Example Project Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/configure_options_settings.rst Clone the example project from GitHub to follow along with the tutorial. Navigate into the specific directory for this tutorial. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/tutorial/creating_packages/configure_options_settings ``` -------------------------------- ### Conan Install Commands Source: https://github.com/conan-io/docs/blob/develop2/examples/tools/cmake/cmake_toolchain/extend_own_cmake_presets.rst Install Conan packages for different build types. The first command installs for the default (usually Release) configuration, and the second explicitly installs for Debug. ```bash conan install . conan install . -s build_type=Debug ``` -------------------------------- ### Create and Build Initial Package Source: https://github.com/conan-io/docs/blob/develop2/tutorial/versioning/revisions.rst Initializes a new 'hello' package using CMake and creates the first version in the local cache. ```bash $ mkdir hello && cd hello $ conan remove hello* -c # clean possible existing ones $ conan new cmake_lib -d name=hello -d version=1.0 $ conan create . hello/1.0: Hello World Release! ... ``` -------------------------------- ### Test Conan Installation Source: https://github.com/conan-io/docs/blob/develop2/installation.rst After installing Conan from source, run this command to verify the installation. It should display the Conan command-line help. ```bash $ conan ``` -------------------------------- ### Project File Structure Source: https://github.com/conan-io/docs/blob/develop2/examples/graph/tool_requires/using_protobuf.rst Overview of the directory and file structure for the 'myaddresser' example project. ```text ./ ├── conanfile.py ├── CMakeLists.txt ├── addressbook.proto ├── apple-arch-armv8 ├── apple-arch-x86_64 └── src └── myaddresser.cpp └── include └── myaddresser.h └── test_package ├── conanfile.py ├── CMakeLists.txt └── src └── example.cpp ``` -------------------------------- ### Install Conan with pip Source: https://github.com/conan-io/docs/blob/develop2/installation.rst Use this command to install the latest Conan 2 version from PyPI. Ensure you have Python 3.8 or newer installed. ```bash pip install conan ``` -------------------------------- ### Example Directory Structure for Pre-built Binaries Source: https://github.com/conan-io/docs/blob/develop2/tutorial/creating_packages/other_types_of_packages/package_prebuilt_binaries.rst Illustrates the typical file organization for pre-built binaries, with subdirectories for operating systems and architectures, containing include and library files. ```text . ├── conanfile.py └── vendor_hello_library ├── linux │ ├── armv8 │ │ ├── include │ │ │ └── hello.h │ │ └── libhello.a │ └── x86_64 │ ├── include │ │ └── hello.h │ └── libhello.a ├── macos │ ├── armv8 │ │ ├── include │ │ │ └── hello.h │ │ └── libhello.a │ └── x86_64 │ ├── include │ │ └── hello.h │ └── libhello.a └── windows ├── armv8 │ ├── hello.lib │ └── include │ └── hello.h └── x86_64 ├── hello.lib └── include └── hello.h ``` -------------------------------- ### Install Conan from Source (Editable Mode) Source: https://github.com/conan-io/docs/blob/develop2/installation.rst Install Conan directly from its source code for the latest development version. This method requires Python and pip to be installed. The installation is done in editable mode, allowing you to run Conan from the source folder. ```bash # clone folder name matters, to avoid imports issues $ git clone https://github.com/conan-io/conan.git conan_src $ cd conan_src $ python -m pip install -e . ``` -------------------------------- ### Install with specific generators Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/install.rst Installs dependencies and specifies the generators to be used via the -g argument. This is typically used when installing via --requires. ```text $ conan install --requires=zlib/1.2.13 -g CMakeDeps -g CMakeToolchain ``` -------------------------------- ### Install configuration from a URL with source and target folders Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/config.rst Installs configuration from a zip archive, specifying a source folder within the archive and a target folder in the local cache. This allows for granular control over which configuration files are installed and where they are placed. ```text $ conan config install http://url/to/some/config.zip -sf=origin -tf=target ``` -------------------------------- ### Testing Workspace with External Dependency Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/workspaces.rst Demonstrates how to create a library, build it, and then create a workspace that requires it, followed by a super-install. ```bash $ conan new cmake_lib -d name=mymath $ conan create . $ conan new workspace -d requires=mymath/0.1 $ conan workspace super-install $ cmake ... ``` -------------------------------- ### Install Multiple Configuration Packages from conanconfig.yml Source: https://github.com/conan-io/docs/blob/develop2/reference/commands/config.rst Installs multiple configuration packages defined in a `conanconfig.yml` file. This simplifies the installation of several configuration packages at once. ```yaml packages: - myconf_a/0.1 - myconf_b/0.1 - myconf_c/[>=1 <2] ``` -------------------------------- ### Install pipx on Debian-based systems Source: https://github.com/conan-io/docs/blob/develop2/installation.rst Install the pipx package manager on Debian-based Linux distributions using apt. This is a prerequisite for installing Conan with pipx. ```bash apt-get install pipx pipx ensurepath ``` -------------------------------- ### Project Structure Example Source: https://github.com/conan-io/docs/blob/develop2/examples/conanfile/layout/third_party_libraries.rst Illustrates the expected project structure when packaging a third-party library with external code. ```text . ├── conanfile.py └── patches └── mypatch ``` -------------------------------- ### Run Conan Install Command Source: https://github.com/conan-io/docs/blob/develop2/tutorial/developing_packages/local_package_development_flow.rst Executes the `conan install` command to install dependencies and prepare build files using generators like `CMakeDeps` and `CMakeToolchain`. ```bash $ conan install . ... -------- Finalizing install (deploy, generators) -------- conanfile.py (hello/1.0): Writing generators to ... conanfile.py (hello/1.0): Generator 'CMakeDeps' calling 'generate()' conanfile.py (hello/1.0): Calling generate() ... conanfile.py (hello/1.0): Generating aggregated env files ```