[vcpkg scripts] Add PowerShell Core tool support for cross-platform builds #49910
+53
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Split from #49890 — this PR extracts the PowerShell Core tool acquisition portion as an independent change.
vcpkg_find_acquire_program(PWSH)module for standardized PowerShell Core acquisition via vcpkg's tool infrastructurefind_program(pwsh)invcpkg_copy_tool_dependencies.cmakewithvcpkg_find_acquire_program(PWSH), eliminating build failures when PowerShell is not pre-installed on the hostvcpkg-tools.jsonfor Windows x86, Linux x64/arm64, and macOS x64/arm64 (Windows x64/arm64 entries already existed)Problem
When cross-compiling Windows targets from macOS or Linux,
vcpkg_copy_tool_dependenciesfails with:PowerShell is required for dependency deployment scripts but the previous code assumed
pwshwas already available on the host system viafind_program().Solution
Use vcpkg's existing tool acquisition infrastructure (
vcpkg_find_acquire_program/z_use_vcpkg_fetch) to automatically download and configure PowerShell Core 7.5.4 when needed. This follows the same pattern used by other vcpkg tools (cmake, ninja, git, etc.) and ensures PowerShell is available on any supported platform without requiring manual installation.Changes
scripts/cmake/vcpkg_find_acquire_program(PWSH).cmakePWSHtopowershell-coretool fetchscripts/cmake/vcpkg_copy_tool_dependencies.cmakefind_program(pwsh)+FATAL_ERRORwithvcpkg_find_acquire_program(PWSH)scripts/vcpkg-tools.jsonpowershell-coreentries (win-x86, linux-x64, linux-arm64, osx-x64, osx-arm64)Test plan
Tested on macOS ARM64 and Linux x64. SHA-512 hashes verified locally against official GitHub release archives for both platforms.
🤖 Generated with Claude Code