{"id":24855,"date":"2019-08-15T17:14:44","date_gmt":"2019-08-15T17:14:44","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=24855"},"modified":"2019-08-15T17:14:44","modified_gmt":"2019-08-15T17:14:44","slug":"vcpkg-2019-07-update","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/vcpkg-2019-07-update\/","title":{"rendered":"Vcpkg: 2019.07 Update"},"content":{"rendered":"<p>The 2019.07 update of vcpkg, a tool that helps you manage C and C++ libraries on Windows, Linux, and macOS, is now available. This update is a summary of the new functionality and improvements made to vcpkg over the past month. Last month was the first time we created a vcpkg release (<a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/vcpkg-2019-06-update\/\">Vcpkg: 2019.06 Update<\/a>).<\/p>\n<p>In this post, we will cover caching in Azure Pipelines with vcpkg in addition to many new port and triplet updates, improvements for port contributors, and new documentation. For a full list of this release\u2019s improvements, check out our <a href=\"https:\/\/github.com\/microsoft\/vcpkg\/releases\/tag\/2019.07\">changelog on GitHub<\/a>.<\/p>\n<h2>Caching in Azure Pipelines with vcpkg<\/h2>\n<p>The <a href=\"https:\/\/devblogs.microsoft.com\/devops\/caching-and-faster-artifacts-in-azure-pipelines\/\">public preview of caching in Azure Pipelines<\/a> is now available, and you can use it with vcpkg!<\/p>\n<p>You can use pipeline caching to improve build time by allowing previously built and cached vcpkg artifacts (including libraries) to be reused in subsequent runs. This allows you to reduce and avoid the cost to rebuild the same libraries for each build run the same libraries. Caching may be especially useful with vcpkg when you are installing and building the same dependencies (libraries) over and over during your build. That process can often be time-consuming if it involves building large libraries.<\/p>\n<p>For example, if you have a C++ application that uses SQLite databases, you\u2019ll likely want to use SQLite3 among other libraries. Each time you run a build on your server, you install vcpkg and the sqlite3 library. Without using pipeline caching, this may take some time:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-24878\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-before-300x111.png\" alt=\"\" width=\"695\" height=\"257\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-before-300x111.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-before-768x285.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-before-1024x380.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-before.png 1443w\" sizes=\"(max-width: 695px) 100vw, 695px\" \/><\/p>\n<p>Now, with Azure Pipelines Caching, we can have a much faster and better experience. One of our community contributors and Microsoft employee, <a href=\"https:\/\/github.com\/lukka\">Luca Cappa<\/a>, created a pipeline task to help you use the <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/devops\/pipelines\/caching\/index?view=azure-devops#get-started\">CacheBeta pipeline task<\/a>. We\u2019ll show you how leveraging his scripts reduced the \u2018run vcpkg\u2019 build step from 2m 26s to just 14s!<\/p>\n<h3>CppBuildTasks Azure DevOps Extension with vcpkg<\/h3>\n<p>The <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=lucappa.cmake-ninja-vcpkg-tasks\">CppBuildTasks project<\/a> pipeline task does the following:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-24879\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-flowchart-197x300.png\" alt=\"\" width=\"371\" height=\"565\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-flowchart-197x300.png 197w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-flowchart.png 321w\" sizes=\"(max-width: 371px) 100vw, 371px\" \/><\/p>\n<p>So, in the case of SQLite3, vcpkg will be updated and the sqlite3 library will be installed. It is cached in the pipeline such that in subsequent runs you do not need to install and build the sqlite3 library again.<\/p>\n<p>To get started with CppBuildTasks with Azure Pipelines in your project you can follow the simple <a href=\"https:\/\/github.com\/lukka\/CppBuildTasks#developers-information\">CppBuildTasks developer documentation<\/a>.<\/p>\n<p>Looking at the example, there are a few things to note:<\/p>\n<pre class=\"lang:yaml decode:true\">variables:\r\n    # Exact vcpkg's version to fetch.\u00a0\u00a0 \u00a0\r\n    vcpkgGitRef: 5a3b46e9e2d1aa753917246c2801e50aaabbbccc\r\n\r\n    # Cache the vcpkg's build artifacts.\u00a0 \r\n  - task: CacheBeta@0\u00a0\u00a0 \u00a0\r\n    displayName: Cache vcpkg\u00a0\u00a0 \u00a0\r\n    inputs:\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n      # As 'key' use the content of the response file, vcpkg's commit id and build agent name.\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n      # The key must be one liner, each segment separated by pipe, non-path segments enclosed by\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n      # double quotes.\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n      key: $(Build.SourcesDirectory)\/vcpkg_x64-linux.txt | \"$(vcpkgGitRef)\" | \"$(Agent.Name)\"\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n      path: '$(Build.BinariesDirectory)\/vcpkg'<\/pre>\n<ul>\n<li><code>vcpkgGitRef<\/code> is a specific commit ID for the version of vcpkg you would like to install.<\/li>\n<li><code>task: CacheBeta@0<\/code> enables pipeline caching in Azure Pipelines.<\/li>\n<li><code>key: $(Build.SourcesDirectory)\/vcpkg_x64-linux.txt | \"$(vcpkgGitRef)\" | \"$(Agent.Name)\"<\/code> uses the source directory for the libraries and response file (which contains a list of packages), the commit ID, and the build agent name to generate a hash to use in the build pipeline.<\/li>\n<\/ul>\n<h3>Pipeline Caching with CppBuildTasks Results<\/h3>\n<p>Now, taking a look at installing vcpkg and sqlite3 using the CppBuildTasks script, we can see a remarkable difference in the build time on our Ubuntu server:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-24880\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-after-300x201.png\" alt=\"\" width=\"643\" height=\"431\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-after-300x201.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-after-768x515.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-after-1024x687.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/08\/pipeline-after.png 1268w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/p>\n<h4>Enabling caching reduced the \u201cRun vcpkg\u201d build step from 2m 26s to just 14s (Caching + Run vcpkg).<\/h4>\n<p>You can view more examples in the <a href=\"https:\/\/github.com\/lukka\/CppBuildTasks#samples\">Samples section of the CppBuildTasks GitHub repo<\/a>.<\/p>\n<h2>Ports<\/h2>\n<p>We added 37 new ports in the month of July. Some notable additions include: <a href=\"https:\/\/www.7-zip.org\/\">7zip<\/a>, <a href=\"https:\/\/github.com\/BinomialLLC\/basis_universal\">basisu<\/a>, <a href=\"https:\/\/github.com\/edenhill\/librdkafka\">librdkafka<\/a>, <a href=\"https:\/\/github.com\/microsoft\/mimalloc\">mimalloc<\/a>, <a href=\"https:\/\/github.com\/cesanta\/mongoose\">mongoose<\/a>, and <a href=\"https:\/\/github.com\/apache\/zookeeper\">zookeeper<\/a>. You can view a full list of new ports in our <a href=\"https:\/\/github.com\/microsoft\/vcpkg\/releases\/tag\/2019.07\">2019.07 changelog<\/a>. For a full list of libraries, search for a library name in the <a href=\"https:\/\/github.com\/microsoft\/vcpkg\/tree\/master\/ports\">GitHub repo ports folder<\/a> or use the <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/vcpkg?view=vs-2019#search-the-list-of-available-libraries\">vcpkg search command<\/a>.<\/p>\n<p>In addition to new ports, we updated 160 existing ports.<\/p>\n<h2>Triplets<\/h2>\n<p>Vcpkg provides many triplets (target environments) by default. This past month, we continued increasing the number of ports available on Linux \u2013 from 823 to 866.<\/p>\n<p>Here is a current list of ports per triplet:<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"312\">Triplet<\/td>\n<td width=\"312\">Ports Available<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">x64-osx<\/td>\n<td width=\"312\">788<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">x64-linux<\/td>\n<td width=\"312\">866<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">x64-windows<\/td>\n<td width=\"312\">1039<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">x86-windows<\/td>\n<td width=\"312\">1009<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">x64-windows-static<\/td>\n<td width=\"312\">928<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">arm64-windows<\/td>\n<td width=\"312\">678<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">x64-uwp<\/td>\n<td width=\"312\">546<\/td>\n<\/tr>\n<tr>\n<td width=\"312\">arm-uwp<\/td>\n<td width=\"312\">522<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Don\u2019t see a triplet you\u2019d like? You can easily add your own triplets. Details on adding triplets can be found in our <a href=\"https:\/\/github.com\/microsoft\/vcpkg\/blob\/master\/docs\/users\/triplets.md\">documentation<\/a>.<\/p>\n<h2>Improvements for Port Contributors<\/h2>\n<p>We also made improvements to the vcpkg infrastructure including a new vcpkg variable and a mechanism to modify and set vcpkg triplet variables on a per port basis. These features are the first steps towards enabling better tool dependencies in vcpkg. Stay tuned!<\/p>\n<h3>Passthrough Triplet Variable<\/h3>\n<p>Before we added the VCPKG_ENV_PASSTHROUGH triplet variable, the only environment variables on Windows available to the portfile were those found on an allow list hard-coded into vcpkg. This new triplet variable allows us to augment that list with variables defined in the triplet or the environment overrides file.<\/p>\n<h3>Environment Overrides<\/h3>\n<p>Port authors can add an environment-overrides.cmake file to a port, override, or set, vcpkg triplet variables on a per port basis. For example, this allows ports to specify environment variables that are not allow listed in the vcpkg source to be available to the portfile.<\/p>\n<h2>Documentation<\/h2>\n<p>We also updated our documentation to reflect these new changes. Check out the following docs for more information on some of the updates outlined in this post in addition to a couple other areas:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/microsoft\/vcpkg\/blob\/2019.07\/docs\/maintainers\/maintainer-guide.md\">Maintainer Guidelines and Policies<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/vcpkg\/blob\/2019.07\/docs\/examples\/overlay-triplets-linux-dynamic.md\">Overlay triplets example: build dynamic libraries on Linux<\/a> \u2013 More details on overlay triplets in our <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/vcpkg-2019-06-update\/\">06 Update blog post<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/vcpkg\/blob\/2019.07\/docs\/maintainers\/vcpkg_from_git.md\">vcpkg_from_git<\/a><\/li>\n<\/ul>\n<h2>Thank you<\/h2>\n<p>Thank you to everyone who contributed to vcpkg! We now have 659 total contributors. This release, we\u2019d like to thank the following 11 contributors who made code changes in June:<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/BillyONeal\">BillyONeal<\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/myd7349\">myd7349<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/cenit\">cenit<\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/Neumann-A\">Neumann-A<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/coryan\">coryan<\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/SuperWig\">SuperWig<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/eao197\">eao197<\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/tarcila\">tarcila<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/JackBoosY\">JackBoosY<\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/TartanLlama\">TartanLlama<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\"><a href=\"https:\/\/github.com\/jwillemsen\">jwillemsen<\/a><\/td>\n<td style=\"width: 50%;\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2>Tell Us What You Think<\/h2>\n<p><a href=\"https:\/\/github.com\/microsoft\/vcpkg#quick-start\">Install vcpkg<\/a>, give it a try, and let us know what you think. If you run into any issues, or have any suggestions, please report them on the\u00a0<a href=\"https:\/\/github.com\/microsoft\/vcpkg\/issues\">Issues section of our GitHub repository<\/a>.<\/p>\n<p>We can be reached via the comments below or via email (vcpkg@microsoft.com). You can also find our team \u2013 and me \u2013 on Twitter <a href=\"https:\/\/twitter.com\/visualc\">@VisualC <\/a>and <a href=\"https:\/\/twitter.com\/tara_msft\">@tara_msft<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The 2019.07 update of vcpkg, a tool that helps you manage C and C++ libraries on Windows, Linux, and macOS, is now available. This update is a summary of the new functionality and improvements made to vcpkg over the past month. Last month was the first time we created a vcpkg release (Vcpkg: 2019.06 Update). [&hellip;]<\/p>\n","protected":false},"author":1305,"featured_media":24882,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[8,140,273],"class_list":["post-24855","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-announcement","tag-c","tag-vcpkg"],"acf":[],"blog_post_summary":"<p>The 2019.07 update of vcpkg, a tool that helps you manage C and C++ libraries on Windows, Linux, and macOS, is now available. This update is a summary of the new functionality and improvements made to vcpkg over the past month. Last month was the first time we created a vcpkg release (Vcpkg: 2019.06 Update). [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/24855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/1305"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=24855"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/24855\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/24882"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=24855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=24855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=24855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}