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/vcpkg.md
+29-11Lines changed: 29 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,38 +1,40 @@
1
1
---
2
-
title: vcpkg-- a C++ Package Manager for Windows| Microsoft Docs
2
+
title: vcpkg-- A C++ package manager for Windows, Linux and MacOS | Microsoft Docs
3
3
description: vcpkg is a command line package manager that greatly simplifies the acquisition and installation of open-source C++ libraries on Windows.
4
4
keywords: vcpkg
5
5
author: mikeblome
6
6
ms.author: mblome
7
-
ms.date: 04/06/2018
7
+
ms.date: 05/14/2018
8
8
ms.technology: ["cpp-ide"]
9
9
ms.tgt_pltfrm: "windows"
10
10
ms.assetid: f50d459a-e18f-4b4e-814b-913e444cedd6
11
11
ms.topic: "conceptual"
12
12
dev_langs: ["C++"]
13
13
ms.workload: ["cplusplus"]
14
14
---
15
-
# vcpkg: C++ Package Manager for Windows
15
+
# vcpkg: A C++ package manager for Windows, Linux and MacOS
16
16
17
-
vcpkg is a command-line package manager that greatly simplifies the acquisition and installation of third-party libraries on Windows. 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 public catalog have been tested for compatibility with Visual Studio 2015 and Visual Studio 2017. As of January 2018 there are over 600 libraries in the catalog and the C++ community is adding more libraries on an ongoing basis.
17
+
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 and Visual Studio 2017. 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.
18
18
19
19
## Simple yet flexible
20
20
21
21
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, x-copyable 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.
22
22
23
23
## Sources not binaries
24
24
25
-
For libraries in the public catalog, vcpkg downloads sources instead of binaries[1]. It compiles those sources using Visual Studio 2017, or Visual Studio 2015 if 2017 is not installed. 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 the Visual C++ 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 below.
25
+
For libraries in the Windows catalog, vcpkg downloads sources instead of binaries[1]. It compiles those sources using Visual Studio 2017, or Visual Studio 2015 if 2017 is not installed. 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 the Visual C++ 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.
26
26
27
27
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.
28
28
29
29
[1]*Note: for some proprietary libraries, sources are not available. Vcpkg will download compatible prebuilt binaries in these cases.*
30
30
31
-
## Installation
31
+
## Installation
32
32
33
33
Clone the vcpkg repo from GitHub: https://github.com/Microsoft/vcpkg. You can download to any folder location you prefer.
34
34
35
-
Run the bootstrapper in the root folder: **bootstrap-vcpkg.bat**.
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 x86-windows. 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 MSBuild projects files 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.
69
+
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.
70
+
71
+
For Linux libraries, vcpkg depends on gcc being installed on the local machine. On MacOS, vcpkg uses Clang.
72
+
73
+
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.
68
74
69
75
```cmd
70
76
> vcpkg install boost:x86-windows
@@ -74,6 +80,14 @@ The following packages will be built and installed:
74
80
* bzip2:x86-windows
75
81
* zlib:x86-windows
76
82
Additional packages (*) will be installed to complete this operation.
83
+
84
+
```
85
+
86
+
For CMAKE projects, use use CMAKE_TOOLCHAIN_FILE to make libraries available with `find_package()`. For example:
@@ -91,7 +105,7 @@ websocketpp:x86-windows 0.7.0 Library that implements RFC6455 The WebSocket P
91
105
zlib:x86-windows 1.2.11 A compression library
92
106
```
93
107
94
-
## Integrate with Visual Studio
108
+
## Integrate with Visual Studio (Windows)
95
109
96
110
### Per-user
97
111
@@ -110,7 +124,12 @@ If you need to use a specific version of a library that is different from the ve
110
124
1. Run **vcpkg install \<library>**.
111
125
1. Use **vcpkg integrate project** to create a NuGet package that references that library on a per-project basis.
112
126
113
-
## Export compiled binaries and headers
127
+
## Target Linux from Windows via WSL
128
+
129
+
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](https://docs.microsoft.com/en-us/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.
130
+
131
+
132
+
## <aname="export_binaries_per_project"></a> Export compiled binaries and headers
114
133
115
134
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 that can be easily shared with other team members.
116
135
@@ -233,7 +252,6 @@ The contents of a vcpkg instance are:
233
252
|**vcpkg integrate project**|Generate a referencing NuGet package for individual VS project use|
234
253
|**vcpkg export \<pkg>... [opt]...**|Export a package|
235
254
|**vcpkg edit \<pkg>**|Open up a port for editing (uses %EDITOR%, default 'code')|
236
-
|**vcpkg import \<pkg>**|Import a pre-built library|
237
255
|**vcpkg create \<pkg> \<url> [archivename]**|Create a new package|
238
256
|**vcpkg owns \<pat>**|Search for files in installed packages|
0 commit comments