C ++的软件包管理 [英] Package Management for C++

查看:55
本文介绍了C ++的软件包管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一家公司工作,他们建立一个项目,这些项目由不同的开发人员团队分别开发的组件分开.一切都在C ++中.

I am working in a company that they build a project separated in components that are developed separately by different developer teams. Everything in C++.

他们使用许多共同的库并对其进行管理,他们创建了一个以某种方式将项目版本与库版本相关联的工具.

They use a lot of libraries in common and to manage all of them, they created a tool to somehow relates the version of the project and versions of libraries.

问题在于市场上已经有一些工具可以做到这一点:

The question is about the existence of some tool in the market that already does this:

我的意思是,如果转到此工具,则可以下载例如我们项目的版本4.0,该版本具有库1的4.5版本和库2的3.4版本.如果单击下载",则将下载整个(项目+库)项目的源代码(或二进制)以及每个库的具体版本.

I mean, If I go to this tool, I can download for example the version 4.0 of our project that has exactly the version 4.5 of the library 1 and 3.4 of library 2. If I click "Download", I will Download the source code (or binary) of this entire (project + libraries) project and the concrete version of each library.

例如,如果我要下载公司中其他开发人员的另一个项目,并使用不同版本或平台的相同库,则只需选择该选项,然后下载包含库1版本5.0和库2 2.5的项目2.,依此类推.

For example if I want to Download another project of another developers in the company, using same libraries in different version or platforms, I only have to choose that and is gonna download the project 2 with library 1 version 5.0 and library 2 2.5, and so on.

市场上是否有任何工具可以让我大声创建类似的关系,并且顺便说一句,它与代码存储库(在我们的例子中是gitlab)连接?

Is there in the market any tool that aloud me to create some relations like that, and btw, connects with code repo (gitlab in our case)?

我检查了Gradle,Conan,...,但是他们建立了而不是管理组件之间的关系".

I checked Gradle, Conan, ... but they build, not manage "relations" between components.

类似的东西:

推荐答案

CMake提供了足够的功能来在构建系统中创建这些类型的关系.不幸的是,您必须使用CMake来管理所有项目的构建,以使其正常运行.CMake确实针对Visual Studio以及GCC,Clang和ICC.如果您对此感兴趣,请继续阅读.

CMake provides enough functionality to create these kinds of relationships within your build system. Unfortunately you have to use CMake to manage the builds for all of your projects for this to work well. CMake does target Visual Studio as well as GCC, Clang, and ICC. If this interests you keep reading.

  1. 使用 CMake 为您的从属项目构建构建配置.
  2. 使用 ExternalProject 命令来表示父项目的依赖关系.
    • ExternalProject支持Git以及Mecurial,CSV,SVN和直接tarball下载.
    • 您可以在Git中指定确切的提交,标记或分支.
    • 支持通过SSL或基本HTTP进行Git身份验证.
  1. Use CMake to construct build configurations for your dependent projects.
  2. Use ExternalProject commands to express the dependencies of the parent projects.
    • ExternalProject supports Git as well as Mecurial, CSV, SVN, and direct tarball downloads.
    • You can specify the exact commit, tag, or branch in Git.
    • Supports Git authentication via SSL or Basic HTTP.

依赖示例

ExternalProject_Add(
    Library1
    GIT_REPOSITORY https://git@gitlab.yourdomain.com/repo/library_1.git
    GIT_TAG tag_S.33.91
    HTTP_USERNAME ciserv
    HTTP_PASSWORD Obfusc@t3M3
    CMAKE_ARGS
        -DBUILD_EXAMPLES:BOOL=OFF
        -DBUILD_TESTS:BOOL=OFF
        -DBUILD_DOCS:BOOL=OFF
)
target_link_libraries(MyTarget PRIVATE Library1)

ExternalProject模块中还有其他一些命令,可以根据需要进一步自定义依赖项.

There are several other commands within the ExternalProject module that can be used to further customize the dependency if required.

这篇关于C ++的软件包管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆