conan 入门指南

news2024/11/28 4:38:40

conan 新手入门

  • 1 需要注意的事项
  • 2 使用 Poco 库的 MD5 哈希计算器
    • 2.1 创建源文件
    • 2.2 搜索poco conan 库
    • 2.3 获取poco/1.9.4的元数据
    • 2.4 创建conanfile.txt
    • 2.5 安装依赖
    • 2.6 创建编译文件
    • 2.7 构建和运行程序
  • 3 安装依赖程序
  • 4 检查依赖关系
  • 5 搜索软件包
  • 6 与其他配置一起构建

该篇博文是基于Conan Getting Started对conan官方文档的翻译而来。

This document is for a “1.X” legacy Conan version. Click here to read the Conan 2.0 documentation
本文档适用于 "1.X "传统conan版本。点击此处阅读conan 2.0 文档

1 需要注意的事项

We are actively working to finalize the Conan 2.0 Release. Some of the information on this page references deprecated features which will not be carried forward with the new release. It’s important to check the Migration Guidelines to ensure you are using the most up to date features.
我们正在积极努力完成conan 2.0 版本的最终定稿。本页面中的部分信息引用了过时的功能,这些功能将不会在新版本中继续使用。请务必查看 “迁移指南”,以确保您使用的是最新功能。

Let’s get started with an example: We are going to create an MD5 hash calculator app that uses one of the most popular C++ libraries: Poco.
让我们从一个例子开始: 我们将使用最流行的 C++ 库之一创建一个 MD5 哈希计算器应用程序: Poco。

We’ll use CMake as build system in this case but keep in mind that Conan works with any build system and is not limited to using CMake.
在本例中,我们将使用 CMake 作为构建系统,但请记住,conan可与任何构建系统配合使用,并不局限于使用 CMake。

Make sure you are running the latest Conan version. Read the Conan update section to get more information.
确保您运行的是最新的conan版本。阅读 "conan更新 "部分获取更多信息。

2 使用 Poco 库的 MD5 哈希计算器

An MD5 hash calculator using the Poco Libraries
使用 Poco 库的 MD5 哈希计算器

Note
The source files to recreate this project are available in the example repository in GitHub. You can skip the manual creation of the folder and sources with this command:
GitHub 上的示例资源库中提供了用于重新创建此项目的源文件。使用该命令可以跳过手动创建文件夹和源文件的过程:

$ git clone https://github.com/conan-io/examples.git && cd examples/libraries/poco/md5

该源码的目录结构如下所示:

$ tree
.
├── features
│   ├── cmake
│   │   ├── find_package
│   │   │   ├── exported_targets_multiconfig
│   │   │   │   ├── build.bat
│   │   │   │   ├── build.sh
│   │   │   │   ├── bye
│   │   │   │   │   ├── conanfile.py
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── src
│   │   │   │   │       ├── byeConfig.cmake
│   │   │   │   │       ├── bye.cpp
│   │   │   │   │       ├── bye.h
│   │   │   │   │       └── CMakeLists.txt
│   │   │   │   ├── hello
│   │   │   │   │   ├── conanfile.py
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── src
│   │   │   │   │       ├── CMakeLists.txt
│   │   │   │   │       ├── helloConfig.cmake
│   │   │   │   │       ├── hello.cpp
│   │   │   │   │       └── hello.h
│   │   │   │   ├── __init__.py
│   │   │   │   ├── project
│   │   │   │   │   ├── CMakeLists.txt
│   │   │   │   │   ├── conanfile.txt
│   │   │   │   │   └── example.cpp
│   │   │   │   └── README.md
│   │   │   ├── find_cmake_multi_generator_targets
│   │   │   │   ├── build.bat
│   │   │   │   ├── build.sh
│   │   │   │   ├── bye
│   │   │   │   │   ├── conanfile.py
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── src
│   │   │   │   │       ├── bye.cpp
│   │   │   │   │       ├── bye.h
│   │   │   │   │       └── CMakeLists.txt
│   │   │   │   ├── hello
│   │   │   │   │   ├── conanfile.py
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── src
│   │   │   │   │       ├── CMakeLists.txt
│   │   │   │   │       ├── hello.cpp
│   │   │   │   │       └── hello.h
│   │   │   │   ├── __init__.py
│   │   │   │   ├── project
│   │   │   │   │   ├── CMakeLists.txt
│   │   │   │   │   ├── conanfile.txt
│   │   │   │   │   └── example.cpp
│   │   │   │   └── README.md
│   │   │   └── __init__.py
│   │   └── __init__.py
│   ├── deployment
│   │   ├── build.sh
│   │   ├── CMakeLists.txt
│   │   ├── conanfile.txt
│   │   ├── deploy.py
│   │   └── md5.cpp
│   ├── editable
│   │   └── cmake
│   │       ├── build.bat
│   │       ├── build.sh
│   │       ├── hello
│   │       │   ├── CMakeLists.txt
│   │       │   ├── conanfile.txt
│   │       │   └── src
│   │       │       └── hello.cpp
│   │       └── say
│   │           ├── CMakeLists.txt
│   │           ├── conanfile.py
│   │           ├── include
│   │           │   └── say.h
│   │           └── src
│   │               ├── original_say.cpp
│   │               ├── say2.cpp
│   │               └── say.cpp
│   ├── emscripten
│   │   ├── build.bat
│   │   ├── build.sh
│   │   ├── CMakeLists.txt
│   │   ├── conanfile.py
│   │   ├── conanfile.txt
│   │   ├── emscripten.profile
│   │   ├── main.cpp
│   │   ├── run.cmd
│   │   └── run.sh
│   ├── __init__.py
│   ├── integrate_build_system
│   │   ├── build.bat
│   │   ├── build.py
│   │   ├── build.sh
│   │   ├── mylib-consumer
│   │   │   ├── conanfile.py
│   │   │   ├── main.cpp
│   │   │   └── wscript
│   │   ├── waf-build-helper
│   │   │   ├── conanfile.py
│   │   │   └── waf_environment.py
│   │   ├── waf-generator
│   │   │   └── conanfile.py
│   │   ├── waf-installer
│   │   │   ├── conanfile.py
│   │   │   └── LICENSE
│   │   └── waf-mylib
│   │       ├── conanfile.py
│   │       ├── include
│   │       │   └── mylib.hpp
│   │       ├── src
│   │       │   └── mylib.cpp
│   │       └── wscript
│   ├── lockfiles
│   │   ├── build_order
│   │   │   ├── app1
│   │   │   │   └── conanfile.py
│   │   │   ├── app2
│   │   │   │   └── conanfile.py
│   │   │   ├── build.bat
│   │   │   ├── build.py
│   │   │   ├── build.sh
│   │   │   ├── liba
│   │   │   │   └── conanfile.py
│   │   │   ├── libb
│   │   │   │   └── conanfile.py
│   │   │   ├── libc
│   │   │   │   └── conanfile.py
│   │   │   └── libd
│   │   │       └── conanfile.py
│   │   ├── ci
│   │   │   ├── app1
│   │   │   │   └── conanfile.py
│   │   │   ├── app2
│   │   │   │   └── conanfile.py
│   │   │   ├── build.bat
│   │   │   ├── build.py
│   │   │   ├── build.sh
│   │   │   ├── liba
│   │   │   │   └── conanfile.py
│   │   │   ├── libb
│   │   │   │   └── conanfile.py
│   │   │   ├── libc
│   │   │   │   └── conanfile.py
│   │   │   └── libd
│   │   │       └── conanfile.py
│   │   └── intro
│   │       ├── build.bat
│   │       ├── build.py
│   │       ├── build.sh
│   │       ├── pkga
│   │       │   ├── conanfile.py
│   │       │   └── src
│   │       │       └── helloa.h
│   │       └── pkgb
│   │           ├── conanfile.py
│   │           └── src
│   │               ├── CMakeLists.txt
│   │               ├── greet.cpp
│   │               ├── hellob.h
│   │               └── hello.cpp
│   ├── makefiles
│   │   ├── build.bat
│   │   ├── build.sh
│   │   ├── helloapp
│   │   │   ├── conanfile.py
│   │   │   └── src
│   │   │       ├── app.cpp
│   │   │       └── Makefile
│   │   └── hellolib
│   │       ├── conanfile.py
│   │       └── src
│   │           ├── hello.cpp
│   │           ├── hello.h
│   │           └── Makefile
│   ├── multi_config
│   │   ├── build.bat
│   │   ├── build.sh
│   │   ├── CMakeLists.txt
│   │   ├── conanfile.py
│   │   ├── hello.cpp
│   │   ├── hello.h
│   │   └── test_package
│   │       ├── CMakeLists.txt
│   │       ├── conanfile.py
│   │       └── example.cpp
│   ├── package_development_flow
│   │   ├── build.bat
│   │   ├── build.sh
│   │   ├── conanfile.py
│   │   └── test_package
│   │       ├── CMakeLists.txt
│   │       ├── conanfile.py
│   │       └── example.cpp
│   ├── python_requires
│   │   └── reuse_conanfile
│   │       ├── build.bat
│   │       ├── build.sh
│   │       ├── consumer
│   │       │   ├── conanfile.py
│   │       │   └── src
│   │       │       ├── hello.cpp
│   │       │       └── hello.h
│   │       └── pyreq
│   │           ├── CMakeLists.txt
│   │           ├── conanfile.py
│   │           └── scm_utils.py
│   └── workspace
│       └── cmake
│           ├── build.bat
│           ├── build.sh
│           ├── chat
│           │   ├── conanfile.py
│           │   └── src
│           │       ├── app.cpp
│           │       ├── chat.cpp
│           │       ├── chat.h
│           │       └── CMakeLists.txt
│           ├── CMakeLists.txt
│           ├── conanws_gcc.yml
│           ├── conanws_vs.yml
│           ├── hello
│           │   ├── conanfile.py
│           │   └── src
│           │       ├── CMakeLists.txt
│           │       ├── hello.cpp
│           │       └── hello.h
│           ├── layout_gcc
│           ├── layout_vs
│           └── say
│               ├── conanfile.py
│               └── src
│                   ├── CMakeLists.txt
│                   ├── say.cpp
│                   └── say.h
├── libraries
│   ├── dear-imgui
│   │   └── basic
│   │       ├── assets
│   │       │   ├── simple-shader.fs
│   │       │   └── simple-shader.vs
│   │       ├── build.bat
│   │       ├── build.sh
│   │       ├── CMakeLists.txt
│   │       ├── conanfile.txt
│   │       ├── file_manager.cpp
│   │       ├── file_manager.h
│   │       ├── main.cpp
│   │       ├── opengl_shader.cpp
│   │       ├── opengl_shader.h
│   │       └── README.md
│   ├── folly
│   │   └── basic
│   │       ├── build.bat
│   │       ├── build.sh
│   │       ├── CMakeLists.txt
│   │       ├── conanfile.txt
│   │       ├── main.cpp
│   │       └── README.md
│   ├── imgui-opencv-poco
│   │   ├── app
│   │   │   └── main.cpp
│   │   ├── CMakeLists.txt
│   │   ├── conanfile.py
│   │   ├── data
│   │   │   ├── bird.jpeg
│   │   │   └── screen-capture.gif
│   │   ├── include
│   │   │   ├── downloader.h
│   │   │   └── gui_renderer.hpp
│   │   ├── msvc
│   │   │   ├── msvc.sln
│   │   │   ├── msvc.vcxproj
│   │   │   └── msvc.vcxproj.filters
│   │   ├── README.md
│   │   └── src
│   │       ├── downloader.cpp
│   │       └── gui_renderer.cpp
│   ├── poco
│   │   └── md5
│   │       ├── build.bat
│   │       ├── build.sh
│   │       ├── CMakeLists.txt
│   │       ├── conanfile.txt
│   │       ├── md5.cpp
│   │       └── README.md
│   └── protobuf
│       └── serialization
│           ├── build.bat
│           ├── build.sh
│           ├── CMakeLists.txt
│           ├── conanfile.txt
│           ├── __init__.py
│           ├── main.cc
│           ├── main.py
│           ├── README.md
│           └── sensor.proto
├── LICENSE
├── README.md
└── tox.ini

90 directories, 208 files

2.1 创建源文件

Create the following source file inside a folder. This will be the source file of our application:
在文件夹中创建以下源文件。这将是我们应用程序的源文件:
md5.cpp

#include "Poco/MD5Engine.h"
#include "Poco/DigestStream.h"

#include <iostream>


int main(int argc, char** argv)
{
    Poco::MD5Engine md5;
    Poco::DigestOutputStream ds(md5);
    
    ds << "abcdefghijklmnopqrstuvwxyz";
    ds.close();
    std::cout << Poco::DigestEngine::digestToHex(md5.digest()) << std::endl;
    return 0;
}

2.2 搜索poco conan 库

We know that our application relies on the Poco libraries. Let’s look for it in the ConanCenter remote, going to https://conan.io/center, and typing “poco” in the search box. We will see that there are some different versions available:
我们知道,我们的应用程序依赖于 Poco 库。让我们在 ConanCenter 远程应用程序中查找它,进入 https://conan.io/center,在搜索框中输入 “poco”。我们会看到有一些不同的版本:

poco/1.8.1
poco/1.9.3
poco/1.9.4
...

Note:备注

The Conan client contains a command to search in remote repositories, and we could try $ conan search poco --remote=conancenter. You can perfectly use this command to search in your own repositories, but note that at the moment this might timeout in ConanCenter. The infrastructure is being improved to support this command too, but meanwhile using the ConanCenter UI is recommended.
conan客户端包含一条搜索远程软件源的命令,我们可以试试 $ conan search poco --remote=conancenter 命令。您完全可以使用该命令搜索自己的版本库,但要注意的是,目前该命令在 [ConanCenter](https://conan.io/center) 中可能会超时。我们正在改进基础设施以支持该命令,但同时建议使用 ConanCenter UI

$ conan search poco -r conancenter
Existing package recipes:

poco/1.8.1
poco/1.9.3
poco/1.9.4
poco/1.10.0
poco/1.10.1
poco/1.11.0
poco/1.11.1
poco/1.11.2
poco/1.11.3
poco/1.12.5p1
poco/1.12.0
poco/1.12.1
poco/1.12.2
poco/1.12.3
poco/1.12.4
$

2.3 获取poco/1.9.4的元数据

We got some interesting references for Poco. Let’s inspect the metadata of the 1.9.4 version:
我们获得了一些关于 Poco 的有趣信息。让我们检查一下 1.9.4 版本的元数据:

$ conan inspect poco/1.9.4
name: poco
version: 1.9.4
url: https://github.com/conan-io/conan-center-index
homepage: https://pocoproject.org
license: BSL-1.0
author: None
description: Modern, powerful open source C++ class libraries for building network- and internet-based applications that run on desktop, server, mobile and embedded systems.
topics: ('building', 'networking', 'server', 'mobile', 'embedded')
generators: ['txt']
exports: None
exports_sources: None
short_paths: False
apply_env: True
build_policy: None
revision_mode: hash
settings: ('os', 'arch', 'compiler', 'build_type')
options:
    enable_active_record: [True, False, 'deprecated']
    enable_activerecord: [True, False]
    enable_activerecord_compiler: [True, False]
    enable_apacheconnector: [True, False]
    enable_cppparser: [True, False]
    enable_crypto: [True, False]
    enable_data: [True, False]
    enable_data_mysql: [True, False]
    enable_data_odbc: [True, False]
    enable_data_postgresql: [True, False]
    enable_data_sqlite: [True, False]
    enable_encodings: [True, False]
    enable_fork: [True, False]
    enable_json: [True, False]
    enable_jwt: [True, False]
    enable_mongodb: [True, False]
    enable_net: [True, False]
    enable_netssl: [True, False]
    enable_netssl_win: [True, False]
    enable_pagecompiler: [True, False]
    enable_pagecompiler_file2page: [True, False]
    enable_pdf: [True, False]
    enable_pocodoc: [True, False]
    enable_prometheus: [True, False]
    enable_redis: [True, False]
    enable_sevenzip: [True, False]
    enable_util: [True, False]
    enable_xml: [True, False]
    enable_zip: [True, False]
    fPIC: [True, False]
    shared: [True, False]
default_options:
    enable_active_record: deprecated
    enable_activerecord: True
    enable_activerecord_compiler: False
    enable_apacheconnector: False
    enable_cppparser: False
    enable_crypto: True
    enable_data: True
    enable_data_mysql: True
    enable_data_odbc: False
    enable_data_postgresql: True
    enable_data_sqlite: True
    enable_encodings: True
    enable_fork: True
    enable_json: True
    enable_jwt: True
    enable_mongodb: True
    enable_net: True
    enable_netssl: True
    enable_netssl_win: False
    enable_pagecompiler: False
    enable_pagecompiler_file2page: False
    enable_pdf: False
    enable_pocodoc: False
    enable_prometheus: False
    enable_redis: True
    enable_sevenzip: False
    enable_util: True
    enable_xml: True
    enable_zip: True
    fPIC: True
    shared: False
deprecated: None
$ 

2.4 创建conanfile.txt

Let’s use this poco/1.9.4 version for our MD5 calculator app, creating a conanfile.txt inside our project’s folder with the following content:
让我们在 MD5 计算器应用程序中使用这个 poco/1.9.4 版本,在项目文件夹中创建一个 conanfile.txt,内容如下:

conanfile.txt

 [requires]
 poco/1.9.4

 [generators]
 cmake

In this example we are using CMake to build the project, which is why the cmake generator is specified. This generator creates a conanbuildinfo.cmake file that defines CMake variables including paths and library names that can be used in our build. Read more about Generators.
在本例中,我们使用 CMake 来构建项目,因此指定了 cmake 生成器。该生成器会创建一个 conanbuildinfo.cmake 文件,其中定义了 CMake 变量,包括可在构建过程中使用的路径和库名。了解更多关于生成器的信息。

2.5 安装依赖

Next step: We are going to install the required dependencies and generate the information for the build system:
下一步 我们将安装所需的依赖项,并为构建系统生成信息:

Important:重要事项

If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. In the context of this getting started example, this is a bad choice though: Recent gcc versions will compile the example by default with the new ABI and linking will fail without further customization of your cmake configuration. You can avoid this with the following commands:
如果您使用的 GCC 编译器 >= 5.1,为了向后兼容,Conan 会将 compiler.libcxx 设置为旧的 ABI。但在本入门示例中,这是一个糟糕的选择: 最近的 gcc 版本会默认使用新的 ABI 来编译示例,如果不对 cmake 配置进行进一步定制,链接就会失败。使用以下命令可以避免这种情况:

$ conan profile new default --detect  # Generates default profile detecting GCC and sets old ABI
$ conan profile update settings.compiler.libcxx=libstdc++11 default  # Sets libcxx to C++11 ABI

You will find more information in How to manage the GCC >= 5 ABI.
更多信息,请参阅《如何管理 GCC >= 5 ABI》

$ mkdir build && cd build
$ conan install ..
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9.4
os=Linux
os_build=Linux
platform=default
[options]
[build_requires]
[env]

poco/1.9.4: Not found in local cache, looking in remotes...
poco/1.9.4: Trying with 'liconan'...
poco/1.9.4: Trying with 'liconan_old'...
poco/1.9.4: Trying with 'conancenter'...
Downloading conanmanifest.txt completed [0.17k]                                          
Downloading conanfile.py completed [17.42k]                                              
Downloading conan_export.tgz completed [0.34k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
poco/1.9.4: Downloaded recipe revision f7cfa1f609e6ddef0166efae9d7a479f
pcre/8.45: Not found in local cache, looking in remotes...
pcre/8.45: Trying with 'liconan'...
Downloading conanmanifest.txt completed [0.17k]                                          
Downloading conanfile.py completed [8.55k]                                               
Downloading conan_export.tgz completed [0.25k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
pcre/8.45: Downloaded recipe revision b6bae758d36ca2050bb8527ea408eb75
WARN: pcre/8.45: requirement zlib/1.2.11 overridden by poco/1.9.4 to zlib/1.2.13 
bzip2/1.0.8: Not found in local cache, looking in remotes...
bzip2/1.0.8: Trying with 'liconan'...
Downloading conanmanifest.txt completed [0.17k]                                          
Downloading conanfile.py completed [3.99k]                                               
Downloading conan_export.tgz completed [0.31k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
bzip2/1.0.8: Downloaded recipe revision 411fc05e80d47a89045edc1ee6f23c1d
zlib/1.2.13: Not found in local cache, looking in remotes...
zlib/1.2.13: Trying with 'liconan'...
Downloading conanmanifest.txt completed [0.28k]                                          
Downloading conanfile.py completed [4.04k]                                               
Downloading conan_export.tgz completed [0.41k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
zlib/1.2.13: Downloaded recipe revision e377bee636333ae348d51ca90874e353
expat/2.5.0: Not found in local cache, looking in remotes...
expat/2.5.0: Trying with 'liconan'...
Downloading conanmanifest.txt completed [0.10k]                                          
Downloading conanfile.py completed [3.80k]                                               
Downloading conan_export.tgz completed [0.33k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
expat/2.5.0: Downloaded recipe revision 91e43e4544923e4c934bfad1fa4306f9
sqlite3/3.40.1: Not found in local cache, looking in remotes...
sqlite3/3.40.1: Trying with 'liconan'...
sqlite3/3.40.1: Trying with 'liconan_old'...
sqlite3/3.40.1: Trying with 'conancenter'...
Downloading conanmanifest.txt completed [0.17k]                                          
Downloading conanfile.py completed [10.26k]                                              
Downloading conan_export.tgz completed [0.31k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
sqlite3/3.40.1: Downloaded recipe revision 42e44d48d880b6520ae0fea7dc51b3da
openssl/1.1.1t: Not found in local cache, looking in remotes...
openssl/1.1.1t: Trying with 'liconan'...
openssl/1.1.1t: Trying with 'liconan_old'...
openssl/1.1.1t: Trying with 'conancenter'...
Downloading conanmanifest.txt completed [0.18k]                                          
Downloading conanfile.py completed [40.93k]                                              
Downloading conan_export.tgz completed [0.45k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
openssl/1.1.1t: Downloaded recipe revision 55e398751ff5310a8525645c99c81495
conanfile.txt: Installing package
Requirements
    bzip2/1.0.8 from 'liconan' - Downloaded
    expat/2.5.0 from 'liconan' - Downloaded
    openssl/1.1.1t from 'conancenter' - Downloaded
    pcre/8.45 from 'liconan' - Downloaded
    poco/1.9.4 from 'conancenter' - Downloaded
    sqlite3/3.40.1 from 'conancenter' - Downloaded
    zlib/1.2.13 from 'liconan' - Downloaded
Packages
    bzip2/1.0.8:a2ad20ca8aeb3690e9928fe1e6f8c3b5938f7daa - Download
    expat/2.5.0:596c493ac7597b09271cd8340f778f4468ef2b4d - Download
    openssl/1.1.1t:97b2980950e3b4924390bfa5f6a067d90c9756d4 - Missing
    pcre/8.45:d07fda6b1d8b0b754b51370e25476911bad22612 - Missing
    poco/1.9.4:e1913c01a84b6302408a47ef162c78618fdccc1d - Missing
    sqlite3/3.40.1:1f7d3422e7eef4cc3a24c48d08f756c034b2d630 - Missing
    zlib/1.2.13:97b2980950e3b4924390bfa5f6a067d90c9756d4 - Download

Installing (downloading, building) binaries...
ERROR: Missing binary: openssl/1.1.1t:97b2980950e3b4924390bfa5f6a067d90c9756d4
ERROR: Missing binary: pcre/8.45:d07fda6b1d8b0b754b51370e25476911bad22612
ERROR: Missing binary: poco/1.9.4:e1913c01a84b6302408a47ef162c78618fdccc1d
ERROR: Missing binary: sqlite3/3.40.1:1f7d3422e7eef4cc3a24c48d08f756c034b2d630

openssl/1.1.1t: WARN: Can't find a 'openssl/1.1.1t' package for the specified settings, options and dependencies:
- Settings: arch=x86_64, build_type=Release, compiler=gcc, compiler.version=9.4, os=Linux
- Options: 386=False, enable_weak_ssl_ciphers=False, fPIC=True, no_aria=False, no_asm=False, no_async=False, no_bf=False, no_blake2=False, no_camellia=False, no_cast=False, no_chacha=False, no_cms=False, no_comp=False, no_ct=False, no_deprecated=False, no_des=False, no_dgram=False, no_dh=False, no_dsa=False, no_dso=False, no_ec=False, no_ecdh=False, no_ecdsa=False, no_engine=False, no_filenames=False, no_gost=False, no_hmac=False, no_idea=False, no_md4=False, no_md5=False, no_mdc2=False, no_ocsp=False, no_pinshared=False, no_rc2=False, no_rfc3779=False, no_rmd160=False, no_rsa=False, no_seed=False, no_sha=False, no_sm2=False, no_sm3=False, no_sm4=False, no_sock=False, no_srp=False, no_srtp=False, no_sse2=False, no_ssl=False, no_ssl3=False, no_stdio=False, no_tests=False, no_threads=False, no_tls1=False, no_ts=False, no_whirlpool=False, openssldir=None, shared=False
- Dependencies: 
- Requirements: 
- Package ID: 97b2980950e3b4924390bfa5f6a067d90c9756d4

ERROR: Missing prebuilt package for 'openssl/1.1.1t', 'pcre/8.45', 'poco/1.9.4', 'sqlite3/3.40.1'
Use 'conan search openssl/1.1.1t@ --table=table.html -r=remote' and open the table.html file to see available packages
Or try to build locally from sources with '--build=openssl --build=pcre --build=poco --build=sqlite3'

More Info at 'https://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package'

$ 

Conan installed our Poco dependency but also the transitive dependencies for it: OpenSSL, zlib, sqlite and others. It has also generated a conanbuildinfo.cmake file for our build system.
conan不仅安装了我们的 Poco 依赖项,还安装了它的传递依赖项: OpenSSL、zlib、sqlite 等。它还为我们的构建系统生成了一个 conanbuildinfo.cmake 文件。

Warning:注意事项

There are prebuilt binaries for several mainstream compilers and versions available in ConanCenter repository, a list is keep in the repository’s documentation If your current configuration is not pre-built in ConanCenter, Conan will raise a “Binary Missing” error. Please read carefully the error messages. You can build the binary package from sources using conan install … --build=missing, it will succeed if your configuration is supported by the recipe (it is possible that some ConanCenter recipes fail to build for some platforms). You will find more info in the Building with other configurations section.
ConanCenter 资源库中提供了多个主流编译器和版本的预编译二进制文件,该资源库的文档中载有相关列表。请仔细阅读错误信息。您可以使用 conan install .. --build=missing 从源代码编译二进制包,如果配方支持您的配置,编译就会成功(某些 ConanCenter 配方可能无法在某些平台上编译)。更多信息请参阅 "使用其他配置构建 "部分。

2.6 创建编译文件

Now let’s create our build file. To inject the Conan information, include the generated conanbuildinfo.cmake file like this:
现在,让我们创建编译文件。要注入conan信息,请像这样加入生成的 conanbuildinfo.cmake 文件:

Caution:注意事项

The Creating Packages’s Getting Started is a more up-to-date version of this section.
《创建软件包入门》是这一部分的最新版本。

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.12)
project(MD5Encrypter)

if(CMAKE_VERSION VERSION_LESS 3.0.0)
    include(CheckCXXCompilerFlag)
    check_cxx_compiler_flag(-std=c++11 COMPILER_SUPPORTS_CXX11)
    check_cxx_compiler_flag(-std=c++0x COMPILER_SUPPORTS_CXX0X)
    if(COMPILER_SUPPORTS_CXX11)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    elseif(COMPILER_SUPPORTS_CXX0X)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
    endif()
else()
    SET(CMAKE_CXX_STANDARD 11)
    SET(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(md5 md5.cpp)
target_link_libraries(md5 ${CONAN_LIBS})

2.7 构建和运行程序

(win)
$ cmake .. -G "Visual Studio 16"
$ cmake --build . --config Release

(linux, mac)
$ cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
$ cmake --build .
...
[100%] Built target md5
$ ./bin/md5
c3fcd3d76192e4007dfb496cca67e13b

在linux上的构建和运行完成过程:

$ cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /home/test/sda3/work/conan_examples/examples/libraries/poco/md5/build
-- Conan: Compiler GCC>=5, checking major version 9.4
-- Conan: Checking correct version: 9.4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/test/sda3/work/conan_examples/examples/libraries/poco/md5/build
$ cmake --build .
[ 50%] Building CXX object CMakeFiles/md5.dir/md5.cpp.o
[100%] Linking CXX executable bin/md5
[100%] Built target md5
$ ./bin/md5 
c3fcd3d76192e4007dfb496cca67e13b
$

3 安装依赖程序

The conan install command downloads the binary package required for your configuration (detected the first time you ran the command), together with other (transitively required by Poco) libraries, like OpenSSL and Zlib. It will also create the conanbuildinfo.cmake file in the current directory, in which you can see the CMake variables, and a conaninfo.txt in which the settings, requirements and optional information is saved.
conan install 命令会下载配置所需的二进制软件包(第一次运行命令时检测到),以及其他(Poco 临时需要的)库,如 OpenSSL 和 Zlib。它还会在当前目录下创建 conanbuildinfo.cmake 文件,在该文件中可以看到 CMake 变量,并创建 conaninfo.txt 文件,保存设置、要求和可选信息。

Note:说明
Conan generates a default profile with your detected settings (OS, compiler, architecture…) and that configuration is printed at the top of every conan install command. However, it is strongly recommended to review it and adjust the settings to accurately describe your system as shown in the Building with other configurations section.
Conan 会根据检测到的设置(操作系统、编译器、架构…)生成默认配置文件,该配置文件会打印在每条 Conan 安装命令的顶部。不过,我们强烈建议您查看该配置文件,并调整设置以准确描述您的系统,如 "使用其他配置构建 "部分所示。

It is very important to understand the installation process. When the conan install command runs, settings specified on the command line or taken from the defaults in /.conan/profiles/default file are applied.
了解安装过程非常重要。运行 conan install 命令时,将应用命令行中指定的设置或 /.conan/profiles/default 文件中的默认设置。
在这里插入图片描述
For example, the command conan install … --settings os=“Linux” --settings compiler=“gcc”, performs these steps:
例如,命令 conan install .. --settings os="Linux" --settings compiler="gcc "会执行这些步骤:

  • Checks if the package recipe (for poco/1.9.4 package) exists in the local cache. If we are just starting, the cache is empty.
  • 检查本地缓存中是否存在软件包(poco/1.9.4 软件包)。如果我们刚开始运行,则缓存为空。
  • Looks for the package recipe in the defined remotes. Conan comes with conancenter remote as the default, but can be changed.
  • 在已定义的远程中查找软件包配方。Conan 默认使用 conancenter 远程控制,但也可以更改。
  • If the recipe exists, the Conan client fetches and stores it in your local Conan cache.
  • 如果软件包存在,Conan 客户端会获取并将其存储到本地 Conan 缓存中。
  • With the package recipe and the input settings (Linux, GCC), Conan looks for the corresponding binary in the local cache.
  • 根据软件包配方和输入设置(Linux、GCC),Conan 会在本地缓存中查找相应的二进制文件。
  • As the binary is not found in the cache, Conan looks for it in the remote and fetches it.
  • 由于二进制文件在缓存中找不到,conan在远程中查找并获取了它。
  • Finally, it generates an appropriate file for the build system specified in the [generators] section.
  • 最后,它会为 [生成器] 部分指定的构建系统生成适当的文件。

4 检查依赖关系

The retrieved packages are installed to your local user cache (typically .conan/data), and can be reused from this location for other projects. This allows to clean your current project and continue working even without network connection. To search for packages in the local cache run:
检索到的软件包会安装到本地用户缓存(通常为 .conan/data)中,并可在其他项目中重复使用。这样,即使没有网络连接,也能清理当前项目并继续工作。要在本地缓存中搜索软件包,请运行

$ conan search "*"
Existing package recipes:

bzip2/1.0.8
expat/2.5.0
openssl/1.1.1t
pcre/8.45
poco/1.9.4
sqlite3/3.40.1
zlib/1.2.13
$ 

To inspect the different binary packages of a reference run:
检测参考运行的不同二进制包:

$ conan search poco/1.9.4@
Existing packages for recipe poco/1.9.4:

    Package_ID: e1913c01a84b6302408a47ef162c78618fdccc1d
        [options]
            enable_apacheconnector: False
            enable_cppparser: False
            enable_crypto: True
            enable_data: True
            enable_data_odbc: False
            enable_data_sqlite: True
            enable_encodings: True
            enable_fork: True
            enable_json: True
            enable_mongodb: True
            enable_net: True
            enable_netssl: True
            enable_pagecompiler: False
            enable_pagecompiler_file2page: False
            enable_pdf: False
            enable_pocodoc: False
            enable_redis: True
            enable_sevenzip: False
            enable_util: True
            enable_xml: True
            enable_zip: True
            fPIC: True
            shared: False
        [settings]
            arch: x86_64
            build_type: Release
            compiler: gcc
            compiler.libcxx: libstdc++11
            compiler.version: 9.4
            os: Linux
        [requires]
            bzip2/1.0.8:a2ad20ca8aeb3690e9928fe1e6f8c3b5938f7daa
            expat/2.5.0:596c493ac7597b09271cd8340f778f4468ef2b4d
            openssl/1.1.1t:97b2980950e3b4924390bfa5f6a067d90c9756d4
            pcre/8.45:d07fda6b1d8b0b754b51370e25476911bad22612
            sqlite3/3.40.1:1f7d3422e7eef4cc3a24c48d08f756c034b2d630
            zlib/1.2.13:97b2980950e3b4924390bfa5f6a067d90c9756d4
        Outdated from recipe: False

$ 

The @ symbol at the end of the package name is important to search for a specific package. If you don’t add the @, Conan will interpret the argument as a pattern search and return all the packages that match the poco/1.9.4 pattern and may have different user and channel.
软件包名称末尾的 @ 符号对于搜索特定软件包非常重要。如果不加上 @,Conan 会将参数解释为模式搜索,并返回所有符合 poco/1.9.4 模式的软件包,而且可能有不同的user和channel。

To inspect all your current project’s dependencies use the conan info command by pointing it to the location of the conanfile.txt folder:
要查看当前项目的所有依赖关系,请使用 conan info 命令,将其指向 conanfile.txt 文件夹的位置:

$ conan info ../
WARN: pcre/8.45: requirement zlib/1.2.11 overridden by poco/1.9.4 to zlib/1.2.13 
conanfile.txt
    ID: ca83cb0032e1b868e7a9d4c1798848ea9d94c29d
    BuildID: None
    Context: host
    Requires:
        poco/1.9.4
bzip2/1.0.8
    ID: a2ad20ca8aeb3690e9928fe1e6f8c3b5938f7daa
    BuildID: None
    Context: host
    Remote: liconan=https://artifactory.ep.chehejia.com/artifactory/api/conan/liconan-release-local
    URL: https://github.com/conan-io/conan-center-index
    Homepage: http://www.bzip.org
    License: bzip2-1.0.8
    Description: bzip2 is a free and open-source file compression program that uses the Burrows Wheeler algorithm.
    Topics: data-compressor, file-compression
    Provides: bzip2
    Recipe: Cache
    Revision: 411fc05e80d47a89045edc1ee6f23c1d
    Package revision: c295f2cbc689a5a5d3d079d44020baae
    Binary: Cache
    Binary remote: liconan
    Creation date: 2023-03-09 01:10:07 UTC
    Required by:
        pcre/8.45
expat/2.5.0
    ID: 596c493ac7597b09271cd8340f778f4468ef2b4d
    BuildID: None
    Context: host
    Remote: liconan=https://artifactory.ep.chehejia.com/artifactory/api/conan/liconan-release-local
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://github.com/libexpat/libexpat
    License: MIT
    Description: Fast streaming XML parser written in C.
    Topics: xml, parsing
    Provides: expat
    Recipe: Cache
    Revision: 91e43e4544923e4c934bfad1fa4306f9
    Package revision: b4b09250e97136ff8b53fec6696c5127
    Binary: Cache
    Binary remote: liconan
    Creation date: 2023-05-20 23:19:47 UTC
    Required by:
        poco/1.9.4
openssl/1.1.1t
    ID: 97b2980950e3b4924390bfa5f6a067d90c9756d4
    BuildID: None
    Context: host
    Remote: conancenter=https://center.conan.io
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://github.com/openssl/openssl
    License: OpenSSL
    Description: A toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols
    Topics: openssl, ssl, tls, encryption, security
    Provides: openssl
    Recipe: Cache
    Revision: 55e398751ff5310a8525645c99c81495
    Package revision: a3f4db25f4a6470260551cbee5c47a08
    Binary: Cache
    Binary remote: conancenter
    Creation date: 2023-09-25 23:24:57 UTC
    Required by:
        poco/1.9.4
pcre/8.45
    ID: d07fda6b1d8b0b754b51370e25476911bad22612
    BuildID: None
    Context: host
    Remote: liconan=https://artifactory.ep.chehejia.com/artifactory/api/conan/liconan-release-local
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://www.pcre.org
    License: BSD-3-Clause
    Description: Perl Compatible Regular Expressions
    Topics: regex, regexp, PCRE
    Provides: pcre
    Recipe: Cache
    Revision: b6bae758d36ca2050bb8527ea408eb75
    Package revision: ac655167f3dd989856f45fafd4f27332
    Binary: Cache
    Binary remote: liconan
    Creation date: 2021-11-19 11:46:11 UTC
    Required by:
        poco/1.9.4
    Requires:
        bzip2/1.0.8
        zlib/1.2.13
poco/1.9.4
    ID: e1913c01a84b6302408a47ef162c78618fdccc1d
    BuildID: None
    Context: host
    Remote: conancenter=https://center.conan.io
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://pocoproject.org
    License: BSL-1.0
    Description: Modern, powerful open source C++ class libraries for building network- and internet-based applications that run on desktop, server, mobile and embedded systems.
    Topics: building, networking, server, mobile, embedded
    Provides: poco
    Recipe: Cache
    Revision: f7cfa1f609e6ddef0166efae9d7a479f
    Package revision: 2fe52f1243bbad2800a4d9daf2180858
    Binary: Cache
    Binary remote: conancenter
    Creation date: 2023-03-03 23:33:00 UTC
    Required by:
        conanfile.txt
    Requires:
        pcre/8.45
        zlib/1.2.13
        expat/2.5.0
        sqlite3/3.40.1
        openssl/1.1.1t
sqlite3/3.40.1
    ID: 1f7d3422e7eef4cc3a24c48d08f756c034b2d630
    BuildID: None
    Context: host
    Remote: conancenter=https://center.conan.io
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://www.sqlite.org
    License: Unlicense
    Description: Self-contained, serverless, in-process SQL database engine.
    Topics: sqlite, database, sql, serverless
    Provides: sqlite3
    Recipe: Cache
    Revision: 42e44d48d880b6520ae0fea7dc51b3da
    Package revision: 59d65a0f212edf078f3cace530c92338
    Binary: Cache
    Binary remote: conancenter
    Creation date: 2023-03-03 08:31:49 UTC
    Required by:
        poco/1.9.4
zlib/1.2.13
    ID: 97b2980950e3b4924390bfa5f6a067d90c9756d4
    BuildID: None
    Context: host
    Remote: liconan=https://artifactory.ep.chehejia.com/artifactory/api/conan/liconan-release-local
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://zlib.net
    License: Zlib
    Description: A Massively Spiffy Yet Delicately Unobtrusive Compression Library (Also Free, Not to Mention Unencumbered by Patents)
    Topics: zlib, compression
    Provides: zlib
    Recipe: Cache
    Revision: e377bee636333ae348d51ca90874e353
    Package revision: 0b72380061276c1e2abf48b69b5915b4
    Binary: Cache
    Binary remote: liconan
    Creation date: 2023-04-27 20:11:20 UTC
    Required by:
        poco/1.9.4
        pcre/8.45
$ 

Or generate a graph of your dependencies using Dot or HTML formats:
或者使用 Dot 或 HTML 格式生成依赖关系图:

$ conan info .. --graph=file.html
$ file.html # or open the file, double-click

在这里插入图片描述

5 搜索软件包

The remote repository where packages are installed from is configured by default in Conan. It is called Conan Center (configured as conancenter remote).
安装软件包的远程存储库在 Conan 中是默认配置的。它被称为 Conan Center(配置为 conancenter remote)。

If we search for something like open in ConanCenter we could find different packages like:
如果我们在 ConanCenter 中搜索 “open”(打开)之类的内容,我们可以找到不同的软件包:

openal/1.18.2@bincrafters/stable
openal/1.19.1
opencv/2.4.13.5@conan/stable
opencv/3.4.3@conan/stable
opencv/4.1.1@conan/stable
openexr/2.3.0
openexr/2.3.0@conan/stable
openexr/2.4.0
openjpeg/2.3.0@bincrafters/stable
openjpeg/2.3.1
openjpeg/2.3.1@bincrafters/stable
openssl/1.0.2s
...

As you can see, some of the libraries end with a @ symbol followed by two strings separated by a slash. These fields are the user and channel for the Conan package, and they are useful if you want to make specific changes and disambiguate your modified recipe from the one in the Conan Center or any other remote. These are legacy packages, and the ones without user and channel are the ones strongly recommended to use from ConanCenter.
正如你所看到的,有些库以 @ 符号结尾,后面跟着两个用斜线分隔的字符串。这些字段是柯南软件包的用户和频道,如果你想进行特定修改,并将修改后的配方与柯南中心或其他远程软件中的配方区分开来,这些字段非常有用。这些是传统软件包,强烈建议使用 ConanCenter 中没有用户和频道的软件包。

ConanCenter is the central public repository for Conan packages. You can contribute packages to it in the conan-center-index Github repository. If you want to store your own private packages, you can download the free Artifactory Community Edition (CE) directly from the Conan downloads page.
ConanCenter 是conan软件包的中央公共仓库。您可以在 conan-center-index Github 仓库中贡献软件包。如果你想存储自己的私有软件包,可以直接从conan下载页面下载免费的 Artifactory Community Edition (CE)。

6 与其他配置一起构建

In this example, we have built our project using the default configuration detected by Conan. This configuration is known as the default profile.
在本例中,我们使用 Conan 检测到的默认配置构建项目。该配置被称为默认配置文件。

A profile needs to be available prior to running commands such as conan install. When running the command, your settings are automatically detected (compiler, architecture…) and stored as the default profile. You can edit these settings ~/.conan/profiles/default or create new profiles with your desired configuration.
在运行 conan install 等命令之前,需要有一个配置文件。运行命令时,系统会自动检测您的设置(编译器、体系结构…)并存储为默认配置文件。您可以编辑这些设置 ~/.conan/profiles/default,或根据所需配置创建新的配置文件。

For example, if we have a profile with a 32-bit GCC configuration in a file called gcc_x86, we can run the following:
例如,如果我们在名为 gcc_x86 的文件中配置了 32 位 GCC 配置文件,我们就可以运行下面的命令:

$ conan install .. --profile=gcc_x86

Tip:建议
We strongly recommend using Profiles and managing them with conan config install.
我们强烈建议使用配置文件,并通过 Conan config install 对其进行管理。

However, the user can always override the profile settings in the conan install command using the --settings parameter. As an exercise, try building the 32-bit version of the hash calculator project like this:
不过,用户可以使用 --settings 参数覆盖 conan install 命令中的配置文件设置。作为练习,请尝试像这样构建 32 位版本的哈希计算器项目:

$ conan install .. --settings arch=x86

The above command installs a different package, using the --settings arch=x86 instead of the one of the default profile used previously. Note you might need to install extra compilers or toolchains in some platforms, as for example, Linux distributions no longer install 32bits toolchains by default.
上述命令使用 --settings arch=x86 而不是之前使用的默认配置文件安装不同的软件包。请注意,在某些平台上,你可能需要安装额外的编译器或工具链,例如 Linux 发行版不再默认安装 32 位工具链。

To use the 32-bit binaries, you will also have to change your project build:
要使用 32 位二进制文件,还必须更改项目构建:

  • In Windows, change the CMake invocation to Visual Studio 14.
  • 在 Windows 系统中,将 CMake 调用改为 Visual Studio 14。
  • In Linux, you have to add the -m32 flag to your CMakeLists.txt by running SET(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -m32”), and the same applies to CMAKE_C_FLAGS, CMAKE_SHARED_LINK_FLAGS and CMAKE_EXE_LINKER_FLAGS. This can also be done more easily, by automatically using Conan, as we’ll show later.
  • 在 Linux 中,您必须通过运行 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")-m32 标志添加到 CMakeLists.txt 中,这同样适用于 CMAKE_C_FLAGSCMAKE_SHARED_LINK_FLAGSCMAKE_EXE_LINKER_FLAGS。这也可以通过自动使用 Conan 来更轻松地完成,稍后我们将演示。
  • In macOS, you need to add the definition -DCMAKE_OSX_ARCHITECTURES=i386.
  • 在 macOS 中,需要添加定义 -DCMAKE_OSX_ARCHITECTURES=i386

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

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

相关文章

【自留地】后端 - PHP - MySQL - Nginx - Python - Java

PHP ThinkPHP6入门手册 【精选】【汇总】ThinkPHP6入门手册_tp6手册_Rudon滨海渔村的博客-CSDN博客文章浏览阅读5.4k次。安装安装Composer【win】https://getcomposer.org/Composer-Setup.exe【Linux & MacOS】curl -sS https://getcomposer.org/installer | phpmv compo…

【前端】vue3+typescript+vite+Element-Plus搭建配置初始化项目结构

给自己一个目标&#xff0c;然后坚持一段时间&#xff0c;总会有收获和感悟&#xff01; 对于我们开发人员&#xff0c;了解和熟悉新知识&#xff0c;对于vue3&#xff0c;博主是通过TA的基本结构开始&#xff0c;vue2和vue3都有javascript前端编程语言&#xff0c;到了vue3新增…

小白也想写综述(一)

前言 在选择科研方向时&#xff0c;考虑自己的兴趣和职业目标是非常重要的&#xff1a; 综述论文的价值&#xff1a;撰写综述论文&#xff0c;尤其是在深度强化学习和区块链这样的前沿技术领域&#xff0c;能够帮助建立扎实的理论基础&#xff0c;并且对整个领域有一个全面的认…

贪吃蛇、俄罗斯方块

贪吃蛇 一、创建新项目 创建一个新的项目&#xff0c;并命名。 创建一个名为images的文件夹用来存放游戏相关图片。 然后再在项目的src文件下创建一个com.xxx.view的包用来存放所有的图形界面类&#xff0c; 创建一个com.xxx.controller的包用来存放启动的入口类(控制类) 二…

使用UART烧录N76E003AT20核心板

目录 模块简介烧录方式利用ISP对N76E003AT20核心板进行烧录ICP烧录BootloaderISP烧录程序&#xff08;UART&#xff09;测试现象 总结 模块简介 N76E003为带有flash的增强型8位8051内核微控制器&#xff08;1T工作模式&#xff09;&#xff0c;指令集与标准的80C51完全兼容并具…

2023年中国超声波治疗仪发展趋势分析:中高端市场国产化率将稳步上升[图]

超声波治疗机是运用超声波治疗疾病的医用设备。主要由电源&#xff0c;高频振荡电路、超声波能治疗头组成。治疗时应正确掌握超声输出强度、治疗时间和选择不同的工作方式。目前超声波技术在医疗方面的独特疗效已得到医学界的普遍认可&#xff0c;且受到了越来越多临床重视和采…

性格迥异的夫妻最后会走到一地鸡毛还是相互成就?「串台:老公不在家」

点击文末“阅读原文”即可参与节目互动 剪辑、音频 / 卷圈 运营 / SandLiu 卷圈 监制 / 姝琦 封面 / 姝琦Midjourney 产品统筹 / bobo 创业舞台的夫妻博弈&#xff0c;台上台下都是戏。 《老公不在家》车厘子来串台啦&#xff01;不叁不肆今日报道&#xff1a; 姝琦和车厘…

【工作记录】springboot应用实现license认证

前言 License授权是一种常见的商业模式&#xff0c;一般用于在客户端部署项目后进行使用人员或功能限制&#xff0c;也常用于软件的试用场景。 主要实现思路就是在服务端生成密钥对及证书&#xff0c;在客户端启动或访问过程中进行验证。 本文实现的是通过IP地址、MAC地址、…

Vue数据绑定

在我们Vue当中有两种数据绑定的方法 1.单向绑定 2.双向绑定 让我为大家介绍一下吧&#xff01; 1、单向绑定(v-bind) 数据只能从data流向页面 举个例子&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"…

vue-组件生命周期+网络请求

​&#x1f308;个人主页&#xff1a;前端青山 &#x1f525;系列专栏&#xff1a;Vue篇 &#x1f516;人终将被年少不可得之物困其一生 依旧青山,本期给大家带来vue篇专栏内容:vue-组件生命周期网络请求 目录 组件生命周期 1. Vue的生命周期 2. Vue 子组件和父组件执行顺序…

“具有分布式能源资源的多个智能家庭的能源管理的联邦强化学习”文章学习三——基于联邦深度学习的多智能家居能源管理

一、系统描述 我们考虑一个基于FRL的HEMS&#xff0c;它由单个GS和N个LHEMS组成&#xff0c;如图2所示。如图2-C所示&#xff0c;FRL训练过程包括两个步骤&#xff1a;步骤1&#xff09;使用本地数据对LHEMS&#xff08;即本地神经网络的权重ωn&#xff09;进行本地模型的训练…

9步打造个人ip

什么是个人IP&#xff1f; 就是一个人创造出来的属于自己的有个性有价值的&#xff0c;能让他人记住你&#xff0c;信任你&#xff0c;认可你的东西。 如何强化个人IP呢&#xff1f; 需要一些必要的条件如专业性、耐心、勤奋等等要知道&#xff0c;打造IP是一个见效慢的过程&am…

MATLAB中zticks函数用法

目录 语法 说明 示例 指定 z 轴刻度值和标签 指定非均匀 z 轴刻度值 以 2 为增量递增 z 轴刻度值 将 z 轴刻度值设置回默认值 指定特定坐标区的 z 轴刻度值 删除 z 轴刻度线 zticks函数的功能是设置或查询 z 轴刻度值。 语法 zticks(ticks) zt zticks zticks(auto)…

Postman接收列表、数组参数@RequestParam List<String> ids

示例如下: 接口定义如下: GetMapping(value "/queryNewMoviePath")public List<Map<String, Object>> queryNewMoviePath(RequestParam List<String> ids ) {return service.queryNewMoviePath(ids);}postman中测试如下&#xff1a; http://loc…

计算机毕业设计项目选题推荐(免费领源码)java+mysql二手校园交易平台67613

目录 摘要 1 绪论 1.1 研究背景 1.2国内外研究现状 1.3论文结构与章节安排 2 二手校园交易平台系统分析 2.1 可行性分析 2.2 系统流程分析 2.2.1 数据流程 3.3.2 业务流程 2.3 系统功能分析 2.3.1 功能性分析 2.3.2 非功能性分析 2.4 系统用例分析 2.5本章小结 …

TensorRT基础知识及应用【学习笔记(十)】

这篇博客为修改过后的转载&#xff0c;因为没有转载链接&#xff0c;所以选了原创 文章目录 一、准备知识1.1 环境配置A. CUDA DriverB. CUDAC. cuDNND. TensorRT 1.2 编程模型 二、构建阶段2.1 创建网络定义2.2 配置参数2.3 生成Engine2.4 保存为模型文件2.5 释放资源 三、运…

C/C+=内存管理

C/C内存管理以及动态内存的申请_c动态内存的申请与释放_Demo Test的博客-CSDN博客 问题是&#xff0c;这个0x0804 8000 到0xC 0000 0000之间&#xff0c;不止3GB&#xff0c;应该有47GB&#xff0c;该怎么解释呢&#xff1f;

Azure的AI使用-(语言检测、图像分析、图像文本识别)

1.语言检测 安装包&#xff1a; # 语言检测 %pip install azure-ai-textanalytics5.2.0 需要用到密钥和资源的终结点&#xff0c;所以去Azure上创建资源&#xff0c;我这个是创建好的了然后点击密钥和终结者去拿到key和终结点 两个密钥选择哪个都行 语言检测代码示例&#…

obsidian和bookmaster

1 手动安装插件 插件地址&#xff1a;https://forum-zh.obsidian.md/t/topic/12333 安装file服务器 地址&#xff1a;http://www.rejetto.com/hfs/ hfs.exe可以改个端口 改成8866&#xff0c;ip地址也可以改成 127.0.0.1 # 因为安装到本地 如果要创建账户的话&#xff0c;就…

【PB续命05】WinHttp.WinHttpRequest的介绍与使用

0 WinHttp.WinHttpRequest简介 winhttp.winhttprequest是Windows操作系统中的一个API函数&#xff0c;用于创建和发送HTTP请求。它可以用于从Web服务器获取数据&#xff0c;或将数据发送到Web服务器。该函数提供了许多选项&#xff0c;例如设置请求头、设置代理服务器、设置超…