Skip to content

Commit

Permalink
[bootstrap] Add option to specify WinSDK
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkaratarakis committed Jun 8, 2018
1 parent 47d9046 commit 9750fff
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions scripts/bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[CmdletBinding()]
param(
[ValidateNotNullOrEmpty()][string]$disableMetrics = "0",
[Parameter(Mandatory=$False)][string]$withVSPath = ""
[Parameter(Mandatory=$False)][string]$withVSPath = "",
[Parameter(Mandatory=$False)][string]$withWinSDK = ""
)
Set-StrictMode -Version Latest
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
Expand Down Expand Up @@ -169,7 +170,8 @@ function findAnyMSBuildWithCppPlatformToolset([string]$withVSPath)
throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed."
}
function getWindowsSDK( [Parameter(Mandatory=$False)][switch]$DisableWin10SDK = $False,
[Parameter(Mandatory=$False)][switch]$DisableWin81SDK = $False)
[Parameter(Mandatory=$False)][switch]$DisableWin81SDK = $False,
[Parameter(Mandatory=$False)][string]$withWinSDK)
{
if ($DisableWin10SDK -and $DisableWin81SDK)
{
Expand Down Expand Up @@ -270,6 +272,19 @@ function getWindowsSDK( [Parameter(Mandatory=$False)][switch]$DisableWin10SDK =
}

# Selecting
if ($withWinSDK -ne "")
{
foreach ($instance in $validInstances)
{
if ($instance -eq $withWinSDK)
{
return $instance
}
}

throw "Could not find the requested Windows SDK version: $withWinSDK"
}

foreach ($instance in $validInstances)
{
if (!$DisableWin10SDK -and $instance -match "10.")
Expand All @@ -289,7 +304,7 @@ function getWindowsSDK( [Parameter(Mandatory=$False)][switch]$DisableWin10SDK =
$msbuildExeWithPlatformToolset = findAnyMSBuildWithCppPlatformToolset $withVSPath
$msbuildExe = $msbuildExeWithPlatformToolset[0]
$platformToolset = $msbuildExeWithPlatformToolset[1]
$windowsSDK = getWindowsSDK
$windowsSDK = getWindowsSDK -withWinSDK $withWinSDK

$arguments = (
"`"/p:VCPKG_VERSION=-nohash`"",
Expand Down

0 comments on commit 9750fff

Please sign in to comment.