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.mzph.cn/pingmian/10576.shtml

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

相关文章

5.神经网络-激活函数

目录 1. 激活函数不是阶跃函数 1.1 激活函数和阶跃函数都是非线性函数 1.2 激活函数不是阶跃函数 2. sigmoid 函数 2.1 sigmoid 函数表达式 2.2 sigmoid 函数 Python 实现 2.4 sigmoid 函数图 3. ReLU 函数 3.1 ReLU 函数表达式 3.2 ReLU 函数 Python 实现 3.4 ReLU…

线性集合:ArrayList,LinkedList,Vector/Stack

共同点&#xff1a;都是线性集合 ArrayList ArrayList 底层是基于数组实现的&#xff0c;并且实现了动态扩容&#xff08;当需要添加新元素时&#xff0c;如果 elementData 数组已满&#xff0c;则会自动扩容&#xff0c;新的容量将是原来的 1.5 倍&#xff09;&#xff0c;来…

Rust使用HashSet对Vec类型的元素进行去重

在Rust语言中&#xff0c;对Vec类型的元素进行去重&#xff0c;一种常见的方法是使用一个HashSet来帮助我们快速检查元素是否已经存在。以下是使用HashSet对Vec进行去重的示例代码&#xff1a; use std::collections::HashSet;fn main() {let vec_numbers vec![1, 2, 2, 3, 4…

Java后端初始化项目(项目模板)

介绍 emmmm&#xff0c;最近看了一些网络资料&#xff0c;也是心血来潮&#xff0c;想自己手工搭建一个java后端的初始化项目模板来简化一下开发&#xff0c;也就发一个模板的具体制作流程&#xff0c;&#xff08;一步一步搭建&#xff0c;从易到难&#xff09; ok&#xff…

vue2和vue3区别: 探索关键差异

vue2和vue3区别&#xff1a; 探索关键差异 Vue.js 作为流行的前端框架&#xff0c;其版本 3 带来了许多令人兴奋的改进和新功能。虽然 Vue 3 保持了与 Vue 2 的相似性&#xff0c;但也存在一些关键差异需要开发者注意。本文将通过表格形式&#xff0c;清晰地展现 Vue 2 和 Vue …

刷代码随想录有感(63):将有序数组转换为二叉搜索树(其实时二叉平衡搜索树)

题干&#xff1a; 代码&#xff1a; class Solution { public:TreeNode* traversal(vector<int>& nums, int left, int right){if(left > right)return NULL;int mid left (right - left)/2;TreeNode* NewRoot new TreeNode(nums[mid]);NewRoot->left tra…

【GO】go语言中的HTTP标准库 - http编程

上一节已经学习了HTTP的基础知识&#xff0c;本章将学习关于go语言的HTTP编程&#xff0c;最重要的是掌握 net/http 包的用法&#xff0c;以及如何自己编写一个简单的Web服务端&#xff0c;通过客户端访问Server端等。 编写简单的Web 服务器 http.ListenAndServe 启动 Http S…

制作跳动的爱心网页效果

html <!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8"> <meta name"viewport" content"widthdevice-width, initial-scale1.0"> <title>跳动的爱心</title> <link rel&q…

Chatgpt的应用场景

文案创作类&#xff1a; 作为一名大型语言模型&#xff0c;ChatGPT可以为使用者提供多种文本处理和文字创作方面的服务&#xff0c;例如&#xff1a; 文本生成和创作 ChatGPT可以基于您提供的主题、关键词或文本段落&#xff0c;生成符合使用者要求的新文本。这些文本可以是文…

Linux:Figshare网站文件下载(非浏览器)

参考aws亚马逊云下载figshare内容 Linux wget -c 下载网页内容crul -C_figshare怎么下载数据-CSDN博客 尝试一下 mamba search awscli mamba install awscli2.15.48 aws --version通过网页获取下载链接 比如&#xff1a; https://s3-eu-west-1.amazonaws.com/pfigshare-u-…

Centos 停服倒计时!你的操作系统何去何从?

在计算机技术的不断演进中&#xff0c;操作系统扮演着至关重要的角色。然而&#xff0c;对于许多企业和个人用户来说&#xff0c;CentOS的突然停服消息带来了一场不小的冲击。作为一款备受欢迎的企业级Linux发行版&#xff0c;CentOS的停服意味着用户需要重新评估自己的操作系统…

如何清除DNS缓存,刷新DNS

大家在使用域名访问服务器的时候&#xff0c;经常会遇到一个问题&#xff0c;同一个局域网里的两台电脑&#xff0c;一台可以访问而另一台不行。这是为什么呢&#xff1f;这里我要和大家说下DNS缓存的问题&#xff0c;顾名思义&#xff0c;每台电脑都有DNS缓存&#xff0c;在域…

2024年数维杯数学建模

高质量原创论文已完成 需要的私我

虚拟化技术 安装和配置StartWind iSCSI目标服务器

一、实验内容 安装StartWind iSCSI目标服务器配置StartWind iSCSI目标服务器 二、实验主要仪器设备及材料 安装有64位Windows操作系统的台式电脑或笔记本电脑&#xff0c;建议4C8G或以上配置已安装vSphere Client已创建虚拟机并在其上安装CentOS6.5StarWind安装介质starwind.…

科技查新中化工领域查新点如何确立与提炼?案例讲解!

我国化工科技查新工作始于1985年&#xff0c;至今经历了30多年的发展。化工类课题包含化工、炼油、 冶金、能源、轻工、石化、环境、医药、环保和军工等&#xff0c; 具有物质种类繁多、制备工艺复杂等特点。因此&#xff0c;本文结合化工查新项目实例&#xff0c;总结提高化工…

数组二叉树-华为OD

系列文章目录 文章目录 系列文章目录前言一、题目描述二、输入描述三、输出描述四、java代码五、测试用例 前言 本人最近再练习算法&#xff0c;所以会发布一些解题思路&#xff0c;希望大家多指教 一、题目描述 二叉树也可以用数组来存储&#xff0c;给定一个数组&#xff…

08.3.grafana自定义图形

grafana自定义图形 找插件里面的zabbix 点击update 数据源—zabbix数据源,添加zabbix数据源 选择zabbix类型 我这里配置的是本地&#xff0c;所以URL直接localhost 这里配置zabbix登录账号密码Admin/zabbix 然后点击保存并测试&#xff0c;会直接显示版本 导入模板&…

【Web】2023香山杯决赛 security system 题解

目录 step -1 step 0 step 1 step 2 step 3 step -1 ①题目hint&#xff1a;想办法修改属性值后进入java的原生反序列化&#xff0c;然后利用jackson链写入内存马 ②jackson反序列化基础&#xff1a; ObjectMapper objectMapper new ObjectMapper(); String jsonStrin…

【GESP】2024年03月图形化二级 -- 找因数

找因数 【题目描述】 默认小猫角色和白色背景。 小杨最近刚刚学习了因数的概念&#xff0c;具体来说&#xff0c;如果一个正整数 a a a 可以被另一个正整数 b b b 整除&#xff0c;那么我们就说 b b b 是 a a a 的因数&#xff0c;例如6可以被1、2、3、6整除&#xff0c;…

通过物联网管理多台MQTT设备-基于米尔T527开发板

本篇测评由电子工程世界的优秀测评者“JerryZhen”提供。 本文将介绍基于米尔电子MYD-LT527开发板的网关方案测试。 一、系统概述 基于米尔-全志 T527设计一个简易的物联网网关&#xff0c;该网关能够管理多台MQTT设备&#xff0c;通过MQTT协议对设备进行读写操作&#xff0c;…