[vcpkg.targets] Add an additional options parameter for MSBuild integration (#16155)

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
ras0219 2021-02-09 15:35:06 -08:00 committed by GitHub
parent 6195f2ae7e
commit 4502f8ed68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 2 deletions

View file

@ -319,4 +319,35 @@ To use manifests with MSBuild, first you need to use an [existing integration me
As part of your project's build, vcpkg automatically be run and install any listed dependencies to `vcpkg_installed/` adjacent to the `vcpkg.json` file; these files will then automatically be included in and linked to your MSBuild projects.
It's critical that all project files consuming the same `vcpkg.json` use the same triplet in a single build; if you need to use different triplets for different projects in your solution, they must consume from different `vcpkg.json` files.
Note: It is critical that all project files in a single build consuming the same `vcpkg.json` use the same triplet; if you need to use different triplets for different projects in your solution, they must consume from different `vcpkg.json` files.
### MSBuild Properties
These properties can be defined via the VS GUI under `Project Properties -> Vcpkg` or via a common `.props` file.
#### `VcpkgEnabled` (Use Vcpkg)
This can be set to "false" to explicitly disable vcpkg integration for the project
#### `VcpkgTriplet` (Triplet)
This can be set to a custom triplet to use for integration (such as x64-windows-static)
#### `VcpkgAdditionalInstallOptions` (Additional Options)
When using a manifest, this option specifies additional command line flags to pass to the underlying vcpkg tool invocation. This can be used to access features that have not yet been exposed through another option.
#### `VcpkgConfiguration` (Vcpkg Configuration)
If your configuration names are too complex for vcpkg to guess correctly, you can assign this property to `Release` or `Debug` to explicitly tell vcpkg what variant of libraries you want to consume.
#### `VcpkgEnableManifest` (Use Vcpkg Manifest)
This property must be set to true in order to consume from a local vcpkg.json file. If set to false, any local vcpkg.json files will be ignored. This will default to true in the future.
#### `VcpkgManifestInstall` (Install Vcpkg Dependencies)
*(Requires `Use Vcpkg Manifest` set to `true`)*
This property can be set to "false" to disable automatic dependency restoration on project build. Dependencies can be manually restored via the vcpkg command line.

View file

@ -68,6 +68,9 @@
<StringProperty Name="VcpkgTriplet" DisplayName="Triplet" Category="Conditional" Subtype="Text"
Description="Specifies the triplet used by Vcpkg. Does not include the '-static' suffix that may be added by the 'Use static libraries' flag." />
<StringProperty Name="VcpkgAdditionalInstallOptions" DisplayName="Additional Options" Category="General" Subtype="Text"
Description="Additional command line options to be passed to the underlying vcpkg tool when installing in manifest mode." />
<EnumProperty Name="VcpkgConfiguration" DisplayName="Vcpkg Configuration" Category="Conditional"
Description="Specifies if release or debug libraries build with vcpkg should be used.">
<EnumValue Name="Release" Description="Uses release libraries" />

View file

@ -84,7 +84,7 @@
<_VcpkgItemToDelete Include="$(TLogLocation)VcpkgInstallManifest*.read.1u.tlog" />
</ItemGroup>
<Delete Files="@(_VcpkgItemToDelete)" />
<Exec Command="%22$([System.IO.Path]::Combine($(VcpkgRoot), 'vcpkg.exe'))%22 install --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(VcpkgRoot)\%22 %22--x-manifest-root=$(VcpkgManifestRoot)\%22 %22--x-install-root=$(VcpkgInstalledDir)\%22"
<Exec Command="%22$([System.IO.Path]::Combine($(VcpkgRoot), 'vcpkg.exe'))%22 install --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(VcpkgRoot)\%22 %22--x-manifest-root=$(VcpkgManifestRoot)\%22 %22--x-install-root=$(VcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
StandardOutputImportance="High" />
<WriteLinesToFile File="$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).read.1u.tlog"
Lines="@(_VcpkgInstallManifestDependenciesInputs -> '^%(Identity)')"