Skip to content

Commit c89d532

Browse files
author
mikeblome
committed
updates for Linux/MacOS
1 parent b6982be commit c89d532

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

docs/vcpkg.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ ms.workload: ["cplusplus"]
1414
---
1515
# 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, 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.
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.
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](#export_binaries_per_project) 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.
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

@@ -66,7 +66,11 @@ taglib 1.11.1-2 TagLib Audio Meta-Data Library
6666

6767
### Install a library on your local machine
6868

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.
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.
7074

7175
```cmd
7276
> vcpkg install boost:x86-windows
@@ -79,7 +83,7 @@ Additional packages (*) will be installed to complete this operation.
7983
8084
```
8185

82-
For CMAKE projects, use use CMAKE_TOOLCHAIN_FILE to make libraries available with `find_package()`. For example,
86+
For CMAKE projects, use use CMAKE_TOOLCHAIN_FILE to make libraries available with `find_package()`. For example:
8387

8488
```cmd
8589
cmake .. -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake (Linux/MacOS)
@@ -101,7 +105,7 @@ websocketpp:x86-windows 0.7.0 Library that implements RFC6455 The WebSocket P
101105
zlib:x86-windows 1.2.11 A compression library
102106
```
103107

104-
## Integrate with Visual Studio
108+
## Integrate with Visual Studio (Windows)
105109

106110
### Per-user
107111

@@ -120,6 +124,11 @@ If you need to use a specific version of a library that is different from the ve
120124
1. Run **vcpkg install \<library>**.
121125
1. Use **vcpkg integrate project** to create a NuGet package that references that library on a per-project basis.
122126

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+
123132
## <a name="export_binaries_per_project"></a> Export compiled binaries and headers
124133

125134
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.

0 commit comments

Comments
 (0)