Skip to content

Commit

Permalink
fix(buildwin.ps1): make install path global
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Nov 6, 2023
1 parent 90f64af commit 5301671
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions buildwin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,15 @@ function Add-VSCOMNTOOLS([int] $vsver)
$range='[17.0,18.0)'
}

$installationPath = ""
if ($platform -eq 'x64')
{
$installationPath = Get-VSSetupInstance | `
$global:installationPath = Get-VSSetupInstance | `
Select-VSSetupInstance -Version $range -product * -Latest -Require Microsoft.VisualStudio.Component.VC.Tools.x86.x64 | `
Select-Object InstallationPath
}
elseif ($platform -eq 'ARM64')
{
$installationPath = Get-VSSetupInstance | `
$global:installationPath = Get-VSSetupInstance | `
Select-VSSetupInstance -Version $range -product * -Latest -Require Microsoft.VisualStudio.Component.VC.Tools.ARM64 | `
Select-Object InstallationPath
}
Expand All @@ -112,17 +111,26 @@ function Add-VSCOMNTOOLS([int] $vsver)
if ($vsver -eq 150)
{
set-item -force -path "ENV:VS150COMNTOOLS" -value "$vscomntools\Common7\Tools\"
Write-Host "`nVS150COMNTOOLS=$env:VS150COMNTOOLS" -ForegroundColor Yellow
Write-Host "`n----------------------------------------" -ForegroundColor Yellow
Write-Host "VS150COMNTOOLS=$env:VS150COMNTOOLS" -ForegroundColor Yellow
Write-Host "----------------------------------------" -ForegroundColor Yellow
Write-Host ""
}
if ($vsver -eq 160)
{
set-item -force -path "ENV:VS160COMNTOOLS" -value "$vscomntools\Common7\Tools\"
Write-Host "`nVS160COMNTOOLS=$env:VS160COMNTOOLS" -ForegroundColor Yellow
Write-Host "`n----------------------------------------" -ForegroundColor Yellow
Write-Host "VS160COMNTOOLS=$env:VS160COMNTOOLS" -ForegroundColor Yellow
Write-Host "----------------------------------------" -ForegroundColor Yellow
Write-Host ""
}
if ($vsver -eq 170)
{
set-item -force -path "ENV:VS170COMNTOOLS" -value "$vscomntools\Common7\Tools\"
Write-Host "`nVS170COMNTOOLS=$env:VS170COMNTOOLS" -ForegroundColor Yellow
Write-Host "`n----------------------------------------" -ForegroundColor Yellow
Write-Host "VS170COMNTOOLS=$env:VS170COMNTOOLS" -ForegroundColor Yellow
Write-Host "----------------------------------------" -ForegroundColor Yellow
Write-Host ""
}
}
}
Expand Down Expand Up @@ -228,7 +236,7 @@ function Process-Input
Write-Host ' [-action build | rebuild | clean]'
Write-Host ' [-linkmode shared | static_mt | static_md | all]'
Write-Host ' [-config release | debug | both]'
Write-Host ' [-platform Win32 | x64 | WinCE | WEC2013]'
Write-Host ' [-platform Win32 | x64 | WinCE | WEC2013 | ARM64]'
Write-Host ' [-samples]'
Write-Host ' [-tests]'
Write-Host ' [-omit "Lib1X,LibY,LibZ,..."]'
Expand All @@ -237,13 +245,19 @@ function Process-Input
Write-Host ' [-verbosity minimal | quiet | normal | detailed | diagnostic'
Write-Host ' [-openssl_base <dir>]'
Write-Host ' [-mysql_base <dir>]'

Exit
}
else
{
Set-Environment

Write-Host ""
Write-Host "--------------------"
Write-Host "PS Version: " $PSVersionTable.PSVersion
Write-Host "--------------------"

Write-Host ""
Write-Host "--------------------"
Write-Host "Build configuration:"
Write-Host "--------------------"
Write-Host "Poco Base: $poco_base"
Expand Down Expand Up @@ -271,6 +285,9 @@ function Process-Input
Write-Host "MySQL: $mysql_base"
}

Write-Host "----------------------------------------"
Write-Host ""

# NB: this won't work in PowerShell ISE
#Write-Host "Press Ctrl-C to exit or any other key to continue ..."
#$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")
Expand Down

0 comments on commit 5301671

Please sign in to comment.