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

门户网站建设与管理手机参数网

门户网站建设与管理,手机参数网,成功的微网站,网站建设的什么是网站建设的第一阶段使用conan包 - 安装依赖项 主目录 conan Using packages1 Requires2 Optional user/channel3 Overriding requirements4 Generators5 Options 本文是基于对conan官方文档Installing dependencies的翻译而来#xff0c; 更详细的信息可以去查阅conan官方文档。 This section s… 使用conan包 - 安装依赖项 主目录 conan Using packages1 Requires2 Optional user/channel3 Overriding requirements4 Generators5 Options 本文是基于对conan官方文档Installing dependencies的翻译而来 更详细的信息可以去查阅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 RequiresGeneratorsOptions Using profilesWorkflows Single configurationMulti configuration Debugging packages In Getting started we used the conan install command to download the Poco library and build an example. 在 Getting started 部分我们使用 conan install 命令下载了 Poco 库并构建了一个示例。 If you inspect the conanbuildinfo.cmake file that was created when running conan install, you can see there that there are many CMake variables declared. For example CONAN_INCLUDE_DIRS_ZLIB, that defines the include path to the zlib headers, and CONAN_INCLUDE_DIRS that defines include paths for all dependencies headers. 如果检查运行 conan install 时创建的 conanbuildinfo.cmake 文件可以看到其中声明了许多 CMake 变量。例如CONAN_INCLUDE_DIRS_ZLIB 定义了 zlib 头文件的包含路径而 CONAN_INCLUDE_DIRS 则定义了所有依赖头文件的包含路径。 If you check the full path that each of these variables defines, you will see that it points to a folder under your folder. Together, these folders are the local cache. This is where package recipes and binary packages are stored and cached, so they don’t have to be retrieved again. You can inspect the local cache with conan search, and remove packages from it with conan remove command. 如果查看这些变量定义的完整路径你会发现它们都指向 userhome 文件夹下的一个文件夹。这些文件夹就是本地缓存。这就是软件包recipes和二进制软件包的存储和缓存位置因此无需再次检索。您可以使用 conan search 查看本地缓存也可以使用 conan remove 命令删除缓存中的软件包。 If you navigate to the folders referenced in conanbuildinfo.cmake you will find the headers and libraries for each package. 如果您浏览 conanbuildinfo.cmake 中引用的文件夹就会发现每个软件包的头文件和库。 If you execute a conan install poco/1.9.4 command in your shell, Conan will download the Poco package and its dependencies (openssl/1.0.2t and zlib/1.2.11) to your local cache and print information about the folder where they are installed. While you can install each of your dependencies individually like that, the recommended approach for handling dependencies is to use a conanfile.txt file. The structure of conanfile.txt is described below. 如果在 shell 中执行 conan install poco/1.9.4 命令Conan 会将 Poco 软件包及其依赖包openssl/1.0.2t 和 zlib/1.2.11下载到本地缓存并打印安装文件夹的相关信息。您可以像这样单独安装每个依赖项但处理依赖项的推荐方法是使用 conanfile.txt 文件。conanfile.txt 的结构如下描述所示。 1 Requires The required dependencies should be specified in the [requires] section. Here is an example: 应在 [requires] 部分指定所需的依赖项。下面是一个例子 [requires] mypackage/1.0.0company/stableWhere: mypackage is the name of the package which is usually the same as the project/library.mypackage 是软件包的名称通常与项目/库的名称相同。1.0.0 is the version which usually matches that of the packaged project/library. This can be any string; it does not have to be a number, so, for example, it could indicate if this is a “develop” or “master” version. Packages can be overwritten, so it is also OK to have packages like “nightly” or “weekly”, that are regenerated periodically.1.0.0 是版本通常与打包项目/库的版本一致。它可以是任何字符串不一定是数字例如它可以表示这是 develop 还是 master 版本。软件包可以被覆盖因此也可以使用 nightly 或 weekly 这样的软件包它们会定期重新生成。company is the owner of this package. It is basically a namespace that allows different users to have their own packages for the same library with the same name.company是该软件包的所有者。它基本上是一个命名空间允许不同用户为同一个库拥有自己的同名软件包。stable is the channel. Channels provide another way to have different variants of packages for the same library and use them interchangeably. They usually denote the maturity of the package as an arbitrary string such as “stable” or “testing”, but they can be used for any purpose such as package revisions (e.g., the library version has not changed, but the package recipe has evolved).stable就是channel。channel为同一库提供了另一种拥有不同变体软件包并可互换使用的方式。它们通常以任意字符串如 stable 或 “testing”表示软件包的成熟度但也可用于任何目的如软件包的修订例如库的版本没有变化但软件包的recipe发生了变化。 2 Optional user/channel If the package was created and uploaded without specifying the user and channel you can omit the user/channel when specifying a reference: 如果创建和上传软件包时没有指定user和channel则可以在指定引用时省略user/channel [requires] packagename/1.2.03 Overriding requirements You can specify multiple requirements and override transitive “require’s requirements”. In our example, Conan installed the Poco package and all its requirements transitively: 您可以指定多个需求并覆盖传递性的 “require’s requirements”。在我们的示例中conan安装了 Poco 软件包及其所有需求 openssl/1.0.2tzlib/1.2.11 Tip This is a good example of overriding requirements given the importance of keeping the OpenSSL library updated. 鉴于保持更新 OpenSSL 库的重要性这是一个overriding requirements的好例子。 Consider that a new release of the OpenSSL library has been released, and a new corresponding Conan package is available. In our example, we do not need to wait until pocoproject (the author) generates a new package of POCO that includes the new OpenSSL library. 考虑到 OpenSSL 库的新版本已经发布相应的新 Conan 软件包也已可用。在我们的示例中我们不需要等到 pocoproject作者生成包含新 OpenSSL 库的 POCO 新软件包。 We can simply enter the new version in the [requires] section: 我们只需在【requires】部分输入新版本即可 [requires] poco/1.9.4 openssl/1.0.2uThe second line will override the openssl/1.0.2t required by POCO with the currently non-existent openssl/1.0.2u. 第二行将用目前不存在的 openssl/1.0.2u 覆盖 POCO 所需的 openssl/1.0.2t。 Another example in which we may want to try some new zlib alpha features: we could replace the zlib requirement with one from another user or channel. 另一个例子是我们可能想尝试一些新的 zlib alpha 功能我们可以用另一个user 或 channel的 zlib 需求来替换。 [requires] poco/1.9.4 openssl/1.0.2u zlib/1.2.11otheruser/alphaNote You can use environment variable CONAN_ERROR_ON_OVERRIDE to raise an error for every overridden requirement not marked explicitly with the override keyword. 你可以使用环境变量 CONAN_ERROR_ON_OVERRIDE为每一个未明确标记覆盖关键字的覆盖需求引发错误。 4 Generators Conan reads the [generators] section from conanfile.txt and creates files for each generator with all the information needed to link your program with the specified requirements. The generated files are usually temporary, created in build folders and not committed to version control, as they have paths to local folders that will not exist in another machine. Moreover, it is very important to highlight that generated files match the given configuration (Debug/Release, x86/x86_64, etc) specified when running conan install. If the configuration changes, the files will change accordingly. Conan 会读取 conanfile.txt 中的 [generators] 部分并为每个生成器generator创建文件其中包含将程序与指定要求链接到您自己程序所需的所有信息。生成的文件通常是临时文件创建在构建文件夹中不会提交到版本控制中因为它们的路径指向本地文件夹而这些文件夹在另一台机器中并不存在。此外必须确保生成的文件与运行 conan install 时指定的配置Debug/Release、x86/x86_64 等相匹配。如果配置更改文件也会相应更改。 For a full list of generators, please refer to the complete generators reference.、 有关generators的完整列表请参阅完整的generators参考资料。 5 Options We have already seen that there are some settings that can be specified during installation. For example, conan install .. -s build_typeDebug. These settings are typically a project-wide configuration defined by the client machine, so they cannot have a default value in the recipe. For example, it doesn’t make sense for a package recipe to declare “Visual Studio” as a default compiler because that is something defined by the end consumer, and unlikely to make sense if they are working in Linux. 我们已经看到在安装过程中可以指定一些设置。例如conan install ... -s build_typeDebug。这些设置通常是由客户机器定义的项目范围内的配置因此它们在recipe中不可能有默认值。例如在软件包配方中将 Visual Studio 声明为默认编译器是不合理的因为这是由最终用户定义的如果他们在 Linux 中工作就不可能将其作为默认编译器。 On the other hand, options are intended for package specific configuration that can be set to a default value in the recipe. For example, one package can define that its default linkage is static, and this is the linkage that should be used if consumers don’t specify otherwise. 另一方面options用于软件包的特定配置可以在recipe中设置为默认值。例如一个软件包可以定义其默认链接为静态链接如果消费者没有另行指定就应该使用这种链接。 Note You can see the available options for a package by inspecting the recipe with conan get reference command: 使用 conan get reference 命令查看配方可以看到软件包的可用选项 $ conan get poco/1.9.4To see only specific fields of the recipe you can use the conan inspect command instead: 如果只想查看配方的特定字段可以使用 conan inspect 命令 $ conan inspect poco/1.9.4 -aoptions $ conan inspect poco/1.9.4 -adefault_optionsFor example, we can modify the previous example to use dynamic linkage instead of the default one, which was static, by editing the [options] section in conanfile.txt: 例如我们可以通过编辑 conanfile.txt 中的 [options] 部分修改前面的示例使用动态链接而不是默认的静态链接 [requires] poco/1.9.4[generators] cmake[options] poco:sharedTrue # PACKAGE:OPTIONVALUE openssl:sharedTrueInstall the requirements and compile from the build folder (change the CMake generator if not in Windows): 安装requirements并从构建文件夹编译如果不是在 Windows 系统中请更改 CMake 生成器 $ conan install .. $ cmake .. -G Visual Studio 14 Win64 $ cmake --build . --config ReleaseAs an alternative to defining options in the conanfile.txt file, you can specify them directly in the command line: 除了在 conanfile.txt 文件中定义选项外还可以直接在命令行中指定选项 $ conan install .. -o poco:sharedTrue -o openssl:sharedTrue # or even with wildcards, to apply to many packages $ conan install .. -o *:sharedTrueConan will install the binaries of the shared library packages, and the example will link with them. You can again inspect the different binaries installed. For example, conan search zlib/1.2.11. Conan 将安装共享库软件包的二进制文件示例将与它们链接。你可以再次检查安装的不同二进制文件。例如Conan 搜索 zlib/1.2.11。 Finally, launch the executable: 最后加载可执行文件 $ ./bin/md5What happened? It fails because it can’t find the shared libraries in the path. Remember that shared libraries are used at runtime, so the operating system, which is running the application, must be able to locate them. 发生了什么失败的原因是在路径中找不到共享库。请记住共享库是在运行时使用的因此运行应用程序的操作系统必须能够找到它们。 We could inspect the generated executable, and see that it is using the shared libraries. For example, in Linux, we could use the objdump tool and see the Dynamic section: 我们可以检查生成的可执行文件看看它是否使用了共享库。例如在 Linux 中我们可以使用 objdump 工具查看动态部分 $ cd bin $ objdump -p md5 ... Dynamic Section:NEEDED libPocoUtil.so.31NEEDED libPocoXML.so.31NEEDED libPocoJSON.so.31NEEDED libPocoMongoDB.so.31NEEDED libPocoNet.so.31NEEDED libPocoCrypto.so.31NEEDED libPocoData.so.31NEEDED libPocoDataSQLite.so.31NEEDED libPocoZip.so.31NEEDED libPocoFoundation.so.31NEEDED libpthread.so.0NEEDED libdl.so.2NEEDED librt.so.1NEEDED libssl.so.1.0.0NEEDED libcrypto.so.1.0.0NEEDED libstdc.so.6NEEDED libm.so.6NEEDED libgcc_s.so.1NEEDED libc.so.6
http://www.hkea.cn/news/14281642/

相关文章:

  • destoon做众筹网站申请公司邮箱
  • 如何建立公司网站网页小说主角王烨
  • 邢台做网站优化费用医院网站建设需要注意什么
  • 地图 添加到网站哈尔滨网站制作建设
  • 公司网站建设网络推广可以做效果图的网站
  • 如何用jsp做网站哈工大 网站开发
  • 网站不良正能量直接进入西南交通建设集团有限公司网站
  • 天津最好网站建设公司长春网络公司宣传
  • 网站建设图片怎么加水印中国最大型网站
  • 东莞哪里能学建设网站网站建设与推广完美结合
  • 网站共享备案wordpress 免费主题下载
  • 算命购物网站建设网页制作三剑客不包括
  • 网站制作 系统定制施工企业质量管理体系应按照我国
  • 在家做衣服的网站上文明网站 做文明网民征文
  • 环保网站主题微商城网站建设信息
  • wordpress建站教程交友wordpress网站的CDN设置
  • 美食网站建设的栏目和模板卫龙的网站是谁做的
  • 建一个网站容易吗香河住房和建设局网站
  • 网站首页的提交怎么做discuz网站论坛间帖子转移
  • 网站设计时图片怎么做聚名网怎么赚钱
  • 网站内的地图导航怎么做的广州小程序商城开发公司
  • 网站建设中面包屑导航的特点搜索引擎seo是什么意思
  • 如何是网站排名上升网络营销市场调研的优势有
  • 赤峰市网站建设手机app软件开发流程
  • 浙江省城乡和住房建设厅网站首页商城网站的建设
  • 建一个公司网站多少钱?新乡做网站公司
  • 培训医院网站建设鄢陵网站建设
  • 建立视频网站在线永久免费的服务器有哪些
  • 个人网站 icp上海大学生兼职做网站
  • 哈尔滨服务好的建站方案忻州网站制作