-->

2019-10-27  dotnet add package boost -version 1.71.0 For projects that support PackageReference, copy this XML node into the project file to reference the package. 2019-12-11  Ten Boost libraries are already included in the C Standards Committee's Library Technical Report and will be included in the upcoming revision of the C Standard. More Boost libraries are proposed for the upcoming TR2. Changes in this release. Boost 1.66 includes 3 new libraries (Beast, CallableTraits, Mp11) as well.

vcpkg is a command-line package manager for C++. It greatly simplifies the acquisition and installation of third-party libraries on Windows, Linux, and MacOS. If your project uses third-party libraries, we recommend that you use vcpkg to install them. vcpkg supports both open-source and proprietary libraries. All libraries in the vcpkg Windows catalog have been tested for compatibility with Visual Studio 2015, Visual Studio 2017, and Visual Studio 2019. Between the Windows and Linux/MacOS catalogs, vcpkg now supports over 1900 libraries. The C++ community is adding more libraries to both catalogs on an ongoing basis.

Simple yet flexible

With a single command, you can download sources and build a library. vcpkg is itself an open-source project, available on GitHub. It's possible to customize your private vcpkg clones in any way you like. For example, specify different libraries, or different versions of libraries than the ones found in the public catalog. You can have multiple clones of vcpkg on a single machine. Each one may be set to produce a custom collection of libraries, with your preferred compilation switches. Each clone is a self-contained environment with its own copy of vcpkg.exe that operates only on its own hierarchy. vcpkg isn't added to any environment variables, and has no dependency on the Windows Registry or Visual Studio.

Brew Install Boost

Sources, not binaries

For libraries in the Windows catalog, vcpkg downloads sources instead of binaries1. It compiles those sources using the most recent version of Visual Studio that it can find. In C++, it's important that both your application code and any libraries you use are compiled by the same compiler, and compiler version. By using vcpkg, you eliminate or at least greatly reduce the potential for mismatched binaries and the problems they can cause. In teams that are standardized on a specific version of a compiler, one team member can use vcpkg to download sources and compile a set of binaries. Then they can use the export command to zip up the binaries and headers for other team members. For more information, see Export compiled binaries and headers below.

You can also create a vcpkg clone that has private libraries in the ports collection. Add a port that downloads your prebuilt binaries and headers. Then, write a portfile.cmake file that simply copies those files to the preferred location.

1Note: sources are unavailable for some proprietary libraries. In these cases, vcpkg downloads compatible prebuilt binaries.

Installation

Clone the vcpkg repo from GitHub: https://github.com/Microsoft/vcpkg. You can download to any folder location you prefer.

Run the bootstrapper in the root folder:

  • bootstrap-vcpkg.bat (Windows)
  • ./bootstrap-vcpkg.sh (Linux, MacOS)

Search the list of available libraries

To see what packages are available, at the command prompt type: vcpkg search

This command enumerates the control files in the vcpkg/ports subfolders. You'll see a listing like this:

You can filter on a pattern, for example vcpkg search ta:

Install a library on your local machine

After you get the name of a library by using vcpkg search, you use vcpkg install to download the library and compile it. vcpkg uses the library's portfile in the ports directory. If no triplet is specified, vcpkg will install and compile for the default triplet for the target platform: x86-windows, x64-linux.cmake, or x64-osx.cmake.

For Linux libraries, vcpkg depends on gcc being installed on the local machine. On MacOS, vcpkg uses Clang.

When the portfile specifies dependencies, vcpkg downloads and installs them too. After downloading, vcpkg builds the library by using the same build system the library uses. CMake and (on Windows) MSBuild projects are preferred, but MAKE is supported, along with any other build system. If vcpkg can't find the specified build system on the local machine, it downloads and installs it.

For CMAKE projects, use CMAKE_TOOLCHAIN_FILE to make libraries available with find_package(). For example:

List the libraries already installed

After you've installed some libraries, you can use vcpkg list to see what you have:

Integrate with Visual Studio (Windows)

Per-user

Run vcpkg integrate install to configure Visual Studio to locate all vcpkg header files and binaries on a per-user basis. There's no need for manual editing of VC++ Directories paths. If you have multiple clones, the clone you run this command from becomes the new default location.

Now you can #include headers simply by typing the folder/header, and autocomplete assists you. No additional steps are required for linking to libs or adding project references. The following illustration shows how Visual Studio finds the azure-storage-cpp headers. vcpkg places its headers in the /installed subfolder, partitioned by target platform. The following diagram shows the list of include files in the /was subfolder for the library:

Per project

If you need to use a specific version of a library that's different from the version in your active vcpkg instance, follow these steps:

  1. Make a new clone of vcpkg
  2. Modify the portfile for the library to obtain the version you need
  3. Run vcpkg install <library>.
  4. Use vcpkg integrate project to create a NuGet package that references that library on a per-project basis.

Integrate with Visual Studio Code (Linux/MacOS)

Run vcpkg integrate install to configure Visual Studio Code on Linux/MacOS. This command sets the location of the vcpkg enlistment and enables IntelliSense on source files.

Target Linux from Windows via WSL

You can produce Linux binaries on a Windows machine by using the Windows Subsystem for Linux, or WSL. Follow the instructions to Set up WSL on Windows 10, and configure it with the Visual Studio extension for Linux. It's okay to put all your built libraries for Windows and Linux into the same folder. They're accessible from both Windows and WSL.

Export compiled binaries and headers

It's inefficient to make everyone on a team download and build common libraries. A single team member can use the vcpkg export command to create a common zip file of the binaries and headers, or a NuGet package. Then, it's easy to share it with other team members.

Update/upgrade installed libraries

The public catalog is kept up to date with the latest versions of the libraries. To determine which of your local libraries are out-of-date, use vcpkg update. When you're ready to update your ports collection to the latest version of the public catalog, run the vcpkg upgrade command. It automatically downloads and rebuilds any or all of your installed libraries that are out of date.

By default, the upgrade command only lists the libraries that are out of date; it doesn't upgrade them. To actually upgrade the libraries, use the --no-dry-run option.

Upgrade Options

  • --no-dry-run Perform the upgrade; when not specified, the command only lists the out-of-date packages.
  • --keep-going Continue installing packages even if one fails.
  • --triplet <t> Set the default triplet for unqualified packages.
  • --vcpkg-root <path> Specify the vcpkg directory to use instead of current directory or tool directory.

Upgrade example

The following example shows how to upgrade only specified libraries. vcpkg automatically pulls in dependencies as necessary.

Contribute new libraries

You can include any libraries you like in your private ports collection. To suggest a new library for the public catalog, open an issue on the GitHub vcpkg issue page.

Remove a library

Type vcpkg remove to remove an installed library. If any other libraries depend on it, you're asked to rerun the command with --recurse, which causes all downstream libraries to be removed.

Customize vcpkg

You can modify your clone of vcpkg in any way you like. You can even create multiple vcpkg clones, then modify the portfiles in each one. That's a simple way to obtain specific library versions, or to specify particular command-line parameters. For example, in an enterprise, individual groups of developers might work on software that has a set of dependencies specific to their group. The solution is to set up a clone of vcpkg for each team. Then, modify the clones to download the library versions and set the compilation switches that each team needs.

Iphoto library download for mac. Users with multiple digital photo storage areas may have difficulty working with them using traditional photo programs. While limited in terms of features, iPhoto Library Manager for Mac works. IPhoto Library Manager for Mac allows you to organize your photos among multiple iPhoto libraries, rather than having to store all of your photos in one giant library. You can browse the photos in all your libraries directly from iPhoto Library Manager, without having to open each library in iPhoto just to see its photos, and search across all your libraries to help track down a particular photo. All your photos on all your devices. ICloud Photos gives you access to your entire Mac photo and video library from all your devices. If you shoot a snapshot, slo-mo, or selfie on your iPhone, it’s automatically added to iCloud Photos — so it appears on your Mac, iOS.

Uninstall vcpkg

Just delete the vcpkg directory. Deleting this directory uninstalls the vcpkg distribution, and all the libraries that vcpkg has installed.

Send feedback about vcpkg

Use the vcpkg contact --survey command to send feedback to Microsoft about vcpkg, including bug reports and suggestions for features.

The vcpkg folder hierarchy

All vcpkg functionality and data is self-contained in a single directory hierarchy, called an 'instance'. There are no registry settings or environment variables. You can have any number of instances of vcpkg on a machine, and they won't interfere with each other.

The contents of a vcpkg instance are:

  • buildtrees -- contains subfolders of sources from which each library is built
  • docs -- documentation and examples
  • downloads -- cached copies of any downloaded tools or sources. vcpkg searches here first when you run the install command.
  • installed-- Contains the headers and binaries for each installed library. When you integrate with Visual Studio, you're essentially telling it add this folder to its search paths.
  • packages -- Internal folder for staging between installs.
  • ports -- Files that describe each library in the catalog, its version, and where to download it. You can add your own ports if needed.
  • scripts -- Scripts (cmake, powershell) used by vcpkg.
  • toolsrc -- C++ source code for vcpkg and related components
  • triplets -- Contains the settings for each supported target platform (for example, x86-windows or x64-uwp).

Command-line reference

CommandDescription
vcpkg search [pat]Search for packages available to install
vcpkg install <pkg>..Install a package
vcpkg remove <pkg>..Uninstall a package
vcpkg remove --outdatedUninstall all out-of-date packages
vcpkg listList installed packages
vcpkg updateDisplay list of packages for updating
vcpkg upgradeRebuild all outdated packages
vcpkg hash <file> [alg]Hash a file by specific algorithm, default SHA512
vcpkg integrate installMake installed packages available user-wide. Requires admin privileges on first use
vcpkg integrate removeRemove user-wide integration
vcpkg integrate projectGenerate a referencing NuGet package for individual VS project use
vcpkg export <pkg>.. [opt]..Export a package
vcpkg edit <pkg>Open up a port for editing (uses %EDITOR%, default 'code')
vcpkg create <pkg> <url> [archivename]Create a new package
vcpkg cacheList cached compiled packages
vcpkg versionDisplay version information
vcpkg contact --surveyDisplay contact information to send feedback.

Options

OptionDescription
--triplet <t>Specify the target architecture triplet. (default: %VCPKG_DEFAULT_TRIPLET%, see also vcpkg help triplet)
--vcpkg-root <path>Specify the vcpkg root directory (default: %VCPKG_ROOT%)
-->

vcpkg 是用于 C++ 的一种命令行包管理器。vcpkg is a command-line package manager for C++.它极大地简化了 Windows、Linux 和 MacOS 上第三方库的购置与安装。It greatly simplifies the acquisition and installation of third-party libraries on Windows, Linux, and MacOS.如果项目要使用第三方库,建议通过 vcpkg 来安装它们。If your project uses third-party libraries, we recommend that you use vcpkg to install them.vcpkg 同时支持开源和专有库。vcpkg supports both open-source and proprietary libraries.已测试 vcpkg Windows 目录中所有库与 Visual Studio 2015、Visual Studio 2017 及 Visual Studio 2019 的兼容性。All libraries in the vcpkg Windows catalog have been tested for compatibility with Visual Studio 2015, Visual Studio 2017, and Visual Studio 2019.在 Windows 和 Linux/MacOS 目录之间,vcpkg 现已支持超过 1900 个库。Between the Windows and Linux/MacOS catalogs, vcpkg now supports over 1900 libraries.C++ 社区正在不断向两个目录添加更多的库。The C++ community is adding more libraries to both catalogs on an ongoing basis.

简单而灵活Simple yet flexible

仅通过单个命令就能下载源并生成库。With a single command, you can download sources and build a library.vcpkg 本身就是一个开源项目,可通过 GitHub 获取。vcpkg is itself an open-source project, available on GitHub.你可以按照自己喜欢的任何方式自定义你的专用 vcpkg 克隆。It's possible to customize your private vcpkg clones in any way you like.例如,除了在公共目录中找到的内容外,还可以指定不同的库或不同版本的库。For example, specify different libraries, or different versions of libraries than the ones found in the public catalog.一台计算机上可以有多个 vcpkg 克隆。You can have multiple clones of vcpkg on a single machine.每一克隆都可以设置为生成带有你首选的编译开关的自定义库集合。Each one may be set to produce a custom collection of libraries, with your preferred compilation switches.每个克隆都是一个自包含的环境,它自身的 vcpkg.exe 副本仅可在自己的层次结构中运行。Each clone is a self-contained environment with its own copy of vcpkg.exe that operates only on its own hierarchy.vcpkg 不会被添加到任何环境变量中,并且在 Windows 注册表或 Visual Studio 上也没有依赖项。vcpkg isn't added to any environment variables, and has no dependency on the Windows Registry or Visual Studio.

是源,而不是二进制文件Sources, not binaries

对于 Windows 目录中的库,vcpkg 会下载源,而不是二进制文件1For libraries in the Windows catalog, vcpkg downloads sources instead of binaries1.它使用可以找到的最新版 Visual Studio 编译这些源代码。It compiles those sources using the most recent version of Visual Studio that it can find.在 C++ 中,有一点至关重要,即你的应用程序代码以及你所使用的任何库应均是由同一编译器和编译器版本编译的。In C++, it's important that both your application code and any libraries you use are compiled by the same compiler, and compiler version.通过 vcpkg 可以消除或最大程度减少不匹配二进制文件的存在风险及它可能造成的问题。By using vcpkg, you eliminate or at least greatly reduce the potential for mismatched binaries and the problems they can cause.对于使用特定编译器版本的标准化团队而言,可让一位成员使用 vcpkg 下载源并编译一组二进制文件。In teams that are standardized on a specific version of a compiler, one team member can use vcpkg to download sources and compile a set of binaries.他们随后可以使用导出命令将二进制文件和标头进行压缩打包,从而与其他团队成员共享。Then they can use the export command to zip up the binaries and headers for other team members.有关详细信息,请参阅下方的导出已编译二进制文件及标头。For more information, see Export compiled binaries and headers below.

你还可以创建一个包含端口集合中的专用库的 vcpkg 克隆。You can also create a vcpkg clone that has private libraries in the ports collection.添加一个可下载预生成的二进制文件和标头的端口。Add a port that downloads your prebuilt binaries and headers.然后,编写一个仅将这些文件复制到首选位置的 portfile.cmake 文件。Then, write a portfile.cmake file that simply copies those files to the preferred location.

1 注意:这些源不适用于某些专有库。 在这些情况下,vcpkg 会下载兼容的预生成二进制文件。1Note: sources are unavailable for some proprietary libraries. In these cases, vcpkg downloads compatible prebuilt binaries.

安装Installation

从 GitHub 克隆 vcpkg 存储库:https://github.com/Microsoft/vcpkg。Clone the vcpkg repo from GitHub: https://github.com/Microsoft/vcpkg.可凭喜好下载到任意文件夹位置。You can download to any folder location you prefer.

在根文件夹中运行 bootstrapper:Run the bootstrapper in the root folder:

  • bootstrap-vcpkg.bat (Windows)bootstrap-vcpkg.bat (Windows)
  • ./bootstrap-vcpkg.sh (Linux、MacOS)./bootstrap-vcpkg.sh (Linux, MacOS)

搜索可用库列表Search the list of available libraries

要查看哪些包可用,请在命令提示符中键入:vcpkg search To see what packages are available, at the command prompt type: vcpkg search

此命令枚举 vcpkg/ports 子文件夹中的控件文件。This command enumerates the control files in the vcpkg/ports subfolders.将出现如下的文件列表:You'll see a listing like this:

Install Boost C++ Library Mac Os

可以根据模式筛选,例如 vcpkg search ta:You can filter on a pattern, for example vcpkg search ta:

在本地计算机上安装库Install a library on your local machine

在使用 vcpkg search 获取库的名称后,可使用 vcpkg install 下载库并对其进行编译 。After you get the name of a library by using vcpkg search, you use vcpkg install to download the library and compile it.vcpkg 在端口目录中使用库的端口文件。vcpkg uses the library's portfile in the ports directory.如果未指定三元组,则 vcpkg 将针对目标平台的默认三元组进行安装和编译:x86-windows、x64-linux.cmake 或 x64-osx.cmake。If no triplet is specified, vcpkg will install and compile for the default triplet for the target platform: x86-windows, x64-linux.cmake, or x64-osx.cmake.

对于 Linux 库,vcpkg 取决于本地计算机上安装的 GCC。For Linux libraries, vcpkg depends on gcc being installed on the local machine.在 MacOS 上,vcpkg 使用 Clang。On MacOS, vcpkg uses Clang.

Install boost c++ library machine

当端口文件指定了依赖项时,vcpkg 也会下载并安装这些依赖项。When the portfile specifies dependencies, vcpkg downloads and installs them too.下载后,vcpkg 将使用库所使用的同一生成系统生成库。After downloading, vcpkg builds the library by using the same build system the library uses.CMake 和 MSBuild(Windows 上)项目是首选,但同时还支持 MAKE 以及其他任何生成系统。CMake and (on Windows) MSBuild projects are preferred, but MAKE is supported, along with any other build system.如果 vcpkg 在本地计算机上找不到指定的生成系统,它会下载并安装一个。If vcpkg can't find the specified build system on the local machine, it downloads and installs it.

对于 CMAKE 项目,通过 CMAKE_TOOLCHAIN_FILE 来配合使用库和 find_package()For CMAKE projects, use CMAKE_TOOLCHAIN_FILE to make libraries available with find_package().例如:For example:

Install Boost C++ Library Macbook Pro

列出已安装的库List the libraries already installed

在安装了某些库后,你可以使用 vcpkg list 来查看所获得的内容 :After you've installed some libraries, you can use vcpkg list to see what you have:

与 Visual Studio (Windows) 集成Integrate with Visual Studio (Windows)

按用户Per-user

运行 vcpkg integrate install 来配置 Visual Studio,以便按用户找到所有 vcpkg 标头文件和二进制文件 。Run vcpkg integrate install to configure Visual Studio to locate all vcpkg header files and binaries on a per-user basis.无需手动编辑 VC++ 目录路径。There's no need for manual editing of VC++ Directories paths.如果有多个克隆,那么你从中运行此命令的克隆则将成为新的默认位置。If you have multiple clones, the clone you run this command from becomes the new default location.

现在,只需键入文件夹/标头即可轻松加入 (#include) 标头,并且自动完成功能将帮助你完成这一切。Now you can #include headers simply by typing the folder/header, and autocomplete assists you.在链接到 lib 或添加项目引用时,无需额外步骤。No additional steps are required for linking to libs or adding project references.下图演示了 Visual Studio 查找 azure-storage-cpp 标头的方法。The following illustration shows how Visual Studio finds the azure-storage-cpp headers.vcpkg 将其标头放置在 /installed 子文件夹中,由目标平台予以分区 。vcpkg places its headers in the /installed subfolder, partitioned by target platform.下图显示库的 /was 子文件夹中包含文件的列表 :The following diagram shows the list of include files in the /was subfolder for the library:

按项目Per project

如果需要使用的库的版本与活动 vcpkg 实例中的版本不同,请按以下步骤操作:If you need to use a specific version of a library that's different from the version in your active vcpkg instance, follow these steps:

  1. 新建 vcpkg 克隆Make a new clone of vcpkg
  2. 修改库的端口文件以获取所需版本Modify the portfile for the library to obtain the version you need
  3. 运行 vcpkg install <library> 。Run vcpkg install <library>.
  4. 使用 vcpkg integrate project 创建 NuGet 包,它会按项目来引用该库。Use vcpkg integrate project to create a NuGet package that references that library on a per-project basis.

与 Visual Studio Code (Linux/MacOS) 集成Integrate with Visual Studio Code (Linux/MacOS)

运行 vcpkg integrate install 在 Linux/MacOS 上配置 Visual Studio Code 。Run vcpkg integrate install to configure Visual Studio Code on Linux/MacOS.此命令将设置 vcpkg 登记的位置,并对源文件启用 IntelliSense。This command sets the location of the vcpkg enlistment and enables IntelliSense on source files.

通过 WSL 从 Windows 指向 LinuxTarget Linux from Windows via WSL

可使用适用于 Linux 的 Windows 子系统(也称为 WSL)在 Windows 计算机上生成 Linux 二进制文件。You can produce Linux binaries on a Windows machine by using the Windows Subsystem for Linux, or WSL.按照说明在 Windows 10 上设置 WSL,并使用适用于 Linux 的 Visual Studio 扩展进行配置。Follow the instructions to Set up WSL on Windows 10, and configure it with the Visual Studio extension for Linux.可以将所有针对 Windows 和 Linux 生成的库放入同一文件夹中。It's okay to put all your built libraries for Windows and Linux into the same folder.可以从 Windows 和 WSL 访问它们。They're accessible from both Windows and WSL.

导出已编译的二进制文件和标头Export compiled binaries and headers

让团队中的每位成员都下载和生成公用库是一种效率较低的做法。It's inefficient to make everyone on a team download and build common libraries.可以单独让一位团队成员使用 vcpkg export 命令创建二进制文件和标头的通用 zip 文件,或者创建 NuGet 包 。A single team member can use the vcpkg export command to create a common zip file of the binaries and headers, or a NuGet package.然后,可以轻松地将它与其他团队成员共享。Then, it's easy to share it with other team members.

更新/升级已安装的库Update/upgrade installed libraries

Install boost c++ library mac download

How To Install Boost C++ Library On Mac

公共目录始终与最新版本的库保持一致。The public catalog is kept up to date with the latest versions of the libraries.要判断哪个本地库已过期,请使用 vcpkg update 。To determine which of your local libraries are out-of-date, use vcpkg update.准备好将端口集合更新到最新版本的公共目录后,请运行 vcpkg upgrade 命令 。When you're ready to update your ports collection to the latest version of the public catalog, run the vcpkg upgrade command.它会自动下载并重新生成已过期的任意或所有已安装的库。It automatically downloads and rebuilds any or all of your installed libraries that are out of date.

默认情况下,upgrade 命令仅列出过期库;而不会对它们进行升级。By default, the upgrade command only lists the libraries that are out of date; it doesn’t upgrade them.若要真正升级这些库,请使用 --no-dry-run 选项 。To actually upgrade the libraries, use the --no-dry-run option.

升级选项Upgrade Options

  • --no-dry-run 执行升级,在没有指定条件的情况下,命令只列出过期的包。--no-dry-run Perform the upgrade; when not specified, the command only lists the out-of-date packages.
  • --keep-going 继续安装包(即使出现了失败)。--keep-going Continue installing packages even if one fails.
  • --triplet <t> 为非限定的包设置默认的三元组。--triplet <t> Set the default triplet for unqualified packages.
  • --vcpkg-root <path> 指定要使用的 vcpkg 目录,而不是使用当前目录或工具目录。--vcpkg-root <path> Specify the vcpkg directory to use instead of current directory or tool directory.

升级示例Upgrade example

以下示例演示如何只升级指定的库。The following example shows how to upgrade only specified libraries.必要时 vcpkg 会自动拉取依赖项。vcpkg automatically pulls in dependencies as necessary.

发布新库Contribute new libraries

可以在自己的专用端口集合中添加任意库。You can include any libraries you like in your private ports collection.要建议适合公共目录的新库,请在 GitHub vcpkg 问题页上打开一个问题。To suggest a new library for the public catalog, open an issue on the GitHub vcpkg issue page.

删除库Remove a library

键入 vcpkg remove 可删除已安装的库。Type vcpkg remove to remove an installed library.如果存在任何其他依赖于它的库,则系统会提示你使用 --recurse 重新运行命令,如执行此操作,则下游的所有库都会被删除 。If any other libraries depend on it, you're asked to rerun the command with --recurse, which causes all downstream libraries to be removed.

自定义 vcpkgCustomize vcpkg

可凭自身喜好随意修改 vcpkg 的克隆。You can modify your clone of vcpkg in any way you like.你甚至可以创建多个 vcpkg 克隆,然后在每个克隆中修改端口文件。You can even create multiple vcpkg clones, then modify the portfiles in each one.这是获取特定库版本或指定特定命令行参数的一种简单方法。That's a simple way to obtain specific library versions, or to specify particular command-line parameters.例如,在企业中,各个开发人员组可能在具有一组特定于他们所在组的依赖项的软件上工作。For example, in an enterprise, individual groups of developers might work on software that has a set of dependencies specific to their group.解决方法是为每个团队设置一个 vcpkg 的克隆。The solution is to set up a clone of vcpkg for each team.然后,修改克隆以下载库版本,并设置每个团队需要的编译开关。Then, modify the clones to download the library versions and set the compilation switches that each team needs.

卸载 vcpkgUninstall vcpkg

只需删除 vcpkg 目录。Just delete the vcpkg directory.删除此目录会卸载 vcpkg 分发以及 vcpkg 已安装的所有库。Deleting this directory uninstalls the vcpkg distribution, and all the libraries that vcpkg has installed.

发送关于 vcpkg 的反馈Send feedback about vcpkg

使用 vcpkg contact --survey 命令向 Microsoft 发送关于 vcpkg 的反馈,包括 Bug 报告和功能上的建议 。Use the vcpkg contact --survey command to send feedback to Microsoft about vcpkg, including bug reports and suggestions for features.

vcpkg 文件夹层次结构The vcpkg folder hierarchy

所有 vcpkg 功能和数据都自包含在称为“实例”的单独目录层次结构中。All vcpkg functionality and data is self-contained in a single directory hierarchy, called an 'instance'.没有注册表设置或环境变量。There are no registry settings or environment variables.可以在一台计算机上设置任意数量的 vcpkg 实例,它们彼此互不干扰。You can have any number of instances of vcpkg on a machine, and they won't interfere with each other.

vcpkg 实例的内容如下:The contents of a vcpkg instance are:

  • buildtrees - 包含从中生成每个库的源的子文件夹buildtrees -- contains subfolders of sources from which each library is built
  • docs - 文档和示例docs -- documentation and examples
  • downloads - 任何已下载工具或源的缓存副本。downloads -- cached copies of any downloaded tools or sources.运行安装命令时,vcpkg 会首先搜索此处。vcpkg searches here first when you run the install command.
  • installed - 包含每个已安装库的标头和二进制文件。installed-- Contains the headers and binaries for each installed library.与 Visual Studio 集成时,实质上是相当于告知它将此文件夹添加到其搜索路径。When you integrate with Visual Studio, you're essentially telling it add this folder to its search paths.
  • packages - 在不同的安装之间用于暂存的内部文件夹。packages -- Internal folder for staging between installs.
  • ports - 用于描述每个库的目录、版本和下载位置的文件。ports -- Files that describe each library in the catalog, its version, and where to download it.如有需要,可添加自己的端口。You can add your own ports if needed.
  • scripts - 由 vcpkg 使用的脚本(cmake、powershell)。scripts -- Scripts (cmake, powershell) used by vcpkg.
  • toolsrc - vcpkg 和相关组件的 C++ 源代码toolsrc -- C++ source code for vcpkg and related components
  • triplets - 包含每个受支持目标平台(如 x86-windows 或 x64-uwp)的设置。triplets -- Contains the settings for each supported target platform (for example, x86-windows or x64-uwp).

命令行参考Command-line reference

命令Command描述Description
vcpkg search [pat]vcpkg search [pat]搜索可安装的包Search for packages available to install
vcpkg install <pkg>..vcpkg install <pkg>..安装包Install a package
vcpkg remove <pkg>..vcpkg remove <pkg>..卸载包Uninstall a package
vcpkg remove --outdatedvcpkg remove --outdated卸载所有过期包Uninstall all out-of-date packages
vcpkg listvcpkg list列出已安装的包List installed packages
vcpkg updatevcpkg update显示用于更新的包列表Display list of packages for updating
vcpkg upgradevcpkg upgrade重新生成所有过期包Rebuild all outdated packages
vcpkg hash <file> [alg]vcpkg hash <file> [alg]通过特定算法对文件执行哈希操作,默认为 SHA512Hash a file by specific algorithm, default SHA512
vcpkg integrate installvcpkg integrate install使已安装包在用户范围内可用。Make installed packages available user-wide.首次使用时需要管理权限Requires admin privileges on first use
vcpkg integrate removevcpkg integrate remove删除用户范围的集成Remove user-wide integration
vcpkg integrate projectvcpkg integrate project为使用单个 VS 项目生成引用 NuGet 包Generate a referencing NuGet package for individual VS project use
vcpkg export <pkg>.. [opt]..vcpkg export <pkg>.. [opt]..导出包Export a package
vcpkg edit <pkg>vcpkg edit <pkg>打开端口进行编辑(使用 %EDITOR%,默认为“code”)Open up a port for editing (uses %EDITOR%, default 'code')
vcpkg create <pkg> <url> [archivename]vcpkg create <pkg> <url> [archivename]创建新程序包Create a new package
vcpkg cachevcpkg cache列出缓存的已编译包List cached compiled packages
vcpkg versionvcpkg version显示版本信息Display version information
vcpkg contact --surveyvcpkg contact --survey显示联系信息,以便发送反馈。Display contact information to send feedback.

选项Options

选项Option描述Description
--triplet <t>--triplet <t>指定目标体系结构三元组。Specify the target architecture triplet.(默认:%VCPKG_DEFAULT_TRIPLET%,另请参阅“vcpkg help triplet” )(default: %VCPKG_DEFAULT_TRIPLET%, see also vcpkg help triplet)
--vcpkg-root <path>--vcpkg-root <path>指定 vcpkg 根目录(默认:%VCPKG_ROOT%Specify the vcpkg root directory (default: %VCPKG_ROOT%)