Skip to content

Commit b6982be

Browse files
author
mikeblome
committed
updates in progress
1 parent 45dcb95 commit b6982be

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

docs/vcpkg.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
---
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
33
description: vcpkg is a command line package manager that greatly simplifies the acquisition and installation of open-source C++ libraries on Windows.
44
keywords: vcpkg
55
author: mikeblome
66
ms.author: mblome
7-
ms.date: 04/06/2018
7+
ms.date: 05/14/2018
88
ms.technology: ["cpp-ide"]
99
ms.tgt_pltfrm: "windows"
1010
ms.assetid: f50d459a-e18f-4b4e-814b-913e444cedd6
1111
ms.topic: "conceptual"
1212
dev_langs: ["C++"]
1313
ms.workload: ["cplusplus"]
1414
---
15-
# vcpkg: C++ Package Manager for Windows
15+
# vcpkg: C++ package manager
1616

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 public 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 350 in the Linux/MacOS catalog. The C++ community is adding more libraries to both catalogs on an ongoing basis.
1818

1919
## Simple yet flexible
2020

2121
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.
2222

2323
## Sources not binaries
2424

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 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](#export_binaries_per_project) below.
2626

2727
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.
2828

2929
[1] *Note: for some proprietary libraries, sources are not available. Vcpkg will download compatible prebuilt binaries in these cases.*
3030

31-
## Installation
31+
## Installation
3232

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

35-
Run the bootstrapper in the root folder: **bootstrap-vcpkg.bat**.
35+
Run the bootstrapper in the root folder:
36+
- **bootstrap-vcpkg.bat** (Windows)
37+
- ./bootstrap-vcpkg.sh (Linux, MacOS)
3638

3739
## Basic tasks
3840

@@ -64,7 +66,7 @@ taglib 1.11.1-2 TagLib Audio Meta-Data Library
6466

6567
### Install a library on your local machine
6668

67-
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 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 (on Windows) 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.
6870

6971
```cmd
7072
> vcpkg install boost:x86-windows
@@ -74,6 +76,14 @@ The following packages will be built and installed:
7476
* bzip2:x86-windows
7577
* zlib:x86-windows
7678
Additional packages (*) will be installed to complete this operation.
79+
80+
```
81+
82+
For CMAKE projects, use use CMAKE_TOOLCHAIN_FILE to make libraries available with `find_package()`. For example,
83+
84+
```cmd
85+
cmake .. -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake (Linux/MacOS)
86+
cmake .. -DCMAKE_TOOLCHAIN_FILE=vcpkg\scripts\buildsystems\vcpkg.cmake (Windows)
7787
```
7888

7989
## List the libraries already installed
@@ -110,7 +120,7 @@ If you need to use a specific version of a library that is different from the ve
110120
1. Run **vcpkg install \<library>**.
111121
1. Use **vcpkg integrate project** to create a NuGet package that references that library on a per-project basis.
112122

113-
## Export compiled binaries and headers
123+
## <a name="export_binaries_per_project"></a> Export compiled binaries and headers
114124

115125
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.
116126

0 commit comments

Comments
 (0)