Maven-like dependency management for C++?(用于 C++ 的类似 Maven 的依赖管理?)
问题描述
假设我有一个 C++ 项目,它分为几个子项目.子项目都生成一个 DLL,不同的开发团队负责每个子项目.现在如果我要构建主项目,有没有办法避免必须自己构建所有子项目?
Say I have a C++ project that is split in several subprojects. The subproject all produce a DLL and different teams of developers work on each of the subproject. Now if I want to build the main project, is there a way to avoid having to build all the subprojects by myself?
简而言之,我正在寻找以与 Maven 对 Java 类似的方式进行依赖管理(即二进制文件和头文件)的东西.
In short, I'm looking for something that does the dependency management (i.e. for binary files and headers) in a similar way as Maven does for Java.
事实上,我尝试为此使用 Maven,但这相当麻烦,因为我必须手动创建包,而且非常频繁,Maven 错过了获取最近的更改.此外,运行编译有点麻烦,因为我必须从 Maven 内部调用 NAnt(我使用 NAnt 的功能直接构建 Visual Studio 解决方案).
In fact, I tried to use Maven for this but this is rather cumbersome because I have to create the packages manually and quite frequently, Maven misses to pick up the most recent changes. Also, running the compilation is a bit of a hack as I have to call NAnt from within Maven (I use NAnt's feature to build Visual Studio solutions directly).
有关如何执行此操作的任何提示和想法?
Any hints and ideas of how to do this?
推荐答案
初始答案:我建议使用 CMake.它是一个多平台的 make 文件生成器(也生成 Visual Studio 或 Eclipse CDT 项目).
Initial Answer: I would suggest using CMake. It is a multi-platform make file generator (generates Visual Studio or Eclipse CDT projects as well).
http://www.cmake.org/
我对它的体验非常好.我最喜欢它的是能够生成通用的项目结构.因此,您通常可以包含单元测试等的子项目查找,而无需每次都更改脚本.
I did really good experience with it. The best thing I like about it was the ability to produce generic project structure. So you can generically include sub-projects look-up for unit tests etc. without changing the script every time.
他们还有很多关于如何查找项目所需的预安装构建库的模块(如 Boost、QT 等)
They have also lots of modules on how to find pre-installed build libraries, required for the project (like Boost, QT etc.)
更新:与此同时,我们努力为 C++ 引入包管理.一些值得关注的项目:
Update: In the mean time there was some effort to introduce package management for C++. Some projects worth looking at:
- conan.io 与主要构建工具集成:
- CMake
- 视觉工作室
- 生成文件
- XCode
- ...
- conan.io integrates with major build tools:
- CMake
- Visual Studio
- Makefile
- XCode
- ...
注意 正如@RAM 在评论中指出的那样,cpm 不再积极维护.
Note as pointed out by @RAM in the comments cpm is no longer actively maintained.
这篇关于用于 C++ 的类似 Maven 的依赖管理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用于 C++ 的类似 Maven 的依赖管理?
基础教程推荐
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 从 std::cin 读取密码 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- Windows Media Foundation 录制音频 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01