2016-09-19



alvinashcraft
shared this story
from Developer Tools Blogs.

We are delighted to announce the availability of VCPkg on GitHub https://github.com/Microsoft/vcpkg . Vcpkg and its associated open sourced port tree simplify acquiring and rebuilding open source libraries on Windows. s

Acquiring Native Libraries on Windows is a critical part of the application development process; our surveys results show that 80% of C++ projects depend on 2 or more 3rd party libraries. Despite this the current process for acquiring Native Libraries falls far below C++ developers’ expectations when compared to other platforms such as Homebrew on Mac and apt-get on many Linux distributions.

At the beginning of this project we spend lot of time analyzing the different solutions available today on different platforms, what are the success factor and failures. We saw that C++ developers have more variables than “managed” developers (.NET but also Java, JavaScript, node…) like compiler flavors and options. We saw that the successful approaches always give the ability to have access to the source code and to rebuild from it. We created a document (FAQ) explaining some of our choices.

The core of our approach is to provide a public GitHub repo which contains a collection of build script and patches (not the source itself, but just a port tree as defined in https://en.wikipedia.org/wiki/Ports_collection) to allow developers building the libraries on Windows.

Get it Started

To acquire the tool, 2 solutions:

Rebuild the tool from github: git clone https://github.com/Microsoft/vcpkg

Once cloned, run this command:

C:\src\vcpkg> powershell -exec bypass scripts\bootstrap.ps

That will generate the “lib folder” hierarchy and build the tool itself (vcpkg.exe)

Download the binary distribution, containing the exe here and unzip it in the folder of your choice.

Pre requisite:

Visual Studio 2015 installed

Windows 7 (min)

You are all set (no gac, no registry… the tool and the associated “lib folder” are xcopyable)

search, install, list, integrate will be the main options you’ll use with the tool, to search a library in the catalog, install a given library, list the already installed ones and integrate the “lib folder” to Visual Studio to simplify the usage of the libs (no need to manually add headers and lib on the VC directories)

See a short demo video here

You will find few documents in the Repo:

· Readme.md explains how to build the tool and setup it on your machine

· Examples.md describes how to start with the tool

· FAQ: contains useful information about the tool and its design.

· Privacy document: contains all the privacy information like the data collected.

Available libraries and contributing to adding more

To see the list of available libraries, use vcpkg search

The current list (9/2016) is



This is just the beginning, and we’ll accept contributions and pull request to add lib port files in the catalog. See the example 2 in examples.md to create a new port file in the catalog.

The Visual studio and CMake integration

The Visual studio (VC2015) integration can be done in different ways: (See details of all this options in the examples.md on the GitHub repo).

Option A: VS Project (User-wide integration)

The recommended and most productive way to use Vcpkg is via user-wide integration, making the system available for all projects you build. The user-wide integration will require administrator access the first time it is used on a given machine. After the first use, administrator access is no longer required and the integration is on a per-user basis.

vcpkg integrate install

Option B: CMake (Toolchain File)

The best way to use installed libraries with CMake is via the toolchain file integration\sysroot.cmake. To use this file, you simply need to add it onto your CMake command line as -DCMAKE_TOOLCHAIN_FILE=D:\src\cpp-packages\integration\sysroot.cmake.

Option C: Other buildsystems

Libraries are installed into the installed subfolder, partitioned by architecture (e.g. x86-windows):

The header files are installed to vcpkg\installed\x86-windows\include

Release .lib files are installed to vcpkg\installed\x86-windows\lib

Release .dll files are installed to vcpkg\installed\x86-windows\bin

Debug .lib files are installed to vcpkg\installed\x86-windows\debug\lib

Debug .dll files are installed to vcpkg\installed\x86-windows\debug\bin

See your build system specific documentation for how to use prebuilt binaries.

Option D: VS Project (NuGet package)

We also provide VS project integration through a NuGet package. This will modify the project file, so we do not recommend this approach for open source projects. When you modify the project file this way, the paths are hard coded and specific to your environment, sharing this have no sense in an distributed environment.

vcpkg integrate project

Note: The generated NuGet package does not contain the actual libraries. It instead acts like a shortcut (or symlink) to the Vcpkg install and will “automatically” update with any changes (install/remove) to the libraries. You do not need to regenerate or update the NuGet package.

This tool is for you, and we need your feedback suggestion. Create an Issue or a Pull Request on the GitHub repo to let us know what’s cool, what wrong and what we could add to this tool to better fit to your needs. Let us know which libraries you would love to have in the list…

You can also contact us at vcpkg@microsoft.com

The Vcpkg Team

Show more