{"id":18316,"date":"2018-02-06T10:53:35","date_gmt":"2018-02-06T18:53:35","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=18316"},"modified":"2019-02-18T17:48:03","modified_gmt":"2019-02-18T17:48:03","slug":"vcpkg-introducing-installation-options-with-feature-packages","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/vcpkg-introducing-installation-options-with-feature-packages\/","title":{"rendered":"Vcpkg: introducing installation options with Feature Packages"},"content":{"rendered":"<p>We are happy to announce a new feature for vcpkg in version 0.0.103: Feature Packages.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/vcpkg-a-tool-to-acquire-and-build-c-open-source-libraries-on-windows\/\">Vcpkg is a package manager<\/a> to help acquiring and building open source libraries on Windows; vcpkg currently offers over 600 C++ libraries available for VS2017 and VS2015.<\/p>\n<p>With Feature Packages you have more control over how you build a library as you can specify different options (features). Lots of open source libraries offer different options and features to select at build time. For example, you may want to build OpenCV with CUDA to utilize the GPU or build HDF5 with MSMPI to enable parallel execution. Previously you needed to edit the port file to build with a given set of options. With features packages, these options can be easily specified at installation time.<\/p>\n<h4>How to use feature packages <b><\/b><\/h4>\n<p>We support optional packages via this syntax: <strong>vcpkg install library[feature]<\/strong><\/p>\n<p><code>vcpkg install hdf5 \/\/ install without parallel support\n&gt;vcpkg install hdf5[parallel] \/\/ install with parallel support\n<\/code><\/p>\n<p>hdf5 now exposes options, so the search command will display more information:<\/p>\n<p><code>\n&gt; vcpkg search hdf5\nhdf5 1.10.1-1 HDF5 is a data model, library, \u2026\nhdf5[parallel] parallel support for HDF5\n<\/code><\/p>\n<p>Now hdf5 has been installed with the parallel option activated, so the list command will display more information as well:\n<code>\n&gt;vcpkg list hdf5\nhdf5:x86-windows 1.10.1-1 HDF5 is a data model, \u2026\nhdf5[parallel]:x86-windows with parallel support for HDF5\n<\/code><\/p>\n<p>Note that each feature package will be listed on a separate line.<\/p>\n<h4>Behind the scene<\/h4>\n<p>All the features packages for a given library are listed in the CONTROL file.<\/p>\n<p>This file also lists the dependencies for each feature package.<\/p>\n<p>For example:\n<code>\nSource: hdf5\nVersion: 1.10.1-1\nDescription: HDF5 is a data model, library, and file format for \u2026\nBuild-Depends: zlib, szip<\/code>\n<code>\nFeature: parallel\nDescription: parallel support for HDF5\nBuild-Depends: msmpi\n<\/code>\nA library can support any number of features.<\/p>\n<p>Having feature packages enabled means more subtleties when you remove or update a package. We worked hard to find the right algorithm to addresses collection of edge cases. For example, installing a feature may imply installing dependencies or rebuild in a certain way these dependencies.\n<code>\n&gt; vcpkg install hdf5[parallel]\nThe following packages will be built and installed:\nhdf5[core,parallel]:x86-windows\n* msmpi[core]:x86-windows\n* szip[core]:x86-windows\nAdditional packages (*) will be modified to complete this operation.\n<\/code><\/p>\n<h4>Vcpkg maintainers, you can now add options to your port file<b><\/b><\/h4>\n<p>With feature packages, you have now the ability to define different options when creating a port file. It is now the right time to update your port file and enable options for your libraries.<\/p>\n<p>In order to update your port file, you can react to a feature using the CMake directive\n<code>\n\"if(featurename IN_LIST FEATURES)\"\n<\/code>\nHere are some resources:<\/p>\n<p><a href=\"https:\/\/github.com\/Microsoft\/vcpkg\/blob\/92f9f63df688cd238bccfc8404d242aadd00c1d7\/ports\/hdf5\/portfile.cmake#L24-L28\">Activate parallel in HDF5<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/Microsoft\/vcpkg\/blob\/92f9f63df688cd238bccfc8404d242aadd00c1d7\/ports\/opencv\/portfile.cmake#L36-L64\">Cuda and options for OpenCV<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/Microsoft\/vcpkg\/blob\/92f9f63df688cd238bccfc8404d242aadd00c1d7\/ports\/vtk\/portfile.cmake#L17-L45\">VTK with Python<\/a><\/p>\n<h5>Documentation<\/h5>\n<p>We have updated our <a href=\"https:\/\/github.com\/Microsoft\/vcpkg\/blob\/92f9f63df688cd238bccfc8404d242aadd00c1d7\/docs\/maintainers\/control-files.md#feature-paragraphs\">documentation about feature package<\/a><\/p>\n<p>Thanks to Daniel Shaw for his effort and dedication to implement this feature with us.<\/p>\n<p>As always, your feedback and comments really matter to us, open an issue on <a href=\"https:\/\/github.com\/Microsoft\/vcpkg\/\">GitHub<\/a> or reach out to us at <a>vcpkg@microsoft.com<\/a> for any comments and suggestions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are happy to announce a new feature for vcpkg in version 0.0.103: Feature Packages. Vcpkg is a package manager to help acquiring and building open source libraries on Windows; vcpkg currently offers over 600 C++ libraries available for VS2017 and VS2015. With Feature Packages you have more control over how you build a library [&hellip;]<\/p>\n","protected":false},"author":316,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,230,272],"tags":[271,190,278,273],"class_list":["post-18316","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-new-feature","category-vcpkg","tag-cpp","tag-libraries","tag-options","tag-vcpkg"],"acf":[],"blog_post_summary":"<p>We are happy to announce a new feature for vcpkg in version 0.0.103: Feature Packages. Vcpkg is a package manager to help acquiring and building open source libraries on Windows; vcpkg currently offers over 600 C++ libraries available for VS2017 and VS2015. With Feature Packages you have more control over how you build a library [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/18316","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\/316"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=18316"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/18316\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=18316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=18316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=18316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}