2017-02-09 11:34:19 +08:00
|
|
|
[CmdletBinding()]
|
|
|
|
param(
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
2017-02-15 08:53:29 +08:00
|
|
|
$programFiles32 = & $scriptsDir\getProgramFiles32bit.ps1
|
|
|
|
$programFilesP = & $scriptsDir\getProgramFilesPlatformBitness.ps1
|
|
|
|
$CandidateProgramFiles = $programFiles32, $programFilesP
|
2017-02-09 11:34:19 +08:00
|
|
|
|
|
|
|
# Windows 10 SDK
|
|
|
|
foreach ($ProgramFiles in $CandidateProgramFiles)
|
|
|
|
{
|
|
|
|
$folder = "$ProgramFiles\Windows Kits\10\Include"
|
|
|
|
if (!(Test-Path $folder))
|
|
|
|
{
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2017-02-10 07:26:40 +08:00
|
|
|
$win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object)
|
|
|
|
[array]::Reverse($win10sdkVersions) # Newest SDK first
|
2017-02-09 11:34:19 +08:00
|
|
|
|
2017-02-10 07:26:40 +08:00
|
|
|
foreach ($win10sdkV in $win10sdkVersions)
|
2017-02-09 11:34:19 +08:00
|
|
|
{
|
2017-02-10 07:26:40 +08:00
|
|
|
if (Test-Path "$folder\$win10sdkV\um\windows.h")
|
|
|
|
{
|
|
|
|
return $win10sdkV.ToString()
|
|
|
|
}
|
2017-02-09 11:34:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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"
|