зеркало из https://github.com/microsoft/vcpkg.git
Add msbuild feature to use z-applocal, and avoid trying to applocal deploy for non executable project types. (#35012)
* Hook up z-applocal, work started by @vicroms. * Fix spelling of utf8 * Use standard warning formats. * Don't get in the way of stdout. * Don't try to Applocal deploy if the linker does not run. * Make VcpkgUseBuiltInApplocalDeps docs a bit nicer. * Change to (experimental) prefix. * Add an X.
This commit is contained in:
Родитель
1e8122f2f8
Коммит
11610eabb9
|
@ -41,6 +41,20 @@
|
|||
</BoolProperty.DataSource>
|
||||
</BoolProperty>
|
||||
|
||||
<BoolProperty Name="VcpkgApplocalDeps" DisplayName="App-locally deploy DLLs" Category="General" Default="true"
|
||||
Description="Copies DLL dependencies from the vcpkg installed tree to the project output directory.">
|
||||
<BoolProperty.DataSource>
|
||||
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
|
||||
</BoolProperty.DataSource>
|
||||
</BoolProperty>
|
||||
|
||||
<BoolProperty Name="VcpkgXUseBuiltInApplocalDeps" DisplayName="Use built-in app-local deployment" Category="General" Default="false"
|
||||
Description="(experimental) When copying DLL dependencies, use built-in-to-vcpkg implementation rather than PowerShell script.">
|
||||
<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>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
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' OR '$(PlatformToolset.ToLower())' == 'clangcl'">false</VcpkgAutoLink>
|
||||
<VcpkgApplocalDeps Condition="'$(VcpkgApplocalDeps)' == ''">true</VcpkgApplocalDeps>
|
||||
<VcpkgXUseBuiltInApplocalDeps Condition="'$(VcpkgXUseBuiltInApplocalDeps)' == ''">false</VcpkgXUseBuiltInApplocalDeps>
|
||||
|
||||
<!-- Classic Mode: The following line is edited by the mint standalone bundle script to be false for standlone copies -->
|
||||
<VcpkgEnableClassic Condition="'$(VcpkgEnableClassic)' == ''">true</VcpkgEnableClassic>
|
||||
|
|
|
@ -182,8 +182,12 @@
|
|||
Importance="High" />
|
||||
<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)"
|
||||
StandardOutputImportance="High"
|
||||
IgnoreStandardErrorWarningFormat="true"
|
||||
CustomWarningRegularExpression="([Ee]rror|[Ww]arning):" />
|
||||
StandardErrorImportance="High"
|
||||
UseUtf8Encoding="Always"
|
||||
StdOutEncoding="utf-8"
|
||||
StdErrEncoding="utf-8"
|
||||
UseCommandProcessor="false"
|
||||
/>
|
||||
<WriteLinesToFile File="$(_ZVcpkgTLogFileLocation)"
|
||||
Lines="@(_ZVcpkgInstallManifestDependenciesInputs -> '^%(Identity)')"
|
||||
Encoding="Unicode"
|
||||
|
@ -196,16 +200,33 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput"
|
||||
Condition="'$(_ZVcpkgClassicOrManifest)' == 'true' and '$(VcpkgApplocalDeps)' == 'true' and '$(LinkSkippedExecution)' != 'true'">
|
||||
Condition="'$(_ZVcpkgClassicOrManifest)' == 'true' and '$(VcpkgApplocalDeps)' == 'true' and '$(LinkSkippedExecution)' != 'true' and '@(Link)' != ''">
|
||||
<Message Text="[vcpkg] Starting VcpkgApplocalDeps" Importance="low" />
|
||||
<PropertyGroup>
|
||||
<_ZVcpkgAppLocalPowerShellCommonArguments>-ExecutionPolicy Bypass -noprofile -File "$(MSBuildThisFileDirectory)applocal.ps1" "$(TargetPath)" "$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)bin" "$(TLogLocation)$(ProjectName).write.1u.tlog" "$(IntDir)vcpkg.applocal.log"</_ZVcpkgAppLocalPowerShellCommonArguments>
|
||||
<_ZVcpkgApplocalInstalledBinDir>$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)bin</_ZVcpkgApplocalInstalledBinDir>
|
||||
<_ZVcpkgApplocalTLogPath>$(TLogLocation)$(ProjectName).write.1u.tlog</_ZVcpkgApplocalTLogPath>
|
||||
<_ZVcpkgApplocalCopiedFilesLogPath>$(IntDir)vcpkg.applocal.log</_ZVcpkgApplocalCopiedFilesLogPath>
|
||||
<_ZVcpkgApplocalBuiltinArguments>--target-binary="$(TargetPath)" --installed-bin-dir="$(_ZVcpkgApplocalInstalledBinDir)" --tlog-file="$(_ZVcpkgApplocalTLogPath)" --copied-files-log="$(_ZVcpkgApplocalCopiedFilesLogPath)"</_ZVcpkgApplocalBuiltinArguments>
|
||||
<_ZVcpkgAppLocalPowerShellCommonArguments>-ExecutionPolicy Bypass -noprofile -File "$(MSBuildThisFileDirectory)applocal.ps1" "$(TargetPath)" "$(_ZVcpkgApplocalInstalledBinDir)" "$(_ZVcpkgApplocalTLogPath)" "$(_ZVcpkgApplocalCopiedFilesLogPath)"</_ZVcpkgAppLocalPowerShellCommonArguments>
|
||||
</PropertyGroup>
|
||||
<Exec
|
||||
Condition="'$(VcpkgXUseBuiltInApplocalDeps)' == 'true'"
|
||||
Command="%22$(_ZVcpkgExecutable)%22 z-applocal $(_ZVcpkgApplocalBuiltinArguments)"
|
||||
UseUtf8Encoding="Always"
|
||||
StdOutEncoding="utf-8"
|
||||
StdErrEncoding="utf-8"
|
||||
UseCommandProcessor="false"
|
||||
IgnoreExitCode="true">
|
||||
<Output TaskParameter="ExitCode"
|
||||
PropertyName="_ZVcpkgAppLocalExitCode" />
|
||||
</Exec>
|
||||
<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. Builtin arguments: $(_ZVcpkgApplocalBuiltinArguments)"
|
||||
Condition="$(_ZVcpkgAppLocalExitCode) != 0 and '$(VcpkgXUseBuiltInApplocalDeps)' == 'true'"/>
|
||||
|
||||
<!-- Search %PATH% for pwsh.exe if it is available. -->
|
||||
<Exec
|
||||
Condition="'$(VcpkgXUseBuiltInApplocalDeps)' != 'true'"
|
||||
Command="pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments)"
|
||||
StandardOutputImportance="Normal"
|
||||
StandardErrorImportance="Normal"
|
||||
IgnoreExitCode="true"
|
||||
UseCommandProcessor="false">
|
||||
<Output TaskParameter="ExitCode"
|
||||
|
@ -216,17 +237,16 @@
|
|||
Condition="$(_ZVcpkgAppLocalExitCode) == 9009" />
|
||||
<Exec
|
||||
Command="%22$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe%22 $(_ZVcpkgAppLocalPowerShellCommonArguments)"
|
||||
StandardOutputImportance="Normal"
|
||||
StandardErrorImportance="Normal"
|
||||
IgnoreExitCode="true"
|
||||
UseCommandProcessor="false"
|
||||
Condition="$(_ZVcpkgAppLocalExitCode) == 9009">
|
||||
Condition="$(_ZVcpkgAppLocalExitCode) == 9009 and '$(VcpkgXUseBuiltInApplocalDeps)' != 'true'">
|
||||
<Output TaskParameter="ExitCode"
|
||||
PropertyName="_ZVcpkgAppLocalExitCode" />
|
||||
</Exec>
|
||||
<!-- We're ignoring the above exit codes, so translate into a warning if both failed. -->
|
||||
<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)"
|
||||
Condition="$(_ZVcpkgAppLocalExitCode) != 0"/>
|
||||
Condition="$(_ZVcpkgAppLocalExitCode) != 0 and '$(VcpkgXUseBuiltInApplocalDeps)' != 'true'"/>
|
||||
|
||||
<ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log"
|
||||
Condition="$(_ZVcpkgAppLocalExitCode) == 0">
|
||||
<Output TaskParameter="Lines" ItemName="VcpkgAppLocalDLLs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче