diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-02-21 13:39:36 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-21 13:39:36 -0800 |
| commit | 7d4df89c1dfff0b2bad0165ac4579f6352935a94 (patch) | |
| tree | 8b87d29fb74fb24984d5aff9b021f14d95afb5ab /scripts/findTargetPlatformVersion.ps1 | |
| parent | d9462fdf490d3396cac58b1a935b1b8a982b3a72 (diff) | |
| parent | b921dce5fc17bd4c1c206b79eb0a7b8758dcf5bf (diff) | |
| download | vcpkg-7d4df89c1dfff0b2bad0165ac4579f6352935a94.tar.gz vcpkg-7d4df89c1dfff0b2bad0165ac4579f6352935a94.zip | |
Merge branch 'master' into master
Diffstat (limited to 'scripts/findTargetPlatformVersion.ps1')
| -rw-r--r-- | scripts/findTargetPlatformVersion.ps1 | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/findTargetPlatformVersion.ps1 b/scripts/findTargetPlatformVersion.ps1 new file mode 100644 index 000000000..650e0b4ed --- /dev/null +++ b/scripts/findTargetPlatformVersion.ps1 @@ -0,0 +1,42 @@ +[CmdletBinding()] +param( + +) + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +$programFiles32 = & $scriptsDir\getProgramFiles32bit.ps1 +$programFilesP = & $scriptsDir\getProgramFilesPlatformBitness.ps1 +$CandidateProgramFiles = $programFiles32, $programFilesP + +# 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) + [array]::Reverse($win10sdkVersions) # Newest SDK first + + foreach ($win10sdkV in $win10sdkVersions) + { + if (Test-Path "$folder\$win10sdkV\um\windows.h") + { + return $win10sdkV.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"
\ No newline at end of file |
