Windows C ++库程序包管理器 [英] Windows package-manager for C++ libraries
问题描述
我一直在从事各种开源项目,这些项目涉及以下C ++库(及其他):
I've been working on various open-source projects, which involve the following C++ libraries (& others):
- MuPDF
- 提升
- FreeType
- GTKmm
- hummus PDF库
- LibTiff
- LibXML2
- Wt xpdf
- xpdf
- Poppler
- ZLib
在干净的计算机上设置这些库时,通常需要很长时间来配置它们.有没有一种方法可以自动捕获Windows计算机上的所有依赖项?
It often takes a long time to configure these libraries, when setting them up on a clean machine. Is there a way to automate the grabbing of all dependencies on a windows machine?
我找到的最接近的是CMake,它会在生成项目文件之前进行检查,以确保您已安装/提取了依赖项.但是我还没有找到Windows可以解析依赖项列表然后下载并安装所需版本的任何东西.
The closest I've found is CMake, which checks to make sure you have the dependencies installed/extracted before generating your project files. But I haven't found anything for Windows which can parse the list of dependencies and then download+install the required versions.
请推荐具有最新C ++库的Windows软件包管理器.
Please recommend a package manager for Windows with up-to-date C++ libraries.
推荐答案
看看猎人包管理器,当您已经使用CMake设置您的项目时.它会自动下载并构建您的依赖项,而仅需几行额外的cmake代码.Hunter基于cmake的导出和导入目标.
Take a look at the Hunter package manager when you already use CMake to setup your project. It automatically downloads and builds your dependencies whith only a few lines of extra cmake code. Hunter is based on cmake export and import targets.
例如,如果您想在基于cmake的项目中使用GoogleTest库,则可以将以下行添加到根CMakeLists.txt
For example if you want to use the GoogleTest library in your cmake based project you would add the following lines to your root CMakeLists.txt
# file root CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
# To get hunter you need to download and include a single cmake file
# see documentation for correct name
include("../gate.cmake")
project(download-gtest)
# set the location of all your hunter-packages
set( HUNTER_ROOT_DIR C:/CppLibraries/HunterLibraries )
# This call automaticall downloads and compiles gtest the first time
# cmake is executed. The library is then cached in the HUNTER_ROOT_DIR
hunter_add_package(GTest)
# Now the GTest library can be found and linked to by your own project
find_package(GTest CONFIG REQUIRED)
add_executable(foo foo.cpp)
target_link_libraries(foo GTest::main)
并非您列出的所有库都可以作为"hunter-packages"使用,但是该项目是开源的,因此您可以为依赖项创建hunter-packages并将它们提交到项目中.此处是已经作为猎人软件包可用的库列表.
Not all the libraries you list are available as "hunter-packages" but the project is open source so you can create hunter-packages for your dependencies and commit them to the project. Here is a list of libraries that are already available as hunter packages.
这不能立即解决所有问题,因为您必须为依赖项创建猎人程序包.但是现有的框架已经完成了很多工作,最好使用它而不是半途而废的自制解决方案.
This will not solve all your problems out of the box because you have to create hunter-packages for your dependencies. But the existing framework already does a lot of the work and it is better to use that instead of having a half-assed selfmade solution.
这篇关于Windows C ++库程序包管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!