From 08884ec36dd365f64eab6fb927c93d13f0292c4b Mon Sep 17 00:00:00 2001 From: Jon Kunkee Date: Thu, 21 Feb 2019 17:25:28 -0800 Subject: [PATCH] Add ARM64 Windows tool option Since Node.js is expected to support ARM64 Windows natively soon, this change adds an option to the module, '--include-arm64-tools', to install the extra Visual Studio 2017 bits required to build native modules for it. --- README.md | 1 + src/utils/get-build-tools-parameters.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 1aa9b74..28c1da0 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Optional arguments: * `--silent`: The script will not output any information. * `--vs2015`: Install the Visual Studio 2015 Build Tools instead of the Visual Studio 2017 ones. * `--dry-run-only`: Don't actually do anything, just print what the script would have done. +* `--include-arm64-tools`: Include the optional Visual Studio components required to build binaries for ARM64 Windows. Only available with the 2017 and newer build tools and Node.js v12 and up. ## Supplying Parameters to the VCC Build Tools diff --git a/src/utils/get-build-tools-parameters.ts b/src/utils/get-build-tools-parameters.ts index 63afdbb..143cd87 100644 --- a/src/utils/get-build-tools-parameters.ts +++ b/src/utils/get-build-tools-parameters.ts @@ -1,3 +1,5 @@ +import { BUILD_TOOLS } from '../constants'; + const debug = require('debug')('windows-build-tools'); export function getBuildToolsExtraParameters() { @@ -16,5 +18,9 @@ export function getBuildToolsExtraParameters() { } } + if (!!process.env.npm_config_include_arm64_tools && BUILD_TOOLS.version === 2017) { + extraArgs += ' --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64'; + } + return extraArgs; }