Skip to content

Commit ba129dc

Browse files
authored
Merge pull request MicrosoftDocs#2612 from MicrosoftDocs/master
1/10/2020 AM Publish
2 parents 5f27606 + 9146ce1 commit ba129dc

2 files changed

Lines changed: 58 additions & 55 deletions

File tree

docs/build/vcpkg.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
2-
title: vcpkg-- A C++ package manager for Windows, Linux and MacOS
3-
description: "vcpkg is a command line package manager that greatly simplifies the acquisition and installation of open-source C++ libraries on Windows."
4-
ms.date: "05/16/2019"
2+
title: "vcpkg: a C++ package manager for Windows, Linux, and MacOS"
3+
description: "vcpkg is a command-line package manager that greatly simplifies the acquisition and installation of open-source C++ libraries on Windows, MacOS, and Linux."
4+
ms.date: "01/10/2020"
55
ms.technology: "cpp-ide"
66
ms.assetid: f50d459a-e18f-4b4e-814b-913e444cedd6
77
---
8-
# vcpkg: A C++ package manager for Windows, Linux and MacOS
8+
# vcpkg: a C++ package manager for Windows, Linux, and MacOS
99

10-
vcpkg is a command-line package manager that 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. As of May 2018 there are over 900 libraries in the Windows catalog and over 350 in the Linux/MacOS catalog. The C++ community is adding more libraries to both catalogs on an ongoing basis.
10+
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.
1111

1212
## Simple yet flexible
1313

14-
With a single command, you can download sources and build a library. vcpkg is itself an open-source project, available on GitHub. You can customize your private clone(s) in any way you like. For example, you can specify different libraries, or different versions of libraries than what are found in the public catalog. You can have multiple clones of vcpkg on a single machine, each one producing custom sets of libraries and/or compilation switches, etc. Each clone is a self-contained environment with its own copy of vcpkg.exe that operates only on its own hierarchy. vcpkg is not added to any environment variables, and has no dependency on the Windows Registry or Visual Studio.
14+
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.
1515

16-
## Sources not binaries
16+
## Sources, not binaries
1717

18-
For libraries in the Windows catalog, vcpkg downloads sources instead of binaries[1]. It compiles those sources using the most recent version of Visual Studio that it can find. In C++, it is very important that any libraries you use are complied with the same compiler, and compiler version, as the application code that links to it. 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 and then use the export command to zip up the binaries and headers for other team members. For more information, see [Export compiled binaries and headers](#export_binaries_per_project) below.
18+
For libraries in the Windows catalog, vcpkg downloads sources instead of binaries<sup>1</sup>. 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](#export_binaries_per_project) below.
1919

20-
If you create a vcpkg clone with private libraries in the ports collection, you can add a port that downloads prebuilt binaries and headers and write a portfile.cmake file that simply copies those files to the desired location.
20+
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.
2121

22-
[1] *Note: for some proprietary libraries, sources are not available. Vcpkg will download compatible prebuilt binaries in these cases.*
22+
<sup>1</sup> *Note: sources are unavailable for some proprietary libraries. In these cases, vcpkg downloads compatible prebuilt binaries.*
2323

2424
## Installation
2525

@@ -34,7 +34,7 @@ Run the bootstrapper in the root folder:
3434

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

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

3939
```cmd
4040
ace 6.4.3 The ADAPTIVE Communication Environment
@@ -61,7 +61,7 @@ After you get the name of a library by using **vcpkg search**, you use **vcpkg i
6161

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

64-
If the portfile specifies dependencies, vcpkg downloads and installs those also. After downloading, vcpkg builds the library by using whatever 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 cannot find the specified build system on the local machine, it downloads and installs it.
64+
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.
6565

6666
```cmd
6767
> vcpkg install boost:x86-windows
@@ -82,7 +82,7 @@ cmake .. -DCMAKE_TOOLCHAIN_FILE=vcpkg\scripts\buildsystems\vcpkg.cmake (Windows)
8282

8383
## List the libraries already installed
8484

85-
After you have installed some libraries, you can use **vcpkg list** to see what you have:
85+
After you've installed some libraries, you can use **vcpkg list** to see what you have:
8686

8787
```cmd
8888
> vcpkg list
@@ -99,15 +99,15 @@ zlib:x86-windows 1.2.11 A compression library
9999

100100
### Per-user
101101

102-
Run **vcpkg integrate install** to configure Visual Studio to locate all vcpkg header files and binaries on a per-user basis without the need for manual editing of VC++ Directories paths. If you have multiple clones, the clone from which you run this command becomes the new default location.
102+
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.
103103

104-
Now you can #include headers simply by typing the folder/header, and auto-complete 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:
104+
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:
105105

106-
![vcpkg IntelliSense integration](media/vcpkg-intellisense.png "vcpkg and IntelliSense")
106+
![vcpkg and IntelliSense](media/vcpkg-intellisense.png "vcpkg and IntelliSense")
107107

108108
### Per project
109109

110-
If you need to use a specific version of a library that is different from the version in your active vcpkg instance, follow these steps:
110+
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:
111111

112112
1. Make a new clone of vcpkg
113113
1. Modify the portfile for the library to obtain the version you need
@@ -116,21 +116,21 @@ If you need to use a specific version of a library that is different from the ve
116116

117117
## Integrate with Visual Studio Code (Linux/MacOS)
118118

119-
Run **vcpkg integrate install** to configure Visual Studio Code on Linux/MacOS with the location of the vcpkg enlistment and enable IntelliSense on source files.
119+
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.
120120

121121
## Target Linux from Windows via WSL
122122

123-
You can produce Linux binaries from a Windows machine by using the Windows Subsystem for Linux (WSL). Follow the instructions to [Set up WSL on Windows 10](/windows/wsl/install-win10), and configure it with the [Visual Studio extension for Linux](https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/). You can put all your built libraries for both Windows and Linux into the same folder and access it from both Windows and WSL.
123+
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](/windows/wsl/install-win10), and configure it with the [Visual Studio extension for Linux](https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/). 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.
124124

125125
## <a name="export_binaries_per_project"></a> Export compiled binaries and headers
126126

127-
Requiring everyone on a team to download and build libraries can be inefficient. A single team member can do that work, and then use **vcpkg export** to create a zip file of the binaries and headers, or a NuGet package (various format available), that can be easily shared with other team members.
127+
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.
128128

129129
## Update/upgrade installed libraries
130130

131-
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 to automatically download and rebuild any or all of your installed libraries that are out of date.
131+
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.
132132

133-
By default, the **upgrade** command only lists the libraries that are out of date; it doesn’t upgrade them. To perform the upgrade, use the **--no-dry-run** option.
133+
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.
134134

135135
```cmd
136136
vcpkg upgrade --no-dry-run
@@ -145,7 +145,7 @@ By default, the **upgrade** command only lists the libraries that are out of dat
145145

146146
### Upgrade example
147147

148-
The following example shows how to upgrade only specified libraries. Note that vcpgk automatically pulls in dependencies as necessary.
148+
The following example shows how to upgrade only specified libraries. vcpkg automatically pulls in dependencies as necessary.
149149

150150
```cmd
151151
c:\users\satyan\vcpkg> vcpkg upgrade tiny-dnn:x86-windows zlib
@@ -166,11 +166,11 @@ You can include any libraries you like in your private ports collection. To sugg
166166

167167
## Remove a library
168168

169-
Type **vcpkg remove** to remove an installed library. If any other libraries depend on it, you are asked to rerun the command with **--recurse**, which causes all downstream libraries to be removed.
169+
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.
170170

171171
## Customize vcpkg
172172

173-
You can modify your clone of vcpkg in any way you like. You can create multiple vcpkg clones and modify the portfiles in each one to obtain specific versions of libraries or specify command-line parameters. For example, in an enterprise, one group of developers might be working on software that has one set of dependencies, and another group might have a different set. You can set up two clones of vcpkg, and modify each one to download the versions of the libraries and the compilation switches, and so on, according to your needs.
173+
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.
174174

175175
## Uninstall vcpkg
176176

@@ -182,14 +182,14 @@ Use the **vcpkg contact --survey** command to send feedback to Microsoft about v
182182

183183
## The vcpkg folder hierarchy
184184

185-
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 do not interfere with each other.
185+
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.
186186

187187
The contents of a vcpkg instance are:
188188

189189
- buildtrees -- contains subfolders of sources from which each library is built
190190
- docs -- documentation and examples
191-
- downloads -- cached copies of any downloaded tools or sources. vcpkg searches here first when you run the install command .
192-
- installed-- Contains the headers and binaries for each installed library. When you integrate with Visual Studio, you are essentially telling it add this folder to its search paths.
191+
- downloads -- cached copies of any downloaded tools or sources. vcpkg searches here first when you run the install command.
192+
- 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.
193193
- packages -- Internal folder for staging between installs.
194194
- ports -- Files that describe each library in the catalog, its version, and where to download it. You can add your own ports if needed.
195195
- scripts -- Scripts (cmake, powershell) used by vcpkg.
@@ -200,20 +200,20 @@ The contents of a vcpkg instance are:
200200

201201
|Command|Description|
202202
|---------|---------|
203-
|**vcpkg search [pat]**|Search for packages available to install|
203+
|**vcpkg search \[pat]**|Search for packages available to install|
204204
|**vcpkg install \<pkg>...**|Install a package|
205205
|**vcpkg remove \<pkg>...**|Uninstall a package|
206206
|**vcpkg remove --outdated**|Uninstall all out-of-date packages|
207207
|**vcpkg list**|List installed packages|
208208
|**vcpkg update**|Display list of packages for updating|
209209
|**vcpkg upgrade**|Rebuild all outdated packages|
210-
|**vcpkg hash \<file> [alg]**|Hash a file by specific algorithm, default SHA512|
210+
|**vcpkg hash \<file> \[alg]**|Hash a file by specific algorithm, default SHA512|
211211
|**vcpkg integrate install**|Make installed packages available user-wide. Requires admin privileges on first use|
212212
|**vcpkg integrate remove**|Remove user-wide integration|
213213
|**vcpkg integrate project**|Generate a referencing NuGet package for individual VS project use|
214-
|**vcpkg export \<pkg>... [opt]...**|Export a package|
214+
|**vcpkg export \<pkg>... \[opt]...**|Export a package|
215215
|**vcpkg edit \<pkg>**|Open up a port for editing (uses %EDITOR%, default 'code')|
216-
|**vcpkg create \<pkg> \<url> [archivename]**|Create a new package|
216+
|**vcpkg create \<pkg> \<url> \[archivename]**|Create a new package|
217217
|**vcpkg cache**|List cached compiled packages|
218218
|**vcpkg version**|Display version information|
219219
|**vcpkg contact --survey**|Display contact information to send feedback.|

0 commit comments

Comments
 (0)