You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/vcpkg.md
+32-32Lines changed: 32 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,25 @@
1
1
---
2
-
title: vcpkg-- A C++ package manager for Windows, Linux and MacOS
3
-
description: "vcpkg is a commandline 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"
5
5
ms.technology: "cpp-ide"
6
6
ms.assetid: f50d459a-e18f-4b4e-814b-913e444cedd6
7
7
---
8
-
# vcpkg: A C++ package manager for Windows, Linux and MacOS
8
+
# vcpkg: a C++ package manager for Windows, Linux, and MacOS
9
9
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.
11
11
12
12
## Simple yet flexible
13
13
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.
15
15
16
-
## Sources not binaries
16
+
## Sources, not binaries
17
17
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.
19
19
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.
21
21
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.*
23
23
24
24
## Installation
25
25
@@ -34,7 +34,7 @@ Run the bootstrapper in the root folder:
34
34
35
35
To see what packages are available, at the command prompt type: **vcpkg search**
36
36
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:
38
38
39
39
```cmd
40
40
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
61
61
62
62
For Linux libraries, vcpkg depends on gcc being installed on the local machine. On MacOS, vcpkg uses Clang.
63
63
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.
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:
86
86
87
87
```cmd
88
88
> vcpkg list
@@ -99,15 +99,15 @@ zlib:x86-windows 1.2.11 A compression library
99
99
100
100
### Per-user
101
101
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.
103
103
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:
105
105
106
-

106
+

107
107
108
108
### Per project
109
109
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:
111
111
112
112
1. Make a new clone of vcpkg
113
113
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
116
116
117
117
## Integrate with Visual Studio Code (Linux/MacOS)
118
118
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.
120
120
121
121
## Target Linux from Windows via WSL
122
122
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.
124
124
125
125
## <aname="export_binaries_per_project"></a> Export compiled binaries and headers
126
126
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.
128
128
129
129
## Update/upgrade installed libraries
130
130
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.
132
132
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.
134
134
135
135
```cmd
136
136
vcpkg upgrade --no-dry-run
@@ -145,7 +145,7 @@ By default, the **upgrade** command only lists the libraries that are out of dat
145
145
146
146
### Upgrade example
147
147
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.
@@ -166,11 +166,11 @@ You can include any libraries you like in your private ports collection. To sugg
166
166
167
167
## Remove a library
168
168
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.
170
170
171
171
## Customize vcpkg
172
172
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 oneto 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 setup 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.
174
174
175
175
## Uninstall vcpkg
176
176
@@ -182,14 +182,14 @@ Use the **vcpkg contact --survey** command to send feedback to Microsoft about v
182
182
183
183
## The vcpkg folder hierarchy
184
184
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.
186
186
187
187
The contents of a vcpkg instance are:
188
188
189
189
- buildtrees -- contains subfolders of sources from which each library is built
190
190
- 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.
193
193
- packages -- Internal folder for staging between installs.
194
194
- ports -- Files that describe each library in the catalog, its version, and where to download it. You can add your own ports if needed.
195
195
- scripts -- Scripts (cmake, powershell) used by vcpkg.
@@ -200,20 +200,20 @@ The contents of a vcpkg instance are:
200
200
201
201
|Command|Description|
202
202
|---------|---------|
203
-
|**vcpkg search [pat]**|Search for packages available to install|
203
+
|**vcpkg search \[pat]**|Search for packages available to install|
204
204
|**vcpkg install \<pkg>...**|Install a package|
205
205
|**vcpkg remove \<pkg>...**|Uninstall a package|
206
206
|**vcpkg remove --outdated**|Uninstall all out-of-date packages|
207
207
|**vcpkg list**|List installed packages|
208
208
|**vcpkg update**|Display list of packages for updating|
209
209
|**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|
211
211
|**vcpkg integrate install**|Make installed packages available user-wide. Requires admin privileges on first use|
0 commit comments