Skip to content

Commit b899fae

Browse files
authored
fix: Find VC.Tools.ARM64 on arm64 machine (#3075)
1 parent b9d10a5 commit b899fae

File tree

3 files changed

+475
-4
lines changed

3 files changed

+475
-4
lines changed

lib/find-visualstudio.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class VisualStudioFinder {
145145
version: process.env.VSCMD_VER,
146146
packages: [
147147
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
148+
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
148149
// Assume MSBuild exists. It will be checked in processing.
149150
'Microsoft.VisualStudio.VC.MSBuild.Base'
150151
]
@@ -429,12 +430,21 @@ class VisualStudioFinder {
429430

430431
// Helper - process toolset information
431432
getToolset (info, versionYear) {
432-
const pkg = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
433+
const vcToolsArm64 = 'VC.Tools.ARM64'
434+
const pkgArm64 = `Microsoft.VisualStudio.Component.${vcToolsArm64}`
435+
const vcToolsX64 = 'VC.Tools.x86.x64'
436+
const pkgX64 = `Microsoft.VisualStudio.Component.${vcToolsX64}`
433437
const express = 'Microsoft.VisualStudio.WDExpress'
434438

435-
if (info.packages.indexOf(pkg) !== -1) {
436-
this.log.silly('- found VC.Tools.x86.x64')
437-
} else if (info.packages.indexOf(express) !== -1) {
439+
if (process.arch === 'arm64' && info.packages.includes(pkgArm64)) {
440+
this.log.silly(`- found ${vcToolsArm64}`)
441+
} else if (info.packages.includes(pkgX64)) {
442+
if (process.arch === 'arm64') {
443+
this.addLog(`- found ${vcToolsX64} on ARM64 platform. Expect less performance and/or link failure with ARM64 binary.`)
444+
} else {
445+
this.log.silly(`- found ${vcToolsX64}`)
446+
}
447+
} else if (info.packages.includes(express)) {
438448
this.log.silly('- found Visual Studio Express (looking for toolset)')
439449
} else {
440450
return null

0 commit comments

Comments
 (0)