|
| 1 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 2 | + |
| 3 | + <!-- Import default properties if not done yet. This does not overwrite any previously defined properties. --> |
| 4 | + <Import Condition="'$(VcpkgPropsImported)' != 'true'" Project="vcpkg.props" /> |
| 5 | + |
| 6 | + <!-- VS2015's version of "vcpkg integrate install" imports both the props and targets together in the "props" area, |
| 7 | + meaning we have no opportunity to respond to user customizations in their project files. It also means that this |
| 8 | + .targets must defend against normal properties being unset. (For example, VcpkgPlatformTarget below.) |
| 9 | +
|
| 10 | + Also, we copy all initial values to internal values to avoid properties being inconsistently evaluated in targets |
| 11 | + and dependent properties. |
| 12 | + --> |
| 13 | + |
| 14 | + <PropertyGroup> |
| 15 | + <_ZVcpkgRoot>$(VcpkgRoot)</_ZVcpkgRoot> |
| 16 | + <_ZVcpkgManifestRoot>$(VcpkgManifestRoot)</_ZVcpkgManifestRoot> |
| 17 | + <_ZVcpkgInstalledDir>$(VcpkgInstalledDir)</_ZVcpkgInstalledDir> |
| 18 | + </PropertyGroup> |
| 19 | + |
| 20 | + <!-- Add trailing slashes to inputs that must have them to conform with msbuild conventions. --> |
| 21 | + <PropertyGroup> |
| 22 | + <_ZVcpkgRoot Condition="!$(_ZVcpkgRoot.EndsWith('\'))">$(_ZVcpkgRoot)\</_ZVcpkgRoot> |
| 23 | + <_ZVcpkgManifestRoot Condition="'$(_ZVcpkgManifestRoot)' != '' and !$(_ZVcpkgManifestRoot.EndsWith('\'))">$(_ZVcpkgManifestRoot)\</_ZVcpkgManifestRoot> |
| 24 | + <_ZVcpkgInstalledDir Condition="'$(_ZVcpkgInstalledDir)' != '' and !$(_ZVcpkgInstalledDir.EndsWith('\'))">$(_ZVcpkgInstalledDir)\</_ZVcpkgInstalledDir> |
| 25 | + </PropertyGroup> |
| 26 | + |
| 27 | + <PropertyGroup> |
| 28 | + <_ZVcpkgClassicOrManifest Condition="'$(VcpkgEnabled)' == 'true' And ('$(VcpkgEnableClassic)' == 'true' Or '$(VcpkgEnableManifest)' == 'true')">true</_ZVcpkgClassicOrManifest> |
| 29 | + <_ZVcpkgClassicOrManifest Condition="'$(_ZVcpkgClassicOrManifest)' == ''">false</_ZVcpkgClassicOrManifest> |
| 30 | + </PropertyGroup> |
| 31 | + |
| 32 | + <!-- Special-case custom MSBuild platforms defined in the Microsoft GDK. See https://aka.ms/gdk and https://aka.ms/gdkx --> |
| 33 | + <PropertyGroup Condition="'$(VcpkgOSTarget)' == '' AND '$(VcpkgPlatformTarget)' == '' AND '$(Platform)'=='Gaming.Desktop.x64'"> |
| 34 | + <VcpkgOSTarget>windows</VcpkgOSTarget> |
| 35 | + <VcpkgPlatformTarget>x64</VcpkgPlatformTarget> |
| 36 | + <VcpkgUseMD>true</VcpkgUseMD> |
| 37 | + </PropertyGroup> |
| 38 | + <PropertyGroup Condition="'$(VcpkgOSTarget)' == '' AND '$(VcpkgPlatformTarget)' == '' AND '$(Platform)'=='Gaming.Xbox.Scarlett.x64'"> |
| 39 | + <VcpkgOSTarget>xbox-scarlett</VcpkgOSTarget> |
| 40 | + <VcpkgPlatformTarget>x64</VcpkgPlatformTarget> |
| 41 | + <VcpkgUseMD>false</VcpkgUseMD> |
| 42 | + </PropertyGroup> |
| 43 | + <PropertyGroup Condition="'$(VcpkgOSTarget)' == '' AND '$(VcpkgPlatformTarget)' == '' AND '$(Platform)'=='Gaming.Xbox.XboxOne.x64'"> |
| 44 | + <VcpkgOSTarget>xbox-xboxone</VcpkgOSTarget> |
| 45 | + <VcpkgPlatformTarget>x64</VcpkgPlatformTarget> |
| 46 | + <VcpkgUseMD>false</VcpkgUseMD> |
| 47 | + </PropertyGroup> |
| 48 | + |
| 49 | + <!-- Determine the triplet to use. Note that $(PlatformTarget) is not available at the top of the .vcxproj file. --> |
| 50 | + <PropertyGroup Condition="'$(VcpkgOSTarget)' == ''"> |
| 51 | + <VcpkgOSTarget>windows</VcpkgOSTarget> |
| 52 | + <VcpkgOSTarget Condition="'$(AppContainerApplication)' == 'true'">uwp</VcpkgOSTarget> |
| 53 | + </PropertyGroup> |
| 54 | + |
| 55 | + <PropertyGroup Condition="'$(VcpkgPlatformTarget)' == ''"> |
| 56 | + <VcpkgPlatformTarget>$(Platform)</VcpkgPlatformTarget> |
| 57 | + <VcpkgPlatformTarget Condition="'$(Platform)' == 'Win32'">x86</VcpkgPlatformTarget> |
| 58 | + </PropertyGroup> |
| 59 | + |
| 60 | + <PropertyGroup> |
| 61 | + <_ZVcpkgLinkage /> |
| 62 | + <_ZVcpkgLinkage Condition="'$(VcpkgUseStatic)' == 'true'">-static</_ZVcpkgLinkage> |
| 63 | + <_ZVcpkgLinkageMD /> |
| 64 | + <_ZVcpkgLinkageMD Condition="'$(VcpkgUseStatic)' == 'true' and '$(VcpkgUseMD)' == 'true'">-md</_ZVcpkgLinkageMD> |
| 65 | + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">$(VcpkgPlatformTarget)-$(VcpkgOSTarget)$(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)</VcpkgTriplet> |
| 66 | + <VcpkgTriplet Condition="!$(VcpkgTriplet.EndsWith($(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)))">$(VcpkgTriplet)$(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)</VcpkgTriplet> |
| 67 | + </PropertyGroup> |
| 68 | + |
| 69 | + <!-- Include the triplet in ProjectStateLine to force VS2017 and later to fully rebuild if the user changes it. --> |
| 70 | + <PropertyGroup> |
| 71 | + <ProjectStateLine>VcpkgTriplet=$(VcpkgTriplet):$(ProjectStateLine)</ProjectStateLine> |
| 72 | + </PropertyGroup> |
| 73 | + |
| 74 | + <!-- Determine the locations trees we want to consume. _ZVcpkgInstalledDir is special in that it doesn't have a default |
| 75 | + value in the .props because we normally derive it, but users may override the value. --> |
| 76 | + <Choose> |
| 77 | + <When Condition="'$(VcpkgEnableManifest)' == 'true'"> |
| 78 | + <PropertyGroup> |
| 79 | + <_ZVcpkgInstalledDir Condition="'$(_ZVcpkgInstalledDir)' == ''">$(_ZVcpkgManifestRoot)vcpkg_installed\$(VcpkgTriplet)\</_ZVcpkgInstalledDir> |
| 80 | + </PropertyGroup> |
| 81 | + </When> |
| 82 | + <Otherwise> |
| 83 | + <PropertyGroup> |
| 84 | + <_ZVcpkgInstalledDir Condition="'$(_ZVcpkgInstalledDir)' == ''">$(_ZVcpkgRoot)installed\</_ZVcpkgInstalledDir> |
| 85 | + </PropertyGroup> |
| 86 | + </Otherwise> |
| 87 | + </Choose> |
| 88 | + |
| 89 | + <PropertyGroup> |
| 90 | + <_ZVcpkgCurrentInstalledDir>$(_ZVcpkgInstalledDir)$(VcpkgTriplet)\</_ZVcpkgCurrentInstalledDir> |
| 91 | + <_ZVcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Debug'))">Debug</_ZVcpkgNormalizedConfiguration> |
| 92 | + <_ZVcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Release')) or '$(VcpkgConfiguration)' == 'RelWithDebInfo' or '$(VcpkgConfiguration)' == 'MinSizeRel'">Release</_ZVcpkgNormalizedConfiguration> |
| 93 | + |
| 94 | + <_ZVcpkgConfigSubdir Condition="'$(_ZVcpkgNormalizedConfiguration)' == 'Debug'">debug\</_ZVcpkgConfigSubdir> |
| 95 | + <_ZVcpkgExecutable>$(_ZVcpkgRoot)vcpkg.exe</_ZVcpkgExecutable> |
| 96 | + <ExternalIncludePath Condition="'$(_ZVcpkgClassicOrManifest)' == 'true'">$(ExternalIncludePath);$(_ZVcpkgCurrentInstalledDir)include</ExternalIncludePath> |
| 97 | + </PropertyGroup> |
| 98 | + |
| 99 | + <PropertyGroup> |
| 100 | + <!-- Note: Overwrite VcpkgPageSchema with a non-existing path to disable the VcPkg property sheet in your projects --> |
| 101 | + <VcpkgPageSchema Condition="'$(VcpkgPageSchema)' == ''">$(_ZVcpkgRoot)scripts\buildsystems\msbuild\vcpkg-general.xml</VcpkgPageSchema> |
| 102 | + </PropertyGroup> |
| 103 | + |
| 104 | + <ItemGroup Condition="'$(VcpkgPageSchema)' != '' and exists('$(VcpkgPageSchema)') and '$(MSBuildToolsVersion)' != '14.0'"> |
| 105 | + <PropertyPageSchema Include="$(VcpkgPageSchema)"> |
| 106 | + <Context>Project</Context> |
| 107 | + </PropertyPageSchema> |
| 108 | + </ItemGroup> |
| 109 | + |
| 110 | + <!-- Install settings to get headers and import libs for the currently selected _ZVcpkgCurrentInstalledDir --> |
| 111 | + <ItemDefinitionGroup Condition="'$(_ZVcpkgClassicOrManifest)' == 'true'"> |
| 112 | + <Lib> |
| 113 | + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib;$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\manual-link</AdditionalLibraryDirectories> |
| 114 | + </Lib> |
| 115 | + <Link> |
| 116 | + <AdditionalDependencies Condition="'$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\*.lib</AdditionalDependencies> |
| 117 | + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib;$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\manual-link</AdditionalLibraryDirectories> |
| 118 | + </Link> |
| 119 | + <ClCompile> |
| 120 | + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(_ZVcpkgCurrentInstalledDir)include</AdditionalIncludeDirectories> |
| 121 | + </ClCompile> |
| 122 | + <ResourceCompile> |
| 123 | + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(_ZVcpkgCurrentInstalledDir)include</AdditionalIncludeDirectories> |
| 124 | + </ResourceCompile> |
| 125 | + </ItemDefinitionGroup> |
| 126 | + |
| 127 | + <Target Name="VcpkgCheckManifestRoot" BeforeTargets="VcpkgInstallManifestDependencies" Condition="'$(VcpkgEnabled)' == 'true'"> |
| 128 | + <Error Text="The vcpkg manifest was enabled, but we couldn't find a manifest file (vcpkg.json) in any directories above $(MSBuildProjectDirectory). Please add a manifest, disable manifests in your properties page, or pass /p:VcpkgEnableManifest=false." |
| 129 | + Condition="'$(VcpkgEnableManifest)' == 'true' and '$(_ZVcpkgManifestRoot)' == ''" /> |
| 130 | + <Message Text="The vcpkg manifest was disabled, but we found a manifest file in $(_ZVcpkgManifestRoot). You may want to enable vcpkg manifests in your properties page or pass /p:VcpkgEnableManifest=true to the msbuild invocation." |
| 131 | + Importance="High" Condition="'$(VcpkgEnableManifest)' != 'true' and '$(_ZVcpkgManifestRoot)' != ''" /> |
| 132 | + </Target> |
| 133 | + |
| 134 | + <Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile" Condition="'$(_ZVcpkgClassicOrManifest)' == 'true'"> |
| 135 | + <Message Text="Using triplet "$(VcpkgTriplet)" from "$(_ZVcpkgCurrentInstalledDir)"" |
| 136 | + Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/> |
| 137 | + <Message Text="Using normalized configuration "$(_ZVcpkgNormalizedConfiguration)"" |
| 138 | + Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/> |
| 139 | + <Message Text="Not using Vcpkg because VcpkgEnabled is "$(VcpkgEnabled)"" |
| 140 | + Importance="Normal" Condition="'$(VcpkgEnabled)' != 'true'"/> |
| 141 | + <Message Text="Vcpkg is unable to link because we cannot decide between Release and Debug libraries. Please define the property VcpkgConfiguration to be 'Release' or 'Debug' (currently '$(VcpkgConfiguration)')." |
| 142 | + Importance="High" Condition="'$(VcpkgEnabled)' == 'true' and '$(_ZVcpkgNormalizedConfiguration)' == ''"/> |
| 143 | + </Target> |
| 144 | + |
| 145 | + <Choose> |
| 146 | + <When Condition="'$(VcpkgHostTriplet)' != ''"> |
| 147 | + <PropertyGroup> |
| 148 | + <_ZVcpkgHostTripletParameter>"--host-triplet=$(VcpkgHostTriplet)"</_ZVcpkgHostTripletParameter> |
| 149 | + <_ZVcpkgHostTripletSuffix>$(VcpkgHostTriplet).</_ZVcpkgHostTripletSuffix> |
| 150 | + </PropertyGroup> |
| 151 | + </When> |
| 152 | + <Otherwise> |
| 153 | + <PropertyGroup> |
| 154 | + <_ZVcpkgHostTripletParameter /> |
| 155 | + <_ZVcpkgHostTripletSuffix /> |
| 156 | + </PropertyGroup> |
| 157 | + </Otherwise> |
| 158 | + </Choose> |
| 159 | + |
| 160 | + <PropertyGroup> |
| 161 | + <_ZVcpkgManifestFileLocation>$(_ZVcpkgManifestRoot)vcpkg.json</_ZVcpkgManifestFileLocation> |
| 162 | + <_ZVcpkgConfigurationFileLocation>$(_ZVcpkgManifestRoot)vcpkg-configuration.json</_ZVcpkgConfigurationFileLocation> |
| 163 | + <_ZVcpkgMSBuildStampFile>$(_ZVcpkgInstalledDir).msbuildstamp-$(VcpkgTriplet).$(_ZVcpkgHostTripletSuffix)stamp</_ZVcpkgMSBuildStampFile> |
| 164 | + </PropertyGroup> |
| 165 | + |
| 166 | + <ItemGroup Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgEnableManifest)' == 'true' and '$(VcpkgManifestInstall)' == 'true'"> |
| 167 | + <_ZVcpkgInstallManifestDependenciesInputs Include="$(_ZVcpkgManifestFileLocation)"/> |
| 168 | + <_ZVcpkgInstallManifestDependenciesInputs Include="$(_ZVcpkgConfigurationFileLocation)" Condition="Exists('$(_ZVcpkgConfigurationFileLocation)')"/> |
| 169 | + </ItemGroup> |
| 170 | + |
| 171 | + <Target Name="VcpkgInstallManifestDependencies" BeforeTargets="ClCompile" |
| 172 | + Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgEnableManifest)' == 'true' and '$(VcpkgManifestInstall)' == 'true'" |
| 173 | + Inputs="@(_ZVcpkgInstallManifestDependenciesInputs)" |
| 174 | + Outputs="$(_ZVcpkgMSBuildStampFile)"> |
| 175 | + <!-- This is set inside the target because $(TLogLocation) may not be set yet when parsing the .targets on VS2015 --> |
| 176 | + <PropertyGroup> |
| 177 | + <_ZVcpkgTLogFileLocation>$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).$(_ZVcpkgHostTripletSuffix)read.1u.tlog</_ZVcpkgTLogFileLocation> |
| 178 | + </PropertyGroup> |
| 179 | + <Message Text="Installing vcpkg dependencies to $(_ZVcpkgInstalledDir)" Importance="High" /> |
| 180 | + <MakeDir Directories="$(_ZVcpkgInstalledDir)" /> |
| 181 | + <Message Text="%22$(_ZVcpkgExecutable)%22 install $(_ZVcpkgHostTripletParameter) --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(_ZVcpkgRoot)\%22 %22--x-manifest-root=$(_ZVcpkgManifestRoot)\%22 %22--x-install-root=$(_ZVcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)" |
| 182 | + Importance="High" /> |
| 183 | + <Exec Command="%22$(_ZVcpkgExecutable)%22 install $(_ZVcpkgHostTripletParameter) --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(_ZVcpkgRoot)\%22 %22--x-manifest-root=$(_ZVcpkgManifestRoot)\%22 %22--x-install-root=$(_ZVcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)" |
| 184 | + StandardOutputImportance="High" |
| 185 | + IgnoreStandardErrorWarningFormat="true" |
| 186 | + CustomWarningRegularExpression="([Ee]rror|[Ww]arning):" /> |
| 187 | + <WriteLinesToFile File="$(_ZVcpkgTLogFileLocation)" |
| 188 | + Lines="@(_ZVcpkgInstallManifestDependenciesInputs -> '^%(Identity)')" |
| 189 | + Encoding="Unicode" |
| 190 | + Overwrite="true"/> |
| 191 | + <Touch Files="$(_ZVcpkgMSBuildStampFile)" AlwaysCreate="true" /> |
| 192 | + |
| 193 | + <CreateProperty Value="false"> |
| 194 | + <Output TaskParameter="ValueSetByTask" PropertyName="Link_MinimalRebuildFromTracking" /> |
| 195 | + </CreateProperty> |
| 196 | + </Target> |
| 197 | + |
| 198 | + <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput" |
| 199 | + Condition="'$(_ZVcpkgClassicOrManifest)' == 'true' and '$(VcpkgApplocalDeps)' == 'true' and '$(LinkSkippedExecution)' != 'true'"> |
| 200 | + <Message Text="[vcpkg] Starting VcpkgApplocalDeps" Importance="low" /> |
| 201 | + <PropertyGroup> |
| 202 | + <_ZVcpkgAppLocalPowerShellCommonArguments>-ExecutionPolicy Bypass -noprofile -File "$(MSBuildThisFileDirectory)applocal.ps1" "$(TargetPath)" "$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)bin" "$(TLogLocation)$(ProjectName).write.1u.tlog" "$(IntDir)vcpkg.applocal.log"</_ZVcpkgAppLocalPowerShellCommonArguments> |
| 203 | + </PropertyGroup> |
| 204 | + <!-- Search %PATH% for pwsh.exe if it is available. --> |
| 205 | + <Exec |
| 206 | + Command="pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments)" |
| 207 | + StandardOutputImportance="Normal" |
| 208 | + StandardErrorImportance="Normal" |
| 209 | + IgnoreExitCode="true" |
| 210 | + UseCommandProcessor="false"> |
| 211 | + <Output TaskParameter="ExitCode" |
| 212 | + PropertyName="_ZVcpkgAppLocalExitCode" /> |
| 213 | + </Exec> |
| 214 | + <!-- Fall back to well known system PowerShell location otherwise. --> |
| 215 | + <Message Text="[vcpkg] Failed to run applocal.ps1 using pwsh, falling back to system PowerShell." Importance="low" |
| 216 | + Condition="$(_ZVcpkgAppLocalExitCode) == 9009" /> |
| 217 | + <Exec |
| 218 | + Command="%22$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe%22 $(_ZVcpkgAppLocalPowerShellCommonArguments)" |
| 219 | + StandardOutputImportance="Normal" |
| 220 | + StandardErrorImportance="Normal" |
| 221 | + IgnoreExitCode="true" |
| 222 | + UseCommandProcessor="false" |
| 223 | + Condition="$(_ZVcpkgAppLocalExitCode) == 9009"> |
| 224 | + <Output TaskParameter="ExitCode" |
| 225 | + PropertyName="_ZVcpkgAppLocalExitCode" /> |
| 226 | + </Exec> |
| 227 | + <!-- We're ignoring the above exit codes, so translate into a warning if both failed. --> |
| 228 | + <Warning Text="[vcpkg] Failed to gather app local DLL dependencies, program may not run. Set VcpkgApplocalDeps to false in your project file to suppress this warning. PowerShell arguments: $(_ZVcpkgAppLocalPowerShellCommonArguments)" |
| 229 | + Condition="$(_ZVcpkgAppLocalExitCode) != 0"/> |
| 230 | + <ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log" |
| 231 | + Condition="$(_ZVcpkgAppLocalExitCode) == 0"> |
| 232 | + <Output TaskParameter="Lines" ItemName="VcpkgAppLocalDLLs" /> |
| 233 | + </ReadLinesFromFile> |
| 234 | + <Message Text="@(VcpkgAppLocalDLLs,'%0A')" Importance="Normal" Condition="$(_ZVcpkgAppLocalExitCode) == 0" /> |
| 235 | + <ItemGroup Condition="$(_ZVcpkgAppLocalExitCode) == 0"> |
| 236 | + <ReferenceCopyLocalPaths Include="@(VcpkgAppLocalDLLs)" /> |
| 237 | + </ItemGroup> |
| 238 | + </Target> |
| 239 | +</Project> |
0 commit comments