aboutsummaryrefslogtreecommitdiff
path: root/scripts/getWindowsSDK.ps1
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-02-21 17:42:39 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-02-21 17:45:08 -0800
commita2cebceafec8341fcab0236a3c81a27f935aeb38 (patch)
treef26175913cbbb3df4ab20e7342067331313b9a15 /scripts/getWindowsSDK.ps1
parent1dd675a785ddce82b2ff4b164ed10f8b9789a5c7 (diff)
downloadvcpkg-a2cebceafec8341fcab0236a3c81a27f935aeb38.tar.gz
vcpkg-a2cebceafec8341fcab0236a3c81a27f935aeb38.zip
Rename findTargetPlatformVersion to getWindowsSDK
Diffstat (limited to 'scripts/getWindowsSDK.ps1')
-rw-r--r--scripts/getWindowsSDK.ps142
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1
new file mode 100644
index 000000000..650e0b4ed
--- /dev/null
+++ b/scripts/getWindowsSDK.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