mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
bootstrap.ps1 now detects the available Windows SDKs
This commit is contained in:
parent
9e6920849c
commit
b6b69025c3
@ -26,7 +26,8 @@ try{
|
||||
$msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1
|
||||
$msbuildExe = $msbuildExeWithPlatformToolset[0]
|
||||
$platformToolset = $msbuildExeWithPlatformToolset[1]
|
||||
& $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /m dirs.proj
|
||||
$targetPlatformVersion = & $scriptsDir\findTargetPlatformVersion.ps1
|
||||
& $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$targetPlatformVersion /m dirs.proj
|
||||
|
||||
Write-Verbose("Placing vcpkg.exe in the correct location")
|
||||
|
||||
|
43
scripts/findTargetPlatformVersion.ps1
Normal file
43
scripts/findTargetPlatformVersion.ps1
Normal file
@ -0,0 +1,43 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
||||
)
|
||||
|
||||
Import-Module BitsTransfer
|
||||
|
||||
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}"
|
||||
|
||||
# Windows 10 SDK
|
||||
foreach ($ProgramFiles in $CandidateProgramFiles)
|
||||
{
|
||||
$folder = "$ProgramFiles\Windows Kits\10\Include"
|
||||
if (!(Test-Path $folder))
|
||||
{
|
||||
continue
|
||||
}
|
||||
|
||||
$win10sdkVersions = Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object
|
||||
$win10sdkVersionCount = $win10sdkVersions.Length
|
||||
|
||||
if ($win10sdkVersionCount -eq 0)
|
||||
{
|
||||
continue
|
||||
}
|
||||
|
||||
return $win10sdkVersions[$win10sdkVersionCount - 1].ToString()
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Windows 8.1 SDK
|
||||
foreach ($ProgramFiles in $CandidateProgramFiles)
|
||||
{
|
||||
$folder = "$ProgramFiles\Windows Kits\8.1\Include"
|
||||
if (Test-Path $folder)
|
||||
{
|
||||
return "8.1"
|
||||
}
|
||||
}
|
||||
|
||||
throw "Could not detect a Windows SDK / TargetPlatformVersion"
|
Loading…
x
Reference in New Issue
Block a user