使用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…...
极简自动化:OpenClaw+Qwen3-32B处理微信聊天文件归档
极简自动化:OpenClawQwen3-32B处理微信聊天文件归档 1. 为什么需要自动化文件归档? 每次打开微信文件传输助手,看到满屏的"文档1(1).pdf"和"图片1(1).jpg"时,我都会陷入深深的无力感。作为一名技术从业者&a…...
【数据结构与算法】第28篇:平衡二叉树(AVL树)
一、AVL树的定义1.1 平衡因子平衡因子 左子树高度 - 右子树高度AVL树要求所有节点的平衡因子只能是 -1、0、1。text节点高度:从该节点到最远叶子节点的边数 空树高度:-1 或 0(不同定义,本文用-1)1.2 为什么需要平衡普…...
MacBook安装OpenClaw避坑指南:Qwen3-14B镜像对接常见问题
MacBook安装OpenClaw避坑指南:Qwen3-14B镜像对接常见问题 1. 为什么选择OpenClawQwen3-14B组合 去年底我开始尝试用AI自动化处理日常办公任务时,发现大多数方案要么需要将敏感数据上传到云端,要么功能过于局限。直到遇到OpenClaw这个开源框…...
Interactive-Deep-Colorization未来发展方向:从学术研究到商业应用的完整指南
Interactive-Deep-Colorization未来发展方向:从学术研究到商业应用的完整指南 【免费下载链接】interactive-deep-colorization Deep learning software for colorizing black and white images with a few clicks. 项目地址: https://gitcode.com/gh_mirrors/in/…...
Project Quay故障排查指南:常见问题及解决方案
Project Quay故障排查指南:常见问题及解决方案 【免费下载链接】quay Build, Store, and Distribute your Applications and Containers 项目地址: https://gitcode.com/gh_mirrors/quay/quay Project Quay是一款强大的容器镜像仓库管理工具,用于…...
台达 PLC ES 与 3 台欧姆龙 E5CC 温控器通讯程序分享
台达PLC ES与3台欧姆龙E5CC温控器通讯程序 程序带注释,并附送昆仑通态和威纶通触摸屏有接线方式,设置 程序温度可靠 器件:台达DVP ES系列的PLC,3台欧姆龙E5CC系列温控器,昆仑通态,威纶通触摸屏 功能&#x…...
从父子到祖孙:用Protege玩转OWL属性链推理的3个典型场景
从父子到祖孙:用Protege玩转OWL属性链推理的3个典型场景 家族族谱中"曾祖父"的自动推导、企业架构里"间接上级"的智能识别、生物遗传学里"隔代基因传递"的规律验证——这些看似不相关的场景,其实都藏着同一个知识图谱建模…...
深入解析Kubernetes中的Custom Resource Definitions(CRD):构建云原生“自定义积木”的终极武器
摘要Custom Resource Definition(CRD)是Kubernetes扩展API的核心机制,它允许用户在不修改Kubernetes核心代码的情况下,向集群中注入自定义的资源类型。自Kubernetes 1.7引入以来,CRD已成为云原生生态系统的基石技术&am…...
Ubuntu 22.04下Milvus集群部署实战:从Docker提取二进制文件的完整指南
Ubuntu 22.04下Milvus集群部署实战:从Docker提取二进制文件的完整指南 在向量数据库领域,Milvus凭借其出色的性能和可扩展性已成为众多AI应用的首选存储引擎。虽然官方推荐使用Docker或Kubernetes进行部署,但在某些生产环境中,直接…...
用C++和Winsock从零搭建一个局域网聊天室(附完整代码)
用C和Winsock构建高效局域网聊天室的实战指南 在当今数字化协作环境中,即时通讯工具已成为团队沟通的标配。虽然市面上已有成熟的商业解决方案,但理解底层网络通信原理对于开发者而言至关重要。本文将带你从零开始,用C和Winsock API构建一个…...
