Skip to content

Commit

Permalink
Support building against VC17 on AMD64
Browse files Browse the repository at this point in the history
  • Loading branch information
apgrucza committed May 1, 2024
1 parent 3869efe commit 09d6333
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions winbuild/MSProgram-Get.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function Find-MSBuild
} catch {}
if ("$msbuildexe" -eq "") {
Write-Debug "tools version $toolsnum"
if ($toolsnum -gt 14) { # VC15 ~ VC16
if ($toolsnum -gt 14) { # VC15 ~ VC??
$msbuildexe = msbfind_15_xx $toolsnum
} else { # VC10 ~ VC14
$msbuildexe = msbfind_10_14 "${toolsnum}.0"
Expand Down Expand Up @@ -203,7 +203,7 @@ function msbfind_10_14
return "${msbindir}msbuild"
}

# find msbuild.exe for VC15 ~ VC16
# find msbuild.exe for VC15 ~ VC??
function msbfind_15_xx
{
[CmdletBinding()]
Expand Down Expand Up @@ -243,7 +243,7 @@ function Find-Dumpbin
# $dumpbinexe="$env:DUMPBINEXE"
if ($dumpbinexe -eq "") {
$searching = $true
for ($i = $CurMaxVc; $searching -and ($i -ge 14); $i--) # VC15 ~ VC16
for ($i = $CurMaxVc; $searching -and ($i -ge 14); $i--) # VC15 ~ VC??
{
$vsdir = Find-VSDir $i
if ("$vsdir" -ne "") {
Expand Down Expand Up @@ -365,7 +365,7 @@ function Find-VSDir
if ((env_vcversion_no) -eq $vcversion_no) {
return $env:VSINSTALLDIR
}
if ($vcversion_no -gt 14) { # VC15 ~ VC16
if ($vcversion_no -gt 14) { # VC15 ~ VC??
return find_vsdir_15_xx ${vcversion_no}
} else { # VC10 ~ VC14
$comntools = [environment]::getenvironmentvariable("VS${vcversion_no}0COMNTOOLS")
Expand All @@ -378,7 +378,7 @@ function Find-VSDir

[bool]$vssetup_available = $true
$vssetup = $null
# find vs installation path for VC15 ~ VC16
# find vs installation path for VC15 ~ VC??
function find_vs_installation
{
[CmdletBinding()]
Expand Down Expand Up @@ -406,7 +406,7 @@ function find_vs_installation
}

$vsarray = @{VC15 = "2017"; VC16 = "2019"; VC17 = "2022"}
# find VS dir for VC15 ~ VC16
# find VS dir for VC15 ~ VC??
function find_default_msbuild_path
{
[CmdletBinding()]
Expand All @@ -418,7 +418,8 @@ function find_default_msbuild_path
if ($vsdir -eq "")
{
$toolsnum = [int]$toolsver
if ($env:PROCESSOR_ARCHITECTURE -eq "x86" -or $env:PROCESSOR_ARCHITECTURE -eq "ARM64") {
# As of Visual Studio 2022 (VC17), MSBuild is 64-bit and so is always in ProgramFiles
if ($env:PROCESSOR_ARCHITECTURE -eq "x86" -or $toolsver -ge 17) {
$pgmfs = "$env:ProgramFiles"
} else {
$pgmfs = "${env:ProgramFiles(x86)}"
Expand All @@ -436,7 +437,7 @@ function find_default_msbuild_path
return ""
}

# find VS dir for VC15 ~ VC16
# find VS dir for VC15 ~ VC??
function find_vsdir_15_xx
{
[CmdletBinding()]
Expand Down

0 comments on commit 09d6333

Please sign in to comment.