创建conan包-Understanding Packaging

创建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.mfbz.cn/a/218367.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Leetcode刷题详解——等差数列划分

1. 题目链接:413. 等差数列划分 2. 题目描述: 如果一个数列 至少有三个元素 ,并且任意两个相邻元素之差相同,则称该数列为等差数列。 例如,[1,3,5,7,9]、[7,7,7,7] 和 [3,-1,-5,-9] 都是等差数列。 给你一个整数数组 …

24、到底什么是感受野?

在之前的文章中介绍卷积算法时,一直在强调一个地方,那就是卷积算法是——卷积核在输入图像上滑动扫描的过程。 在每一次扫描时,可以把卷积核的在长宽方向的大小看做一个窗口,透过窗口可以看到的输入图像的范围,就称为感受野。 也就是神经网络(卷积)在每一次扫描过程中…

RHEL8.9 静默安装Oracle19C

RHEL8.9 静默安装Oracle19C 甘肃圆角网络科技开发有限公司 说明(GUI):  1.实际业务场景中,Linux环境一般情况下是没有GUI的。没有GUI并不意味着没有安装图形界面。可能在部署Linux操作系统环境的时候安装了桌面环境,只是启动的时候设置了启动…

龙迅LT2611UX 四端口LVDS转HDMI(2.0)

1.描述: LT2611UX 四端口LVDS TO HDMI2.0。 LT2611UX是一款高性能得LVDS到HDMI2.0转换器得STB,DVD应用程序,LVDS输入可以配置单端口,双端口或者四端口,带有一个高速时钟通道,最多可运行三到四个高速数据…

FacetWP Relevanssi Integration相关性集成插件

点击阅读FacetWP Relevanssi Integration相关性集成插件原文 FacetWP Relevanssi Integration相关性集成插件是FacetWP与用于高级搜索的 Relevanssi 插件的集成显着增强了您网站的搜索功能。这个强大的工具使您的用户能够轻松找到他们寻求的特定内容,无论他们的查询…

【分布式算法】Raft算法详解

目录 一、什么是分布式一致性 二、Raft算法概述 三、Raft 算法的实现原理 3.1、Leader 选举 3.1.1、背景 3.1.2、有哪些成员身份 ​编辑 3.1.3、节点的状态转换 3.1.4、选举领导者的过程 3.1.5、节点间如何通讯? 3.1.6、什么是任期? 3.1.7、选…

SQL数据库知识点总结归纳

前后顺序可以任意颠倒,不影响库中的数据关系 关系数据库的逻辑性强而物理性弱,因此关系数据库中的各条记录前后顺序可以任意颠倒,不影响库中的数据关系 一名员工可以使用多台计算机(1:m),而一台计算机只能被一名员工使用(1:1),所以员工和计算机两个实体之间是一对多…

如何写出一个性能优化的单例模式

总结/朱季谦 单例模型是面试当中最常见的一种设计模式,它是一种对象创建模式,用于产生一个对象的具体实例,可以确保系统中一个类只产生一个实例。 简而言之,单例模式可以带来两个好处: 1、对于频繁使用到的对象&…

Linux--网络编程-ftp(TCP)网络通信-文件交互

项目要求:实现以下内容 远程控制: 1、查看服务器当前路径文件 ls 3、进入、退出服务器文件夹 cd 4、上传文件到服务器 put xxx 本地控制: 1、查看本地(客户端)文件 lls 2、进入客户端文件夹 lcd 3、获取服务器的文件…

MySQL笔记-第01章_数据库概述

视频链接:【MySQL数据库入门到大牛,mysql安装到优化,百科全书级,全网天花板】 文章目录 第01章_数据库概述1. 为什么要使用数据库2. 数据库与数据库管理系统2.1 数据库的相关概念2.2 数据库与数据库管理系统的关系2.3 常见的数据库…

n皇后问题的最优解及优化

n皇后问题的最优解 时间复杂度 package algorithm;public class NQueen {public static int num(int n){if(n < 1){return 0;}int[] record new int[n];//n皇后的n*n的棋盘&#xff0c;record[i]表示第i行的皇后放在了第几列return process(0,record,n);}/***返回n皇…

深入学习锁--Synchronized各种使用方法

一、什么是synchronized 在Java当中synchronized通常是用来标记一个方法或者代码块。在Java当中被synchronized标记的代码或者方法在同一个时刻只能够有一个线程执行被synchronized修饰的方法或者代码块。因此被synchronized修饰的方法或者代码块不会出现数据竞争的情况&#x…

Vue练习 v-model 指令在状态和表单输入之间创建双向绑定

效果&#xff1a; <template><h2>Text Input</h2><input v-model"text"> {{ text }}<h2>Checkbox</h2><input type"checkbox" id"checkbox" v-model"checked"><label for"checkbox…

使用VBA创建Excel条件格式

实例需求&#xff1a;数据总行数不确定&#xff0c;现需要将Category区域&#xff08;即C列到J列&#xff09;中第3行开始的区域设置条件格式&#xff0c;规则如下&#xff1a; 只对部分指定单元格应用色阶条件格式&#xff08;3色&#xff09;指定单元格应满足条件&#xff1…

抓取Chrome所有版本密码

谷歌浏览器存储密码的方式 在使用谷歌浏览器时,如果我们输入某个网站的账号密码,他会自动问我们是否要保存密码,以便下次登录的时候自动填写账号和密码 在设置中可以找到登录账户和密码 也可以直接看密码,不过需要凭证 这其实是windows的DPAPI机制 DPAPI Data Protection Ap…

微信小程序 纯css画仪表盘

刚看到设计稿的时候第一时间想到的就是用canvas来做这个仪表盘&#xff0c;虽然本人的画布用的不是很好但还可以写一写&#x1f600;。话不多说直接上代码。最后有纯css方法 <!--wxml--> <canvas canvas-id"circle" class"circle" >// js dat…

python pyaudio显示音频波形图

python pyaudio显示音频波形图 代码如下&#xff1a; import numpy as np import matplotlib.pylab as plb import wave# 读取 wav wf wave.open("./output.wav", "rb")# 获取音频相关参数&#xff1a;声道数、量化位数、采样频率、采样帧数 nchannels,…

Java多线程 - 黑马教程

文章目录 Java 多线程一、多线程概述二、 多线程创建方式1、继承 Thread 类创建线程2、实现 Runnable 接口3、实现 Callable 接口三、Thread 常用的方法四、线程安全什么是线程安全问题?线程安全问题出现的原因程序模拟线程安全五、线程同步线程同步方式1:同步代码块线程同步…

Opencv打开图片

cv.imread() oepncv中使用cv.imread函数读取图片&#xff0c;并打开窗口显示&#xff0c;以下是示例代码 import cv2 as cv import numpy as np from matplotlib import pyplot as pltsrc cv.imread("demo.jpg")#blue, green red cv.namedWindow("input ima…

GPIO的使用--时钟使能含义--代码封装

目录 一、时钟使能的含义 1.为什么要时钟使能&#xff1f; 2.什么是时钟使能&#xff1f; 3.GPIO的使能信号&#xff1f; 二、代码封装 1.封装前完整代码 2.封装结构 封装后代码 led.c led.h key.c key.h main.c 一、时钟使能的含义 1.为什么要时钟使能&#xff1f…