使用conan包 - 工作流程
使用conan包 - 工作流程
- 主目录 conan Using packages
- 1 Single configuration
- 2 Multi configuration
本文是基于对conan官方文档Workflows的翻译而来, 更详细的信息可以去查阅conan官方文档。
This section shows how to setup your project and manage dependencies (i.e., install existing packages) with Conan.
本节将介绍如何使用 Conan 设置项目和管理依赖关系(即安装现有软件包)。
主目录 conan Using packages
- Installing dependencies
- Requires
- Generators
- Options
- Using profiles
- Workflows
- Single configuration
- Multi configuration
- Debugging packages
This section summarizes some possible layouts and workflows when using Conan together with other tools as an end-user for installing and consuming existing packages. To create your own packages, please refer to Creating Packages.
本节总结了作为最终用户使用 Conan 和其他工具安装和使用现有软件包时的一些可能布局和工作流程。要创建自己的软件包,请参阅 “Creating Packages”。
Whether you are working on a single configuration or a multi configuration project, in both cases, the recommended approach is to have a conanfile (either .py or .txt) at the root of your project.
无论是单配置项目还是多配置项目,推荐的做法都是在项目根目录下建立一个 conanfile(.py 或 .txt)。
1 Single configuration
When working with a single configuration, your conanfile will be quite simple as shown in the examples and tutorials we have used so far in this user guide. For example, in Getting started, we showed how you can run the conan install … command inside the build folder resulting in the conaninfo.txt and conanbuildinfo.cmake files being generated there too. Note that the build folder is temporary, so you should exclude it from version control to exclude these temporary files.
在使用单一配置时,您的 conanfile 将非常简单,正如本用户指南中的示例和教程所示。例如,在 "Getting started"中,我们展示了如何在构建文件夹中运行 conan install …命令,从而在该文件夹中生成 conaninfo.txt 和 conanbuildinfo.cmake 文件。请注意,联编文件夹是临时文件,因此应将其从版本控制中排除,以排除这些临时文件。
Out-of-source builds are also supported. Let’s look at a simple example:
还支持源外构建。让我们来看一个简单的例子:
$ git clone https://github.com/conan-io/examples.git
$ cd libraries/poco
$ conan install ./md5 --install-folder=md5_build
This will result in the following layout:
这将产生以下布局:
md5_buildconaninfo.txtconanbuildinfo.txtconanbuildinfo.cmake
md5CMakeLists.txt # If using cmake, but can be Makefile, sln...README.mdconanfile.txtmd5.cpp
Now you are ready to build:
现在您已准备好构建了:
$ cd md5_build
$ cmake ../md5 -G "Visual Studio 15 Win64" # or other generator
$ cmake --build . --config Release
$ ./bin/md5
> c3fcd3d76192e4007dfb496cca67e13b
We have created a separate build configuration of the project without affecting the original source directory in any way. The benefit is that we can freely experiment with the configuration: We can clear the build folder and build another. For example, changing the build type to Debug:
我们为项目创建了一个独立的构建配置,但丝毫不影响原始源代码目录。这样做的好处是,我们可以自由地对配置进行实验: 我们可以清除构建文件夹,然后构建另一个文件夹。例如,将构建类型更改为调试:
$ rm -rf *
$ conan install ../md5 -s build_type=Debug
$ cmake ../md5 -G "Visual Studio 15 Win64"
$ cmake --build . --config Debug
$ ./bin/md5
> c3fcd3d76192e4007dfb496cca67e13b
2 Multi configuration
You can also manage different configurations, whether in-source or out of source, and switch between them without having to re-issue the conan install command (Note however, that even if you did have to run conan install again, since subsequent runs use the same parameters, they would be very fast since packages would already have been installed in the local cache rather than in the project)
您还可以管理不同的配置(无论是源内配置还是源外配置),并在它们之间切换,而无需重新发布 conan install 命令(请注意,即使您必须再次运行 conan install,由于后续运行使用相同的参数,它们也会非常快,因为软件包已经安装在本地缓存中,而不是项目中。
$ git clone git@github.com:conan-io/examples
$ cd libraries/poco
$ conan install md5 -s build_type=Debug -if md5_build_debug
$ conan install md5 -s build_type=Release -if md5_build_release$ cd md5_build_debug && cmake ../md5 -G "Visual Studio 15 Win64" && cd ../..
$ cd md5_build_release && cmake ../md5 -G "Visual Studio 15 Win64" && cd ../..
Note
You can either use the --install-folder or -if flags to specify where to generate the output files, or manually create the output directory and navigate to it before executing the conan install command.
您可以使用 --install-folder 或 -if 标志指定生成输出文件的位置,或者在执行 conan install 命令前手动创建输出目录并导航到该目录。
So the layout will be:
因此,布局将会是:
md5_build_debugconaninfo.txtconanbuildinfo.txtconanbuildinfo.cmakeCMakeCache.txt # and other cmake files
md5_build_releaseconaninfo.txtconanbuildinfo.txtconanbuildinfo.cmakeCMakeCache.txt # and other cmake files
example-poco-timerCMakeLists.txt # If using cmake, but can be Makefile, sln...README.mdconanfile.txtmd5.cpp
Now you can switch between your build configurations in exactly the same way you do for CMake or other build systems, by moving to the folder in which the build configuration is located, because the Conan configuration files for that build configuration will also be there.
现在,您可以用与 CMake 或其他构建系统完全相同的方式在构建配置之间切换,只需移动到构建配置所在的文件夹即可,因为该构建配置的 Conan 配置文件也在该文件夹中。
$ cd md5_build_debug && cmake --build . --config Debug && cd ../..
$ cd md5_build_release && cmake --build . --config Release && cd ../..
Note that the CMake include() of your project must be prefixed with the current cmake binary directory, otherwise it will not find the necessary file:
请注意,您项目的 CMake include() 必须以当前 cmake 二进制目录为前缀,否则它将找不到所需的文件:
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
See also
There are two generators, cmake_multi and visual_studio_multi that could help to avoid the context switch and using Debug and Release configurations simultaneously. Read more about them in cmake_multi and visual_studio_multi
cmake_multi 和 visual_studio_multi 这两个生成器可以帮助避免上下文切换,并同时使用Debug和Release配置。在 cmake_multi 和 visual_studio_multi 中了解更多。
相关文章:
使用conan包 - 工作流程
使用conan包 - 工作流程 主目录 conan Using packages1 Single configuration2 Multi configuration 本文是基于对conan官方文档Workflows的翻译而来, 更详细的信息可以去查阅conan官方文档。 This section shows how to setup your project and manage dependenci…...
【LeeCode】59.螺旋矩阵II
给定一个正整数 n,生成一个包含 1 到 n^2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。 示例: 输入: 3 输出: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] 解: class Solution {public int[][] generateMatrix(int n) {int[][] ar…...
rsyslog学习
rsyslog是什么 RSYSLOG(Remote System Logging)是一个开源的日志处理工具,用于在 Linux 和 Unix 系统上收集、处理和转发日志。它是一个健壮且高性能的日志处理程序,可以替换 Syslogd 作为标准的系统日志程序。RSYSLOG 提供了许多…...
Navicat 技术指引 | GaussDB服务器对象的创建/设计(编辑)
Navicat Premium(16.2.8 Windows版或以上) 已支持对GaussDB 主备版的管理和开发功能。它不仅具备轻松、便捷的可视化数据查看和编辑功能,还提供强大的高阶功能(如模型、结构同步、协同合作、数据迁移等),这…...
有哪些可信的SSL证书颁发机构?
目前市面上所显示的SSL证书颁发机构可所谓不计其数,类型也是多样,就好比我们同样是买一件T恤,却有百家不同类型的店铺一个道理。根据CA里面看似很多,但能拿到99%浏览器及设备信任度的寥寥无几,下面小编整理出几家靠谱可…...
MidJourney笔记(4)-settings
前面已经大概介绍了MidJourney的基础知识,后面我主要是基于实操来分享自己的笔记。可能内容顺序会有点乱,请大家理解。 这次主要是想讲讲settings这个命令。我们只需在控制台输入/settings,然后回车,就可以执行这个命令。 (2023年11月26日版本界面) 可能有些朋友出来的界…...
前端开发学习 (三) 列表功能
一、列表功能 1、列表功能 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><meta http-equiv"X-UA-Compa…...
win11渗透武器库,囊括所有渗透工具
开箱即用,最全的武器库,且都是2023年11月最新版,后续自己还可以再添加,下载地址:https://download.csdn.net/download/weixin_59679023/88565739 服务连接 信息收集工具 端口扫描 代理抓包 漏洞扫描 指纹识别 webshel…...
13-21-普通数组、矩阵
LeetCode 热题 100 文章目录 LeetCode 热题 100普通数组13. 中等-最大子数组和14. 中等-合并区间15. 中等-轮转数组16. 中等-除自身以外数组的乘积17. 困难-缺失的第一个正数 矩阵18. 中等-矩阵置零19. 中等-螺旋矩阵20. 中等-旋转图像21. 中等-搜索二维矩阵II 本文存储我刷题的…...
代码随想录算法训练营第四十六天【动态规划part08】 | 139.单词拆分、背包总结
139.单词拆分 题目链接: 力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 求解思路: 单词是物品,字符串s是背包,单词能否组成字符串s,就是问物品能不能把背包装满。 动规五部曲 确定dp数…...
go语言基础 break和contine区别
背景 break和continue是编程语言的标准语法,几乎在所有的语言都有类似的用法。 go语言及所有其他编程语言for循环或者其他循环 区别 for i : 0; i < 10; i {if i 5 {continue}fmt.Println(i)for j : 0; j < 3; j {fmt.Println(strconv.Itoa(j) "a&q…...
vue3父子组件通过$parent与ref通信
父组件 <template><div><h1>ref与$parents父子组件通信 {{ parentMoney }}</h1><button click"handler">点击我子组件的值会减20</button><hr><child ref"children"></child></div> </te…...
PHP中的常见的超全局变量
PHP是一种广泛使用的服务器端脚本语言,它被用于开发各种Web应用程序。在PHP中,有一些特殊的全局变量,被称为超全局变量。超全局变量在整个脚本中都是可用的,无需使用global关键字来访问它们。在本文中,我们将深入了解P…...
leetcode9.回文数
回文数 0.题目1.WJQ的思路2.实现过程2.0 原始值怎么一个个取出来?2.1 取出来的数如何存到新的数字后面?2.2完整的反转得到新数的过程 3.完整的代码4.可运行的代码5.算法还可以优化的部分 0.题目 给你一个整数 x ,如果 x 是一个回文整数&…...
springboot(ssm大学生二手电子产品交易平台 跳蚤市场系统Java(codeLW)
springboot(ssm大学生二手电子产品交易平台 跳蚤市场系统Java(code&LW) 开发语言:Java 框架:ssm/springboot vue JDK版本:JDK1.8(或11) 服务器:tomcat 数据库:mysql 5.7(或…...
关于微信小程序中如何实现数据可视化-echarts动态渲染
移动端设备中,难免会涉及到数据的可视化展示、数据统计等等,本篇主要讲解原生微信小程序中嵌入echarts并进行动态渲染,实现数据可视化功能。 基础使用 首先在GitHub上下载echarts包 地址:https://github.com/ecomfe/echarts-for…...
在Windows WSL (Linux的Windows子系统)上运行的Ubuntu如何更改主机名
在Windows 安装的Ubuntu,如何修改主机名。有列了两种方法,提供给大家参照。 文章目录 方法一:hostname指令修改方法二:修改配置文件修改hostnanmewsl.conf 文件配置选项推荐阅读 方法一:hostname指令修改 hostname指…...
如何使用内网穿透将Tomcat网页发布到公共互联网上【内网穿透】
文章目录 前言1.本地Tomcat网页搭建1.1 Tomcat安装1.2 配置环境变量1.3 环境配置1.4 Tomcat运行测试1.5 Cpolar安装和注册 2.本地网页发布2.1.Cpolar云端设置2.2 Cpolar本地设置 3.公网访问测试4.结语 前言 Tomcat作为一个轻量级的服务器,不仅名字很有趣࿰…...
网络入门---网络的大致了解
目录标题 网络发展的简单认识协议作用的理解协议的本质什么是协议分层网络通信所面对的问题OSI七层模型TCP/IP模型协议报头的理解局域网通信局域网通信基本原理报头的问题局域网的特点跨网的网络链接如何查看mac地址 网络发展的简单认识 通过之前的学习我们知道计算机是给人提…...
构建沉浸式 AI 文本编辑器:开源 3B 编辑器的设计原则与思路
借助于在 AutoDev 与 IDE 上的 AI 沉浸式体验设计,我们开始构建一个 AI 原生的文本编辑器,以探索沉浸式创作体验。其适用于需求编写、架构文档等等文档场景,以加速软件开发中的多种角色的日常工作。 GitHub:https://github.com/un…...
springboot 百货中心供应链管理系统小程序
一、前言 随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱,百货中心供应链管理系统被用户普遍使用,为方…...
边缘计算医疗风险自查APP开发方案
核心目标:在便携设备(智能手表/家用检测仪)部署轻量化疾病预测模型,实现低延迟、隐私安全的实时健康风险评估。 一、技术架构设计 #mermaid-svg-iuNaeeLK2YoFKfao {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg…...
【Java学习笔记】Arrays类
Arrays 类 1. 导入包:import java.util.Arrays 2. 常用方法一览表 方法描述Arrays.toString()返回数组的字符串形式Arrays.sort()排序(自然排序和定制排序)Arrays.binarySearch()通过二分搜索法进行查找(前提:数组是…...
Redis数据倾斜问题解决
Redis 数据倾斜问题解析与解决方案 什么是 Redis 数据倾斜 Redis 数据倾斜指的是在 Redis 集群中,部分节点存储的数据量或访问量远高于其他节点,导致这些节点负载过高,影响整体性能。 数据倾斜的主要表现 部分节点内存使用率远高于其他节…...
【网络安全】开源系统getshell漏洞挖掘
审计过程: 在入口文件admin/index.php中: 用户可以通过m,c,a等参数控制加载的文件和方法,在app/system/entrance.php中存在重点代码: 当M_TYPE system并且M_MODULE include时,会设置常量PATH_OWN_FILE为PATH_APP.M_T…...
Kafka主题运维全指南:从基础配置到故障处理
#作者:张桐瑞 文章目录 主题日常管理1. 修改主题分区。2. 修改主题级别参数。3. 变更副本数。4. 修改主题限速。5.主题分区迁移。6. 常见主题错误处理常见错误1:主题删除失败。常见错误2:__consumer_offsets占用太多的磁盘。 主题日常管理 …...
【把数组变成一棵树】有序数组秒变平衡BST,原来可以这么优雅!
【把数组变成一棵树】有序数组秒变平衡BST,原来可以这么优雅! 🌱 前言:一棵树的浪漫,从数组开始说起 程序员的世界里,数组是最常见的基本结构之一,几乎每种语言、每种算法都少不了它。可你有没有想过,一组看似“线性排列”的有序数组,竟然可以**“长”成一棵平衡的二…...
边缘计算网关提升水产养殖尾水处理的远程运维效率
一、项目背景 随着水产养殖行业的快速发展,养殖尾水的处理成为了一个亟待解决的环保问题。传统的尾水处理方式不仅效率低下,而且难以实现精准监控和管理。为了提升尾水处理的效果和效率,同时降低人力成本,某大型水产养殖企业决定…...
华为云Flexus+DeepSeek征文 | 基于Dify构建具备联网搜索能力的知识库问答助手
华为云FlexusDeepSeek征文 | 基于Dify构建具备联网搜索能力的知识库问答助手 一、构建知识库问答助手引言二、构建知识库问答助手环境2.1 基于FlexusX实例的Dify平台2.2 基于MaaS的模型API商用服务 三、构建知识库问答助手实战3.1 配置Dify环境3.2 创建知识库问答助手3.3 使用知…...
【Linux】使用1Panel 面板让服务器定时自动执行任务
服务器就是一台24小时开机的主机,相比自己家中不定时开关机的主机更适合完成定时任务,例如下载资源、备份上传,或者登录某个网站执行一些操作,只需要编写 脚本,然后让服务器定时来执行这个脚本就可以。 有很多方法实现…...
