conan2 基础入门(05)-(静态库动态库)(DebugRelease)

conan2 基础入门(05)-(静态库&动态库)(Debug&Release)

文章目录

  • conan2 基础入门(05)-(静态库&动态库)(Debug&Release)
  • ⭐准备
    • 预备文件和Code
  • ⭐静态库&动态库
    • 静态库
    • 动态库
  • ⭐Debug&Release
    • Release
    • Debug
  • END
    • 视频教学
    • settings.yml

⭐准备

本文均在windows下测试,使用msvc编译器。

预备文件和Code

文件名预览

conanfile.txt的具体内容,见下。

:.
│  CMakeLists.txt
│  conanfile.txt
└─ main.cpp

main.cpp

#include <json/json.h>#include <iostream>void test_env() {std::cout << ">>>" << __func__ << std::endl;std::cout << "sizeof(void*) = " << sizeof(void *) << std::endl;
#if defined(_MSC_VER)// msvc的判断方式
#ifdef _DEBUGstd::cout << "Debug version" << std::endl;
#elsestd::cout << "Release version" << std::endl;
#endifstd::cout << "_MSC_VER = " << _MSC_VER << std::endl;
#endif
}void test_jsoncpp(void) {std::cout << ">>>" << __func__ << std::endl;Json::Value up;up["name"]     = "cuber-lotus";up["bilibili"] = "https://space.bilibili.com/8172252";std::cout << "up: " << up << std::endl;
}int main(void) {test_env();test_jsoncpp();system("pause");
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(mydemo CXX)set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)find_package(jsoncpp REQUIRED)add_executable(${PROJECT_NAME} main.cpp)target_link_libraries(${PROJECT_NAME} JsonCpp::JsonCpp)

⭐静态库&动态库

相同部分

profile : default

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=192
os=Windows

流程指令

conan install . --output-folder=build --build=missingcd buildcmake .. -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"cmake --build . --config Releasecd ../bin/Releasemydemo.exe

静态库

conanfile.txt

显示指定zlib使用静态库。(默认也是静态库)

[requires]
jsoncpp/1.9.5[generators]
CMakeDeps
CMakeToolchain[options]
jsoncpp*:shared=False

动态库

conanfile.txt

[requires]
jsoncpp/1.9.5[generators]
CMakeDeps
CMakeToolchain[options]
jsoncpp*:shared=True

补充解释

直接写*:shared=True这样的话,[requires]中的所有库都是动态库了。

在这里插入图片描述

⭐Debug&Release

相同部分

conanfile.txt

[requires]
jsoncpp/1.9.5[generators]
CMakeDeps
CMakeToolchain

Release

profile : default

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=192
os=Windows

流程指令

conan install . --output-folder=build --build=missingcd buildcmake .. -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"cmake --build . --config Releasecd ../bin/Releasemydemo.exe

Debug

profile : default

主要区分在build_type=Debug

[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=192
os=Windows

流程指令

conan install . --output-folder=build --build=missingcd buildcmake .. -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"@REM --config Debug 可以省略
cmake --build . --config Debugcd ../bin/Debugmydemo.exe

补充解释

# build_type 共有5模式
build_type: [null, Debug, Release, RelWithDebInfo, MinSizeRel]



END

视频教学

conan2.0 基础入门 (主流的C/C++包管理工具)_哔哩哔哩_bilibili

settings.yml

# 在配置home下的 `settings.yml`
conan config homeC:\Users\{用户名}\.conan2\settings.yml
# This file was generated by Conan. Remove this comment if you edit this file or Conan
# will destroy your changes.
os:Windows:subsystem: [null, cygwin, msys, msys2, wsl]WindowsStore:version: ["8.1", "10.0"]WindowsCE:platform: [ANY]version: ["5.0", "6.0", "7.0", "8.0"]Linux:iOS:version: &ios_version["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3","11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4","13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7","14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8","15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1","16.2", "16.3", "16.4", "16.5", "16.6", "17.0", "17.1"]sdk: ["iphoneos", "iphonesimulator"]sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4","13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7","14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4","15.5", "16.0", "16.1", "16.2", "16.4", "17.0", "17.1"]watchOS:version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2","7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4","8.5", "8.6", "8.7", "9.0", "9.1", "9.2", "9.3", "9.4", "9.5", "9.6","10.0", "10.1"]sdk: ["watchos", "watchsimulator"]sdk_version: [null, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2","7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1","9.4", "10.0", "10.1"]tvOS:version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4","13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5","14.6", "14.7", "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6","16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "17.0", "17.1"]sdk: ["appletvos", "appletvsimulator"]sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4","13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0","15.2", "15.4", "16.0", "16.1", "16.4", "17.0", "17.1"]visionOS:version: ["1.0"]sdk: ["xros", "xrsimulator"]sdk_version: [null, "1.0"]Macos:version: [null, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15","11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "11.6", "11.7","12.0", "12.1", "12.2", "12.3", "12.4", "12.5", "12.6", "12.7","13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6","14.0", "14.1", "14.2", "14.3", "14.4"]sdk_version: [null, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1","12.3", "13.0", "13.1", "13.3", "14.0"]subsystem:null:catalyst:ios_version: *ios_versionAndroid:api_level: [ANY]FreeBSD:SunOS:AIX:Arduino:board: [ANY]Emscripten:Neutrino:version: ["6.4", "6.5", "6.6", "7.0", "7.1"]baremetal:VxWorks:version: ["7"]
arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64,armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, arm64ec,sparc, sparcv9,mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le,e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7,riscv64, riscv32,xtensalx6, xtensalx106, xtensalx7]
compiler:sun-cc:version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"]threads: [null, posix]libcxx: [libCstd, libstdcxx, libstlport, libstdc++]gcc:version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9","5", "5.1", "5.2", "5.3", "5.4", "5.5","6", "6.1", "6.2", "6.3", "6.4", "6.5","7", "7.1", "7.2", "7.3", "7.4", "7.5","8", "8.1", "8.2", "8.3", "8.4", "8.5","9", "9.1", "9.2", "9.3", "9.4", "9.5","10", "10.1", "10.2", "10.3", "10.4", "10.5","11", "11.1", "11.2", "11.3", "11.4","12", "12.1", "12.2", "12.3","13", "13.1", "13.2"]libcxx: [libstdc++, libstdc++11]threads: [null, posix, win32]  # Windows MinGWexception: [null, dwarf2, sjlj, seh]  # Windows MinGWcppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]msvc:version: [170, 180, 190, 191, 192, 193]update: [null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]runtime: [static, dynamic]runtime_type: [Debug, Release]cppstd: [null, 14, 17, 20, 23]toolset: [null, v110_xp, v120_xp, v140_xp, v141_xp]clang:version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0","5.0", "6.0", "7.0", "7.1","8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"]libcxx: [null, libstdc++, libstdc++11, libc++, c++_shared, c++_static]cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]runtime: [null, static, dynamic]runtime_type: [null, Debug, Release]runtime_version: [null, v140, v141, v142, v143]apple-clang:version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1","10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0", "15", "15.0"]libcxx: [libstdc++, libc++]cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]intel-cc:version: ["2021.1", "2021.2", "2021.3", "2021.4", "2022.1", "2022.2","2022.3", "2023.0", "2023.1", "2023.2", "2024.0",]update: [null, ANY]mode: ["icx", "classic", "dpcpp"]libcxx: [null, libstdc++, libstdc++11, libc++]cppstd: [null, 98, gnu98, "03", gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]runtime: [null, static, dynamic]runtime_type: [null, Debug, Release]qcc:version: ["4.4", "5.4", "8.3"]libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne]cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]mcst-lcc:version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]libcxx: [libstdc++, libstdc++11]cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]build_type: [null, Debug, Release, RelWithDebInfo, MinSizeRel]

关注我,学习更多C/C++,算法,计算机知识

B站:

👨‍💻主页:天赐细莲 bilibili

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

设计模式-创建型-原型模式-prototype

工作经验类 public class WorkExperience implements Cloneable {private String workDate;private String company;public void setWorkDate(String workDate) {this.workDate workDate;}public void setCompany(String company) {this.company company;}Overridepublic Ob…

数据结构与算法学习笔记三---循环队列的表示和实现(C++)

目录 前言 1.为什么要使用循环队列 2.队列的顺序存储方式的实现 1.定义 2.队列初始化 3.销毁 4.清空队列 5.队列是否为空 6.队列长度 7.队头 8.入队 9.出队 10.遍历队列 11.完整代码 3.参考资料 前言 这篇文章介绍循环队列的表示和用法。 1.为什么要使用循环队…

Vue3:路由

1. 路由简介 在Vue3中&#xff0c;路由是一个核心概念&#xff0c;特别是在构建单页面应用程序&#xff08;SPA&#xff09;时。以下是Vue3中路由的基本概念&#xff1a; 1. **路由&#xff08;Route&#xff09;**&#xff1a;在Vue3中&#xff0c;路由是指根据特定的规则将用…

Leetcode3138. 同位字符串连接的最小长度

Every day a Leetcode 题目来源&#xff1a;3138. 同位字符串连接的最小长度 解法1&#xff1a;枚举同位子串的长度 从小到大枚举字符串 t 的长度 len。 因为字符串 s 由字符串 t 和它的同位字符串连接而成&#xff0c;所以 n % len 0。 然后比较所有首字母下标为 0、len…

HTML/CSS3

1.CSS CSS的作用在于在HTML的基础上(决定网页的内容和结构)对网页进行排版布局 对网页中的元素提供样式 使得网页显得更加精美CSS全称是cascading style sheets 即层叠样式表CSS样式的书写格式&#xff1a;样式名: 样式值 例如&#xff1a;color: red建议:之后进行空格 CSS样式…

redis的双写一致性

双写一致性问题 1.先删除缓存或者先修改数据库都可能出现脏数据。 2.删除两次缓存&#xff0c;可以在一定程度上降低脏数据的出现。 3.延时是因为数据库一般采用主从分离&#xff0c;读写分离。延迟一会是让主节点把数据同步到从节点。 1.读写锁保证数据的强一致性 因为一般放…

在 Python 的哪个版本之后,字典的添加顺序与键的顺序是一致的?

&#x1f349; CSDN 叶庭云&#xff1a;https://yetingyun.blog.csdn.net/ 在 Python 的不同版本中&#xff0c;字典&#xff08;dict&#xff09;类型的行为发生了显著变化。在 Python 3.6 及之前的版本中&#xff0c;字典是无序的&#xff0c;这意味着字典在遍历时不能保证按…

笨方法自学python(一)

我觉得python和c语言有很多相似之处&#xff0c;如果有c语言基础的话学习python也不是很难。这一系列主要是学习例题来学习python&#xff1b;我用的python版本是3.12 代码编辑器我用的是notepad&#xff0c;运行py程序用cmd 现在开始写第一个程序&#xff1a; print ("…

GPT-SoVits:语音克隆,语音融合

首发网站 https://tianfeng.space 前言 零样本文本到语音&#xff08;TTS&#xff09;&#xff1a; 输入 5 秒的声音样本&#xff0c;即刻体验文本到语音转换。少样本 TTS&#xff1a; 仅需 1 分钟的训练数据即可微调模型&#xff0c;提升声音相似度和真实感。跨语言支持&…

ESP32 + ST7789 LCD

1、准备 ESP32 单片机开发板 ST7789 LCD 模块&#xff08;240 * 320 像素&#xff09; 杜邦线 2、接线 LCD功能ESP32VCC 供电电压正极 3.3V 、 5V GND 供电电压负极 GNDIDN / MOSI SPI 接口数据 引脚 23CLK 串行接口时钟信号 18CS 芯片选择引脚&#xff1b;低电平有效 5DC 显…

【实战】采用jenkins pipeline实现自动构建并部署至k8s

文章目录 前言部署jenkins编写docker-compose-jenkins.yaml配置maven源启动jenkins解锁jenkins Jenkins默认插件及git、镜像仓库、k8s凭证配置host key verification configuration修改为不验证Gitee ssh阿里云镜像仓库ssh编写pipeline安装以下常用插件将kubectl命令文件拷贝到…

Threejs 动态修改InstanceMesh实例化几何体中单个实例的颜色

目录 InstanceMesh多实例 场景 思路 注意点 实现 效果 InstanceMesh多实例 instanceMesh 是使用InstancedMesh类来创建实例化的几何体。它适用于当需要大量重复的几何体时&#xff0c;但是每个实例之间有不同的变换属性&#xff08;如位置、旋转、缩放等&#xff09; 场…

windows使用Docker-Desktop部署lobe-chat

文章目录 window安装docker-desktop下载和启动lobe-chatAI大语言模型的选择lobe-chat设置大模型连接 window安装docker-desktop docker-desktop下载地址 正常安装应用&#xff0c;然后启动应用&#xff0c;注意启动docker引擎 打开右上角的设置&#xff0c;进入Docker Engine设…

【系统分析师】软件架构设计

文章目录 1、构件与软件复用1.1 主流构件标准1.2 构件获取与管理1.3 构件复用的方法 2、软件架构概述3、软件架构建模4、软件架构风格4.1 经典架构风格4.2 层次架构风格4.3 富互联网应用-RIA 5、面向服务的架构5.1 SOA概述5.2 SOA的关键技术5.3 SOA的实现方法 6、软件架构评估6…

Golang | Leetcode Golang题解之第83题删除排序链表中的重复元素

题目&#xff1a; 题解&#xff1a; func deleteDuplicates(head *ListNode) *ListNode {if head nil {return nil}cur : headfor cur.Next ! nil {if cur.Val cur.Next.Val {cur.Next cur.Next.Next} else {cur cur.Next}}return head }

前端开发工程师——ajax

express框架 终端输入 npm init --yes npm i express 请求报文/响应报文 // 1.引入express const express require(express);// 2.创建应用对象 const app express();// 3.创建路由规则 // request:是对请求报文的封装 // response&#xff1a;是对响应报文的封装 app.get(…

【数据结构】浅谈

✨✨✨专栏&#xff1a;数据结构 &#x1f9d1;‍&#x1f393;个人主页&#xff1a;SWsunlight 目录 一、概念&#xff1a; 二、物理结构&#xff1a; 1、顺序存储结构&#xff1a; 2、链式存储结构&#xff1a; 3、数据索引存储结构: 4、数据散列存储结构&#xf…

SVN 合并到 Git 时有文件大于 100 M 被限制 Push

如果有文件大小大于 100M&#xff0c;GitHub 是会被限制推送到仓库中的&#xff0c;大概率情况会显示下面的错误&#xff1a; remote: Resolving deltas: 100% (3601/3601), done. remote: error: Trace: aea1f450da6f2ef7bfce457c715d0fbb9b0f6d428fdca80233aff34b601ff59b re…

声明变量的六种方法

ES6 声明变量的六种方法 varfunctionletconstclassimport 顶层对象的属性 1. ES6 声明变量的六种方法 ES5 只有两种声明变量的方法&#xff1a; var 命令和 function 命令。 ES6 除了添加 let 和 const 命令&#xff0c;还有另外两种声明变量的方法&#xff1a; import 命令和…

笨方法自学python(二)-注释

注释和#号 程序里的注释是很重要的。它们可以用自然语言告诉你某段代码的功能是什么。在你想要临时移除一段代码时&#xff0c;你还可以用注解的方式将这段代码临时禁用。 # A comment, this is so you can read your program later. # Anything after the # is ignored by py…