创建conan包-Understanding Packaging

news2024/9/26 5:20:17

创建conan包-Understanding Packaging

  • 1 Understanding Packaging
    • 1.1 Creating and Testing Packages Manually
    • 1.2 Package Creation Process

本文是基于对conan官方文档Understanding Packaging翻译而来, 更详细的信息可以去查阅conan官方文档。

1 Understanding Packaging

1.1 Creating and Testing Packages Manually

The previous create approach using test_package subfolder, is not strictly necessary, though very strongly recommended. If we didn’t want to use the test_package functionality, we could just write our recipe ourselves or use the conan new command without the -t. command line argument.
之前使用 test_package 子文件夹的创建方法并非绝对必要,但强烈建议使用。如果不想使用 test_package 功能,我们可以自己编写配方,或者使用不带 -t. 命令行参数的 conan new 命令。

$ mkdir mypkg && cd mypkg
$ conan new hello/0.1

This will create just the conanfile.py recipe file. Now we can create our package:
这将只创建 conanfile.py 配方文件。现在我们可以创建软件包了:

$ conan create . demo/testing

This is equivalent to:
这相当于:

$ conan export . demo/testing
$ conan install hello/0.1@demo/testing --build=hello

Once the package is created, it can be consumed like any other package, by adding hello/0.1@demo/testing to a project conanfile.txt or conanfile.py requirements and running:
创建软件包后,可以像使用其他软件包一样,在项目 conanfile.txtconanfile.py 要求中添加 "hello/0.1@demo/testing "并运行:

$ conan install .
# build and run your project to ensure the package works

1.2 Package Creation Process

It is very useful for package creators and Conan users in general to understand the flow for creating a package inside the conan local cache, and all about its layout.
对于软件包创建者和一般conan用户来说,了解在conan本地缓存中创建软件包的流程及其布局非常有用。

Each package recipe contains five important folders in the local cache:
每个软件包配方都包含本地缓存中的五个重要文件夹:

  • export: The folder in which the package recipe is stored.
  • export:存储软件包配方的文件夹。
  • export_source: The folder in which code copied with the recipe exports_sources attribute is stored.
  • export_source:存储使用 exports_sources 属性复制的代码的文件夹。
  • source: The folder in which the source code for building from sources is stored.
  • source: 源代码存储从源代码构建源代码的文件夹。
  • build: The folder in which the actual compilation of sources is done. There will typically be one subfolder for each different binary configuration
  • build:实际编译源代码的文件夹。通常每个不同的二进制配置都有一个子文件夹
  • package: The folder in which the final package artifacts are stored. There will be one subfolder for each different binary configuration
  • package:存储最终软件包工件的文件夹。每个不同的二进制配置将有一个子文件夹

The source and build folders only exist when the packages have been built from sources.
源文件夹和构建文件夹只有在软件包从源文件夹构建时才会存在。
在这里插入图片描述
The process starts when a package is “exported”, via the conan export command or more typically, with the conan create command. The conanfile.py and files specified by the exports_sources field are copied from the user space to the local cache.
当通过 conan export 命令或更常见的 conan create 命令 "导出 "软件包时,该过程就开始了。conanfile.py 和 exports_sources 字段指定的文件会从用户空间复制到本地缓存。

The export and export_source files are copied to the source folder, and then the source() method is executed (if it exists). Note that there is only one source folder for all the binary packages. If when generating the code, there is source code that varies for the different configurations, it cannot be generated using the source() method, but rather needs to be generated using the build() method.
导出和 export_source 文件会被复制到源文件夹,然后执行 source() 方法(如果存在)。请注意,所有二进制软件包都只有一个源代码文件夹。如果在生成代码时,不同配置有不同的源代码,则不能使用 source() 方法生成,而需要使用 build() 方法生成。

Then, for each different configuration of settings and options, a package ID will be computed in the form of a SHA-1 hash for this configuration. Sources will be copied to the build/hashXXX folder, and the build() method will be triggered.
然后,针对每个不同的设置和选项配置,以 SHA-1 哈希形式计算出该配置的软件包 ID。源代码将被复制到 build/hashXXX 文件夹,并触发 build() 方法。

After that, the package() method will be called to copy artifacts from the build/hashXXX folder to the package/hashXXX folder.
之后,将调用 package() 方法将build/hashXXX 文件夹中的工件复制到 package/hashXXX 文件夹中。

Finally, the package_info() methods of all dependencies will be called and gathered so you can generate files for the consumer build system, as the conanbuildinfo.cmake for the cmake generator. Also the imports feature will copy artifacts from the local cache into user space if specified.
最后,所有依赖项的 package_info() 方法都会被调用和收集,这样你就可以为用户编译系统生成文件,就像为 cmake 生成器生成 conanbuildinfo.cmake 文件一样。如果指定了导入功能,它还会将本地缓存中的工件复制到用户空间。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1284622.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

1. 了解继承的概念,掌握派生类的定义。2. 掌握派生类构造方法的执行过程。3. 掌握方法的重载与覆盖。4. 掌握抽象类的概念及上转型对象的使用

1、定义一个抽象类Shape,类中封装属性name指定图形名称,定义用于求面积的抽象方法。定义3个子类:圆形类Circle、梯形类Trapezoid和三角形类Triangle,都继承Shape类,子类中各自新增属性,定义构造方法、设置属…

中缀表达式转后缀表达式(详解)

**中缀表达式转后缀表达式的一般步骤如下: 1:创建一个空的栈和一个空的输出列表。 2:从左到右扫描中缀表达式的每个字符。 3:如果当前字符是操作数,则直接将其加入到输出列表中。 4:如果当前字符是运算符&a…

PyQt实战 创建一个PyQt5项目

前后端分离 参考链接 PyQt5实战(二):创建一个PyQt5项目_pyqt5实战项目_笨鸟未必先飞的博客-CSDN博客 项目目录 创建一个QT项目 调用pyuic工具将dialog.ui文件编译为Python程序文件ui_dialog.py。 # -*- coding: utf-8 -*-# Form implemen…

【专题】【中值定理-还原大法】

1)构造辅助函数 2)罗尔定理: 闭区间连续,开区间可导 F(a)F(b) 3)F‘(ξ)0,原命题得证 极限保号性:

Selenium启动Chrome插件(Chrome Extensions)

Selenium启动Chrome插件(Chrome Extensions) 需求描述: 在使用WebDriver启动Chrome浏览器时式启动一个默认设置(比较干净)的浏览器,但是我在自动化测试的过程中需要用到插件。 实现方法: 其一:启动浏览器的同时直接取安装包.cr…

3.5毫米音频连接器接线方式

3.5毫米音频连接器接线方式 耳机插头麦克风插头 绘制电路图注意事项 3.5毫米音频连接器分为单声道开关型和无开关型如下图: sleeve(套筒) tip(尖端) ring(环) 耳机插头 麦克风插头 绘制电路图…

玩转大数据6:实时数据处理与流式计算

引言 在当今的数字化时代,数据正在成为一种新的资源,其价值随着时间的推移而不断增长。因此,实时数据处理和流式计算变得越来越重要。它们在许多领域都有广泛的应用,包括金融、医疗、交通、能源等。本文将探讨实时数据处理和流式…

主题色变量和var实现多套主题换肤

文章目录 一、前言1.1、[VueElementUI实现多套主题换肤](https://blog.csdn.net/u012804440/article/details/133975511)1.2、[VueElementUI实现在线动态换肤](https://blog.csdn.net/u012804440/article/details/133975570) 二、实现2.1、多主题色定义2.2、根节点属性修改2.2.…

UVM验证环境中加入monitor

验证平台必须监测DUT的行为,只有知道DUT的输入输出信号变化之后,才能根据这些信号变化来判定DUT的行为是否正 确。 验证平台中实现监测DUT行为的组件是monitor。 driver负责把transaction级别的数据转变成DUT的端口级别,并驱动给DUT&…

EM32DX-C4【C#】

1外观: J301 直流 24V 电源输入 CAN0 CAN0 总线接口 CAN1 CAN1 总线接口 J201 IO 接线段子 S301-1、S301-2 输出口初始电平拨码设置 S301-3~S301-6 模块 CAN ID 站号拨码开关 S301-7 模块波特率拨码设置 S301-8 终端电阻选择开关 2DI: 公共端是…

Powercli常用命令

背景 vcenter web界面不如命令行快,且不能批量操作。 根据实际需求逐步补充使用到的powercli 命令。 00 通过bat脚本配置terminal标签页 在WindowsTerminal上配置新的标签页,实现打开标签页即默认连接vcenter。 脚本内容如下: echo off p…

Hadoop实验putty文件

🔥博客主页: A_SHOWY🎥系列专栏:力扣刷题总结录 数据结构 云计算 数字图像处理 很多朋友反馈做hadoop实验中的putty找不到Connection-SSH-Auth路径下找不到Private key for authentication私有密钥,无法将转…

vue: 线上项目element-ui的icon偶尔乱码问题

线上环境偶尔会复现, 具体: 一般使用不会出现这个问题,因为一般引入的是element-ui的css文件,问题出在于为了主题色变化啊,需要用到scss变量引入了scss文件。 import “~element-ui/packages/theme-chalk/src/index”…

IDEA插件:Apipost-Helper

Apipost-Helper是由Apipost推出的IDEA插件,写完接口可以进行快速调试,且支持搜索接口、根据method跳转接口,还支持生成标准的API文档,注意:这些操作都可以在代码编辑器内独立完成,非常好用!这里…

solidity实现ERC1155多代币标准

文章目录 1、NFT - 维基百科2、IERC1155MetadataURI3、IERC1155Receiver4、IERC11555、ERC11556、NFT11557、开源地址 1、NFT - 维基百科 ERC-1155 标准于2018年6月由Witek Radomski、Andrew Cooke、Philippe Castonguay、James Therien、Eric Binet及Ronan Sandford提出。此标…

RK3568平台开发系列讲解(Linux系统篇)device_node 转换成 platform_device

🚀返回专栏总目录 文章目录 一、DTB转换规则二、转换源码分析沉淀、分享、成长,让自己和他人都能有所收获!😄 📢本篇将介绍通过设备树 device_node 转换成 platform_device 一、DTB转换规则 device 部分是用 platform_device 结构体来描述硬件资源的, 所以内核最终会将…

LeetCode(47)合并区间【区间】【中等】

目录 1.题目2.答案3.提交结果截图 链接: 合并区间 1.题目 以数组 intervals 表示若干个区间的集合,其中单个区间为 intervals[i] [starti, endi] 。请你合并所有重叠的区间,并返回 一个不重叠的区间数组,该数组需恰好覆盖输入中…

VMware安装Ubuntu系统(Server端,Desktop端步骤一样)

天行健,君子以自强不息;地势坤,君子以厚德载物。 每个人都有惰性,但不断学习是好好生活的根本,共勉! 文章均为学习整理笔记,分享记录为主,如有错误请指正,共同学习进步。…

【C++】开源:Boost进程间通信库InterProcess配置使用

😏★,:.☆( ̄▽ ̄)/$:.★ 😏 这篇文章主要介绍Boost进程间通信库InterProcess配置使用。 无专精则不能成,无涉猎则不能通。——梁启超 欢迎来到我的博客,一起学习,共同进步。 喜欢的朋友可以关注一…

IntelliJ IDEA图形安装教程

IntelliJ IDEA图形安装教程 之前开始Java程序,一直用的eclipse,觉得还可以。一直听说IntelliJ IDEA比eclipse好用很多,但因为比较懒,也没有学习使用。机缘巧合下,尝试用了下,顿时有种相见恨晚的感觉&#…