Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg] Two bug fixes and some improvements in buildsystems/msbuild #13755

Merged
merged 15 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
154 changes: 77 additions & 77 deletions scripts/buildsystems/msbuild/vcpkg-general.xml
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Rule
Name="VcpkgOptions"
DisplayName="Vcpkg"
PageTemplate="generic"
Description="Vcpkg"
xmlns="http://schemas.microsoft.com/build/2009/properties">
<Rule.Categories>
<Category Name="General" DisplayName="General" Description="General" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="true" />
</Rule.DataSource>
<BoolProperty Name="VcpkgEnabled"
DisplayName="Use Vcpkg"
Description="Use Vcpkg for includes and libraries."
Category="General"
Default="true">
</BoolProperty>
<BoolProperty Name="VcpkgEnableManifest"
DisplayName="Use Vcpkg Manifest"
Description="Use the vcpkg manifest file to define your dependencies."
Category="General"
Default="false">
</BoolProperty>
<BoolProperty Name="VcpkgManifestInstall"
DisplayName="Install vcpkg dependencies"
Description="Install dependencies from the vcpkg manifest."
Category="General"
Default="true">
</BoolProperty>
<BoolProperty Name="VcpkgUseStatic"
DisplayName="Use static libraries"
Description="Vcpkg can build static libraries (e.g. x64-windows-static). This options changes the default triplet to use these static libraries by appending -static to $(VcpkgTriplet). This will not be shown in the evaluation of the Triplet within the UI."
Category="General"
Default="false">
</BoolProperty>
<BoolProperty Name="VcpkgAutoLink"
DisplayName="Use AutoLink"
Description="Enables automatic linking with libraries build using Vcpkg. Does not work with lld-link.exe."
Category="General"
Default="true">
</BoolProperty>
<StringProperty Name="VcpkgTriplet"
DisplayName="Triplet"
Description="Specifies the triplet used by Vcpkg"
Category="General"
Subtype="Text">
</StringProperty>
<StringProperty Name="VcpkgRoot"
DisplayName="Vcpkg Root"
Description="Root path where Vcpkg is located. Be careful with changing this one. It is, for example, unable to update this property page from the new location without restarting visual studio."
Category="General"
Subtype="folder"
Visible="false">
</StringProperty>
<StringProperty Name="VcpkgManifestRoot"
DisplayName="Vcpkg Manifest Root"
Description="The path to the directory which contains the manifest file, and the vcpkg_installed directory."
Category="General"
Subtype="folder"
Visible="false">
</StringProperty>
<StringProperty Name="VcpkgCurrentInstalledDir"
DisplayName="Package install directory"
Description="Defines the direct path to the installed Vcpkg packages. Only change this if you know what you are doing!"
Category="General"
Subtype="folder"
Visible="false">
</StringProperty>
<EnumProperty Name="VcpkgConfiguration" DisplayName="Vcpkg Configuration" Description="Specifies if release or debug libraries build with vcpkg should be used." Category="General">
<EnumValue Name="Release" Switch="Release" DisplayName="Release" Description="Uses release libraries">
</EnumValue>
<EnumValue Name="Debug" Switch="Debug" DisplayName="Debug" Description="Uses debug libraries">
</EnumValue>
</EnumProperty>
</Rule>
<?xml version="1.0" encoding="utf-8"?>
<Rule Name="VcpkgOptions" DisplayName="Vcpkg" PageTemplate="generic" Description="Vcpkg"
xmlns="http://schemas.microsoft.com/build/2009/properties">

<Rule.Categories>
<Category Name="General" DisplayName="General" Description="General Vcpkg Configuration" />
<Category Name="Conditional" DisplayName="Target and Configuration Specific" Description="Conditional Vcpkg Configuration" />
</Rule.Categories>

<Rule.DataSource>
<!-- Note: HasConfigurationCondition must be either "true" or ommitted. Otherwise, the vcpkg property sheet will not be displayed. -->
<!-- Note: Remove all instances of 'Label="Vcpkg"' from this file if the vcpkg property sheet does not display any values. -->
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="true" />
</Rule.DataSource>

<BoolProperty Name="VcpkgEnabled" DisplayName="Use Vcpkg" Category="General" Default="true"
Description="Use Vcpkg for includes and libraries.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>

<BoolProperty Name="VcpkgEnableManifest" DisplayName="Use Vcpkg Manifest" Category="General" Default="false"
Description="Use the vcpkg manifest file to define your dependencies.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>

<BoolProperty Name="VcpkgManifestInstall" DisplayName="Install Vcpkg Dependencies" Category="General" Default="true"
Description="Install dependencies from the vcpkg manifest.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>

<BoolProperty Name="VcpkgAutoLink" DisplayName="Use AutoLink" Category="General" Default="true"
Description="Enables automatic linking with libraries build using Vcpkg. Does not work with lld-link.exe.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>

<StringProperty Name="VcpkgRoot" DisplayName="Vcpkg Root" Category="General" Subtype="folder" Visible="false"
Description="Root path where Vcpkg is located. Be careful with changing this one. It is, for example, unable to update this property page from the new location without restarting visual studio.">
<StringProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</StringProperty.DataSource>
</StringProperty>

<StringProperty Name="VcpkgManifestRoot" DisplayName="Vcpkg Manifest Root" Category="General" Subtype="folder" Visible="false"
Description="The path to the directory which contains the manifest file, and the vcpkg_installed directory.">
<StringProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</StringProperty.DataSource>
</StringProperty>

<StringProperty Name="VcpkgCurrentInstalledDir" DisplayName="Package install directory" Category="General" Subtype="folder" Visible="false"
Description="Defines the direct path to the installed Vcpkg packages.">
<StringProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</StringProperty.DataSource>
</StringProperty>

<BoolProperty Name="VcpkgUseStatic" DisplayName="Use Static Libraries" Category="Conditional" Default="false"
Description="Vcpkg can build static libraries (e.g. x64-windows-static). This options changes the default triplet to use these static libraries by appending -static to $(VcpkgTriplet). This will not be shown in the evaluation of the Triplet within the UI." />

<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." />

<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" />
<EnumValue Name="Debug" Description="Uses debug libraries" />
</EnumProperty>

</Rule>
47 changes: 20 additions & 27 deletions scripts/buildsystems/msbuild/vcpkg.props
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VcpkgHasProps>true</VcpkgHasProps>
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgAutoLink Condition="'$(VcpkgAutoLink)' == ''">true</VcpkgAutoLink>
<VcpkgUseStatic Condition="'$(VcpkgUseStatic)' == ''">false</VcpkgUseStatic>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .vcpkg-root))</VcpkgRoot>
<VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
<VcpkgPageSchema Condition="'$(VcpkgPageSchema)' == ''">$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg-general.xml</VcpkgPageSchema>
</PropertyGroup>
<!-- Do not define derived properties here. This file may be imported once and some of the properties below may be overridden afterwards -->

<!-- Set default OS Target-->
<PropertyGroup Condition="'$(ApplicationType)|$(ApplicationTypeRevision)' == 'Windows Store|10.0'">
<VcpkgOSTarget Condition="'$(VcpkgOSTarget)' == ''">uwp</VcpkgOSTarget>
</PropertyGroup>
<PropertyGroup>
<VcpkgOSTarget Condition="'$(VcpkgOSTarget)' == ''">windows</VcpkgOSTarget>
<PropertyGroup Condition="'$(VcpkgOSTarget)' == ''">
<VcpkgOSTarget>windows</VcpkgOSTarget>
<VcpkgOSTarget Condition="'$(ApplicationType)|$(ApplicationTypeRevision)' == 'Windows Store|10.0'">uwp</VcpkgOSTarget>
</PropertyGroup>

<!-- Set default Platform Target. $(PlatformTarget) is not available at the top of the .vcxproj file. -->
<PropertyGroup Condition="'$(Platform)' == 'Win32'">
<VcpkgPlatformTarget Condition="'$(VcpkgPlatformTarget)' == ''">x86</VcpkgPlatformTarget>
</PropertyGroup>
<PropertyGroup>
<VcpkgPlatformTarget Condition="'$(VcpkgPlatformTarget)' == ''">$(Platform)</VcpkgPlatformTarget>
<PropertyGroup Condition="'$(VcpkgPlatformTarget)' == ''">
<VcpkgPlatformTarget>$(Platform)</VcpkgPlatformTarget>
<VcpkgPlatformTarget Condition="'$(Platform)' == 'Win32'">x86</VcpkgPlatformTarget>
</PropertyGroup>

<!-- Manifest files -->
<PropertyGroup>
<VcpkgPropsImported>true</VcpkgPropsImported>
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
<VcpkgUseStatic Condition="'$(VcpkgUseStatic)' == ''">false</VcpkgUseStatic>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), '..\..\..'))</VcpkgRoot>

<VcpkgAutoLink Condition="'$(VcpkgAutoLink)' == ''">true</VcpkgAutoLink>
<!-- Deactivate Autolinking if lld is used as a linker. (Until a better way to solve the problem is found!).
Tried to add /lib as a parameter to the linker call but was unable to find a way to pass it as the first parameter. -->
<VcpkgAutoLink Condition="'$(UseLldLink)' == 'true'">false</VcpkgAutoLink>

<!-- Manifest files -->
<VcpkgEnableManifest Condition="'$(VcpkgEnableManifest)' == ''">false</VcpkgEnableManifest>
<VcpkgManifestInstall Condition="'$(VcpkgManifestInstall)' == ''">true</VcpkgManifestInstall>
<VcpkgManifestRoot>$([MSbuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), vcpkg.json))</VcpkgManifestRoot>
<VcpkgManifestRoot Condition="'$(VcpkgManifestRoot)' != ''">$([MSbuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), vcpkg.json))"</VcpkgManifestRoot>
FrankHeimes marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<!-- Set other defaults-->
<PropertyGroup>
<VcpkgUserTriplet Condition="'$(VcpkgUserTriplet)' == ''">$(VcpkgPlatformTarget)-$(VcpkgOSTarget)</VcpkgUserTriplet>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">$(VcpkgUserTriplet)</VcpkgTriplet>
<VcpkgPageSchema>$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg-general.xml</VcpkgPageSchema>
</PropertyGroup>
</Project>