适用于 C++ 的 Windows 包管理器图书馆

发布于 2024-12-10 00:51:16 字数 445 浏览 1 评论 0原文

我一直致力于各种开源项目,其中涉及以下 C++ 库(及其他库):

  • MuPDF
  • Boost
  • FreeType
  • GTKmm
  • hummus PDF 库
  • LibTiff
  • LibXML2
  • Wt xpdf
  • xpdf
  • Poppler
  • ZLib

配置这些库通常需要很长时间,当将它们设置在干净的机器上。有没有办法自动获取 Windows 机器上的所有依赖项?

我发现的最接近的是 CMake,它会检查以确保在生成项目文件之前安装/提取了依赖项。但我还没有找到任何适用于 Windows 的东西,可以解析依赖项列表,然后下载+安装所需的版本。

请推荐一个带有最新 C++ 库的 Windows 包管理器。

I've been working on various open-source projects, which involve the following C++ libraries (& others):

  • MuPDF
  • Boost
  • FreeType
  • GTKmm
  • hummus PDF libraries
  • LibTiff
  • LibXML2
  • Wt xpdf
  • xpdf
  • Poppler
  • ZLib

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?

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.

Please recommend a package manager for Windows with up-to-date C++ libraries.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

十六岁半 2024-12-17 00:51:16

Vcpkg 是一个 Microsoft 开源项目,可帮助您在 Windows 上获取 C 和 C++ 库。

Vcpkg, a Microsoft open source project, helps you get C and C++ libraries on Windows.

初雪 2024-12-17 00:51:16

当您已经使用 CMake 设置项目时,请查看 Hunter 包管理器。它会自动下载并构建您的依赖项,只需几行额外的 cmake 代码。 Hunter 基于 cmake 导出和导入目标。

例如,如果您想在基于 cmake 的项目中使用 GoogleTest 库,您可以将以下行添加到您的根 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”使用,但该项目是开源的,因此您可以为您的依赖项创建猎人包并将它们提交到项目中。 这里是已经作为猎人包提供的库的列表。

这并不能立即解决您的所有问题,因为您必须为您的依赖项创建猎人包。但现有的框架已经做了很多工作,最好使用它,而不是半途而废的自制解决方案。

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.

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)

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.

柳絮泡泡 2024-12-17 00:51:16

Biicode 是一个新的 C++ 依赖管理器。它还具有您列出的一些库。 Biicode 会自动扫描您的源文件中的依赖项、下载并构建它们。请参阅此处,了解包含 Freeglut 的非常酷的示例。

Biicode is a new dependency manager for C++. It also has a few libraries that you listed. Biicode automatically scans your source files for dependencies, downloads and builds them. See here for a very cool example that includes Freeglut.

小兔几 2024-12-17 00:51:16

我发现了什么:

最接近我正在寻找的东西:

不幸的是它没有任何我在其存储库中需要的库。

因此,我最终从 KDE4windows 项目 获取大部分库,并自定义构建其余的库。

What I've found:

Closest thing to what I'm looking for:

Unfortunately it doesn't have any of the libraries I require in its repository.

So I ended getting most of the libraries from the KDE4windows project and custom building the rest.

你好,陌生人 2024-12-17 00:51:16

Npackd 是 Windows 的包管理器。有一个默认的 C++ 库存储库,还有一个第三方Visual Studio 2010 的存储库 64位库。 Boost 和 zlib 已经在默认存储库中。如果您决定使用 Npackd,则可以提出问题,如果你需要其他库。

Npackd is a package manager for Windows. There is a default repository for C++ libraries and also a third party repository for Visual Studio 2010 64 bit libraries. Boost and zlib are already in the default repository. If you decide to use Npackd, you could file an issue if you need other libraries.

流殇 2024-12-17 00:51:16

Windows 没有包管理器。访问图书馆网站并下载 Windows 版本(如果有)。

有一些替代方案,但并非没有缺点:

  • Cygwin:提供了一个很好的包管理器,但所有二进制文件都是为 Cygwin 构建的,这意味着它们的运行速度比其本机等效项慢,任何使用它们的应用程序都将链接到 Cygwin DLL,并且您'重新使用该许可证。此外,由于与提供的 POSIX 模拟不兼容,使用本机 Win32 API 有时会很麻烦。仅适用于海湾合作委员会。
  • MinGW-get:是 MinGW.org 编译器的包管理器。这些是本机 Win32 二进制文件,但仅适用于 MinGW 的 GCC。

对于任何与 Visual Studio 或 MinGW-w64 相关的东西,没有包管理器或稍微等效的东西。

Windows does not have a package manager. Go to the libraries' website and download the Windows builds if they provide any.

There are some alternatives, but not without drawbacks:

  • Cygwin: provides a nice package manager, but all binaries are built for Cygwin, which means they run slower than their native equivalent, any apps using them will link to the Cygwin DLL, and you're stuck with that license. Also the use of the native Win32 API is sometimes troublesome due to incompatibility with the POSIX emulation offered. Only for GCC.
  • MinGW-get: is a package manager for the MinGW.org compiler. These are native Win32 binaries, but only for use with MinGW's GCC.

There is no package manager or slightly equivalent thing for anything Visual Studio or MinGW-w64 related.

魂ガ小子 2024-12-17 00:51:16

Windows 上没有包管理。在 Windows 上,开发人员通常使用成熟的一切开发环境,并自行生成带有所有依赖项的整体应用程序。

There is no package management on Windows. On Windows developers typically use full-blown everything-and-the-kitchen-sink development environments and produce monolithic applications themselves, shipped with all dependencies.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文