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

使用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_multivisual_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渗透武器库,囊括所有渗透工具

开箱即用&#xff0c;最全的武器库&#xff0c;且都是2023年11月最新版&#xff0c;后续自己还可以再添加&#xff0c;下载地址&#xff1a;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.单词拆分 题目链接&#xff1a; 力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成长平台 求解思路&#xff1a; 单词是物品&#xff0c;字符串s是背包&#xff0c;单词能否组成字符串s&#xff0c;就是问物品能不能把背包装满。 动规五部曲 确定dp数…...

go语言基础 break和contine区别

背景 break和continue是编程语言的标准语法&#xff0c;几乎在所有的语言都有类似的用法。 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是一种广泛使用的服务器端脚本语言&#xff0c;它被用于开发各种Web应用程序。在PHP中&#xff0c;有一些特殊的全局变量&#xff0c;被称为超全局变量。超全局变量在整个脚本中都是可用的&#xff0c;无需使用global关键字来访问它们。在本文中&#xff0c;我们将深入了解P…...

leetcode9.回文数

回文数 0.题目1.WJQ的思路2.实现过程2.0 原始值怎么一个个取出来&#xff1f;2.1 取出来的数如何存到新的数字后面&#xff1f;2.2完整的反转得到新数的过程 3.完整的代码4.可运行的代码5.算法还可以优化的部分 0.题目 给你一个整数 x &#xff0c;如果 x 是一个回文整数&…...

springboot(ssm大学生二手电子产品交易平台 跳蚤市场系统Java(codeLW)

springboot(ssm大学生二手电子产品交易平台 跳蚤市场系统Java(code&LW) 开发语言&#xff1a;Java 框架&#xff1a;ssm/springboot vue JDK版本&#xff1a;JDK1.8&#xff08;或11&#xff09; 服务器&#xff1a;tomcat 数据库&#xff1a;mysql 5.7&#xff08;或…...

关于微信小程序中如何实现数据可视化-echarts动态渲染

移动端设备中&#xff0c;难免会涉及到数据的可视化展示、数据统计等等&#xff0c;本篇主要讲解原生微信小程序中嵌入echarts并进行动态渲染&#xff0c;实现数据可视化功能。 基础使用 首先在GitHub上下载echarts包 地址&#xff1a;https://github.com/ecomfe/echarts-for…...

在Windows WSL (Linux的Windows子系统)上运行的Ubuntu如何更改主机名

在Windows 安装的Ubuntu&#xff0c;如何修改主机名。有列了两种方法&#xff0c;提供给大家参照。 文章目录 方法一&#xff1a;hostname指令修改方法二&#xff1a;修改配置文件修改hostnanmewsl.conf 文件配置选项推荐阅读 方法一&#xff1a;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作为一个轻量级的服务器&#xff0c;不仅名字很有趣&#xff0…...

网络入门---网络的大致了解

目录标题 网络发展的简单认识协议作用的理解协议的本质什么是协议分层网络通信所面对的问题OSI七层模型TCP/IP模型协议报头的理解局域网通信局域网通信基本原理报头的问题局域网的特点跨网的网络链接如何查看mac地址 网络发展的简单认识 通过之前的学习我们知道计算机是给人提…...

构建沉浸式 AI 文本编辑器:开源 3B 编辑器的设计原则与思路

借助于在 AutoDev 与 IDE 上的 AI 沉浸式体验设计&#xff0c;我们开始构建一个 AI 原生的文本编辑器&#xff0c;以探索沉浸式创作体验。其适用于需求编写、架构文档等等文档场景&#xff0c;以加速软件开发中的多种角色的日常工作。 GitHub&#xff1a;https://github.com/un…...

visual studio 2022更改主题为深色

visual studio 2022更改主题为深色 点击visual studio 上方的 工具-> 选项 在选项窗口中&#xff0c;选择 环境 -> 常规 &#xff0c;将其中的颜色主题改成深色 点击确定&#xff0c;更改完成...

关于iview组件中使用 table , 绑定序号分页后序号从1开始的解决方案

问题描述&#xff1a;iview使用table 中type: "index",分页之后 &#xff0c;索引还是从1开始&#xff0c;试过绑定后台返回数据的id, 这种方法可行&#xff0c;就是后台返回数据的每个页面id都不完全是按照从1开始的升序&#xff0c;因此百度了下&#xff0c;找到了…...

Frozen-Flask :将 Flask 应用“冻结”为静态文件

Frozen-Flask 是一个用于将 Flask 应用“冻结”为静态文件的 Python 扩展。它的核心用途是&#xff1a;将一个 Flask Web 应用生成成纯静态 HTML 文件&#xff0c;从而可以部署到静态网站托管服务上&#xff0c;如 GitHub Pages、Netlify 或任何支持静态文件的网站服务器。 &am…...

【Go】3、Go语言进阶与依赖管理

前言 本系列文章参考自稀土掘金上的 【字节内部课】公开课&#xff0c;做自我学习总结整理。 Go语言并发编程 Go语言原生支持并发编程&#xff0c;它的核心机制是 Goroutine 协程、Channel 通道&#xff0c;并基于CSP&#xff08;Communicating Sequential Processes&#xff0…...

AI,如何重构理解、匹配与决策?

AI 时代&#xff0c;我们如何理解消费&#xff1f; 作者&#xff5c;王彬 封面&#xff5c;Unplash 人们通过信息理解世界。 曾几何时&#xff0c;PC 与移动互联网重塑了人们的购物路径&#xff1a;信息变得唾手可得&#xff0c;商品决策变得高度依赖内容。 但 AI 时代的来…...

Xen Server服务器释放磁盘空间

disk.sh #!/bin/bashcd /run/sr-mount/e54f0646-ae11-0457-b64f-eba4673b824c # 全部虚拟机物理磁盘文件存储 a$(ls -l | awk {print $NF} | cut -d. -f1) # 使用中的虚拟机物理磁盘文件 b$(xe vm-disk-list --multiple | grep uuid | awk {print $NF})printf "%s\n"…...

【Redis】笔记|第8节|大厂高并发缓存架构实战与优化

缓存架构 代码结构 代码详情 功能点&#xff1a; 多级缓存&#xff0c;先查本地缓存&#xff0c;再查Redis&#xff0c;最后才查数据库热点数据重建逻辑使用分布式锁&#xff0c;二次查询更新缓存采用读写锁提升性能采用Redis的发布订阅机制通知所有实例更新本地缓存适用读多…...

【Linux】自动化构建-Make/Makefile

前言 上文我们讲到了Linux中的编译器gcc/g 【Linux】编译器gcc/g及其库的详细介绍-CSDN博客 本来我们将一个对于编译来说很重要的工具&#xff1a;make/makfile 1.背景 在一个工程中源文件不计其数&#xff0c;其按类型、功能、模块分别放在若干个目录中&#xff0c;mak…...

通过 Ansible 在 Windows 2022 上安装 IIS Web 服务器

拓扑结构 这是一个用于通过 Ansible 部署 IIS Web 服务器的实验室拓扑。 前提条件&#xff1a; 在被管理的节点上安装WinRm 准备一张自签名的证书 开放防火墙入站tcp 5985 5986端口 准备自签名证书 PS C:\Users\azureuser> $cert New-SelfSignedCertificate -DnsName &…...

​​企业大模型服务合规指南:深度解析备案与登记制度​​

伴随AI技术的爆炸式发展&#xff0c;尤其是大模型&#xff08;LLM&#xff09;在各行各业的深度应用和整合&#xff0c;企业利用AI技术提升效率、创新服务的步伐不断加快。无论是像DeepSeek这样的前沿技术提供者&#xff0c;还是积极拥抱AI转型的传统企业&#xff0c;在面向公众…...