当前位置: 首页 > news >正文

All the stories begin at installation

Before installation, there are some key points about Conan:

  1. “Conan is a dependency and package manager for C and C++ languages.”
  2. “With full binary management, Conan can create and reuse any number of different binaries (for different configurations like architectures, compiler versions, etc.) for any number of different versions of a package, using exactly the same process in all platforms.”
  3. “As it is decentralized, it is easy to run your own server to host your own packages and binaries privately, without needing to share them.”
  4. On the server side: “The free JFrog Artifactory Community Edition (CE) is the recommended Conan server to host your own packages privately under your control.”
  5. On the client side: What one needs is a Conan client.
  6. Simply put, JFrog for server and Conan for client.
  7. “Conan is a decentralized package manager with a client-server architecture. This means that clients can fetch packages from, as well as upload packages to, different servers (“remotes”), similar to the “git” push-pull model to/from git remotes.”
  8. “At a high level, the servers are just storing packages. They do not build nor create the packages. The packages are created by the client, and if binaries are built from sources, that compilation is also done by the client application.”
    在这里插入图片描述
  9. “The Conan client: this is a console/terminal command-line application, containing the heavy logic for package creation and consumption. Conan client has a local cache for package storage, and so it allows you to fully create and test packages offline. You can also work offline as long as no new packages are needed from remote servers.”
  10. “JFrog Artifactory Community Edition (CE) is the recommended Conan server to host your own packages privately under your control. It is a free community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API, and generic repositories to host any artifact.”
  11. “ConanCenter is a central public repository where the community contributes packages for popular open-source libraries like Boost, Zlib, OpenSSL, Poco, etc.”
    在这里插入图片描述
  12. The basic unit of conan project is a package. And a package is defined by a file “conanfile.py” that defines the package’s dependencies, sources, how to build the binaries from sources, etc. One package “conanfile.py” recipe can generate any arbitrary number of binaries, one for each different platform and configuration: operating system, architecture, compiler, build type, etc.
  13. “These binaries can be created and uploaded to a server with the same commands in all platforms, having a single source of truth for all packages and not requiring a different solution for every different operating system.”
  14. “Installation of packages from servers is also very efficient. Only the necessary binaries for the current platform and configuration are downloaded, not all of them. If the compatible binary is not available, the package can be built from sources in the client too.”

An example about conanfile.py

from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layoutclass HelloConan(ConanFile):name = "hello"version = "0.1"# Optional metadatalicense = "<Put the package license here>"author = "<Put your name here> <And your email here>"url = "<Package recipe repository url here, for issues about the package>"description = "<Description of Hello here>"topics = ("<Put some tag here>", "<here>", "<and here>")# Binary configurationsettings = "os", "compiler", "build_type", "arch"options = {"shared": [True, False], "fPIC": [True, False]}default_options = {"shared": False, "fPIC": True}# Sources are located in the same place as this recipe, copy them to the recipeexports_sources = "CMakeLists.txt", "src/*", "include/*"def config_options(self):if self.settings.os == "Windows":del self.options.fPICdef layout(self):cmake_layout(self)def generate(self):tc = CMakeToolchain(self)tc.generate()def build(self):cmake = CMake(self)cmake.configure()cmake.build()def package(self):cmake = CMake(self)cmake.install()def package_info(self):self.cpp_info.libs = ["hello"]

The directory structure of a Conan package

2024/01/20  21:52    <DIR>          .
2024/01/20  21:52    <DIR>          ..
2023/05/01  17:30               235 CMakeLists.txt
2023/05/01  17:30             1,307 conanfile.py
2023/05/01  16:55    <DIR>          include
2023/05/01  17:01    <DIR>          src2 个文件          1,542 字节4 个目录 66,603,655,168 可用字节

Installation of Conan

# pip install conan

To install Conan using pip, you need Python>=3.6 distribution installed on your machine.

Installation of JFrog

Download jfrog-artifactory-cpp-ce-7.55.10-linux.tar.gz from web site https://conan.io/downloads, and the Decompression is the Installation.

References

  1. Conan Documentation --Release 1.58.0
http://www.lryc.cn/news/285599.html

相关文章:

  • Linux文件系统与设备文件
  • QT的绘图系统QPainterDevice与文件系统QIODevice
  • Spark流式读取文件数据
  • Leetcode 3011. Find if Array Can Be Sorted
  • Databend 开源周报第 129 期
  • python 正则表达式学习(1)
  • 安全防御-基础认知
  • 各省税收收入、个人和企业所得税数据,Shp、excel格式,2000-2021年
  • Vue记录
  • 【JavaEE进阶】 Spring Boot⽇志
  • 《GitHub Copilot 操作指南》课程介绍
  • 结构体(C语言)
  • HNU-数据挖掘-实验1-实验平台及环境安装
  • JavaEE中的监听器的作用和工作原理
  • Webpack5入门到原理1:前言
  • #vue3 实现前端下载excel文件模板功能
  • 《WebKit 技术内幕》之五(3): HTML解释器和DOM 模型
  • 136基于matlab的自适应滤波算法的通信系统中微弱信号检测程序
  • 【Linux】权限 !
  • axios原理
  • epoll
  • AEB滤镜再破碎,安全焦虑「解不开」?
  • 深度学习和机器学习中针对非时间序列的回归任务,有哪些改进角度?
  • 无限商机、拓全国、赢未来!2024上海国际轴承展重磅来袭!
  • PPT 编辑模式滚动页面不居中
  • 笨蛋学设计模式结构型模式-享元模式【13】
  • 磁盘的分区与文件系统的认识
  • 韩国访问学者如何申请?
  • MybatisPlus框架入门级理解
  • ELK 分离式日志(1)