deps: cherry-pick 91744bf from node-gyp upstream
This change cherry-picks a small set of node-gyp v5.0.0 changes needed
to enable Node.js ARM64 Windows builds.
Original commit message:
gyp: add support for Windows on Arm
Cherry-pick of https://github.com/refack/GYP/pull/33, supersedes
https://github.com/nodejs/node-gyp/pull/1678 until GYP3 is merged.
`npm test` passes
Change-Id: I2b1e1e03e378b4812d34afa527087793864d1576
PR-URL: https://github.com/nodejs/node-gyp/pull/1739
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Refs: 91744bfecc
PR-URL: https://github.com/nodejs/node/pull/28604
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: João Reis <reis@janeasystems.com>
This commit is contained in:
parent
d53144e549
commit
c3caf21bd3
4
deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
generated
vendored
4
deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
generated
vendored
@ -969,7 +969,9 @@ _Same(_midl, 'TargetEnvironment',
|
|||||||
_Enumeration(['NotSet',
|
_Enumeration(['NotSet',
|
||||||
'Win32', # /env win32
|
'Win32', # /env win32
|
||||||
'Itanium', # /env ia64
|
'Itanium', # /env ia64
|
||||||
'X64'])) # /env x64
|
'X64', # /env x64
|
||||||
|
'ARM64', # /env arm64
|
||||||
|
]))
|
||||||
_Same(_midl, 'EnableErrorChecks',
|
_Same(_midl, 'EnableErrorChecks',
|
||||||
_Enumeration(['EnableCustom',
|
_Enumeration(['EnableCustom',
|
||||||
'None', # /error none
|
'None', # /error none
|
||||||
|
2
deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
generated
vendored
2
deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
generated
vendored
@ -1885,6 +1885,8 @@ def _InitNinjaFlavor(params, target_list, target_dicts):
|
|||||||
configuration = '$(Configuration)'
|
configuration = '$(Configuration)'
|
||||||
if params.get('target_arch') == 'x64':
|
if params.get('target_arch') == 'x64':
|
||||||
configuration += '_x64'
|
configuration += '_x64'
|
||||||
|
if params.get('target_arch') == 'arm64':
|
||||||
|
configuration += '_arm64'
|
||||||
spec['msvs_external_builder_out_dir'] = os.path.join(
|
spec['msvs_external_builder_out_dir'] = os.path.join(
|
||||||
gyp.common.RelativePath(params['options'].toplevel_dir, gyp_dir),
|
gyp.common.RelativePath(params['options'].toplevel_dir, gyp_dir),
|
||||||
ninja_generator.ComputeOutputDir(params),
|
ninja_generator.ComputeOutputDir(params),
|
||||||
|
17
deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
generated
vendored
17
deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
generated
vendored
@ -237,7 +237,11 @@ class MsvsSettings(object):
|
|||||||
def GetVSMacroEnv(self, base_to_build=None, config=None):
|
def GetVSMacroEnv(self, base_to_build=None, config=None):
|
||||||
"""Get a dict of variables mapping internal VS macro names to their gyp
|
"""Get a dict of variables mapping internal VS macro names to their gyp
|
||||||
equivalents."""
|
equivalents."""
|
||||||
target_platform = 'Win32' if self.GetArch(config) == 'x86' else 'x64'
|
target_arch = self.GetArch(config)
|
||||||
|
if target_arch == 'x86':
|
||||||
|
target_platform = 'Win32'
|
||||||
|
else:
|
||||||
|
target_platform = target_arch
|
||||||
target_name = self.spec.get('product_prefix', '') + \
|
target_name = self.spec.get('product_prefix', '') + \
|
||||||
self.spec.get('product_name', self.spec['target_name'])
|
self.spec.get('product_name', self.spec['target_name'])
|
||||||
target_dir = base_to_build + '\\' if base_to_build else ''
|
target_dir = base_to_build + '\\' if base_to_build else ''
|
||||||
@ -299,7 +303,7 @@ class MsvsSettings(object):
|
|||||||
if not platform: # If no specific override, use the configuration's.
|
if not platform: # If no specific override, use the configuration's.
|
||||||
platform = configuration_platform
|
platform = configuration_platform
|
||||||
# Map from platform to architecture.
|
# Map from platform to architecture.
|
||||||
return {'Win32': 'x86', 'x64': 'x64'}.get(platform, 'x86')
|
return {'Win32': 'x86', 'x64': 'x64', 'ARM64': 'arm64'}.get(platform, 'x86')
|
||||||
|
|
||||||
def _TargetConfig(self, config):
|
def _TargetConfig(self, config):
|
||||||
"""Returns the target-specific configuration."""
|
"""Returns the target-specific configuration."""
|
||||||
@ -563,7 +567,10 @@ class MsvsSettings(object):
|
|||||||
'VCLinkerTool', append=ldflags)
|
'VCLinkerTool', append=ldflags)
|
||||||
self._GetDefFileAsLdflags(ldflags, gyp_to_build_path)
|
self._GetDefFileAsLdflags(ldflags, gyp_to_build_path)
|
||||||
ld('GenerateDebugInformation', map={'true': '/DEBUG'})
|
ld('GenerateDebugInformation', map={'true': '/DEBUG'})
|
||||||
ld('TargetMachine', map={'1': 'X86', '17': 'X64', '3': 'ARM'},
|
# TODO: These 'map' values come from machineTypeOption enum,
|
||||||
|
# and does not have an official value for ARM64 in VS2017 (yet).
|
||||||
|
# It needs to verify the ARM64 value when machineTypeOption is updated.
|
||||||
|
ld('TargetMachine', map={'1': 'X86', '17': 'X64', '3': 'ARM', '18': 'ARM64'},
|
||||||
prefix='/MACHINE:')
|
prefix='/MACHINE:')
|
||||||
ldflags.extend(self._GetAdditionalLibraryDirectories(
|
ldflags.extend(self._GetAdditionalLibraryDirectories(
|
||||||
'VCLinkerTool', config, gyp_to_build_path))
|
'VCLinkerTool', config, gyp_to_build_path))
|
||||||
@ -860,7 +867,9 @@ class MsvsSettings(object):
|
|||||||
('iid', iid),
|
('iid', iid),
|
||||||
('proxy', proxy)]
|
('proxy', proxy)]
|
||||||
# TODO(scottmg): Are there configuration settings to set these flags?
|
# TODO(scottmg): Are there configuration settings to set these flags?
|
||||||
target_platform = 'win32' if self.GetArch(config) == 'x86' else 'x64'
|
target_platform = self.GetArch(config)
|
||||||
|
if target_platform == 'x86':
|
||||||
|
target_platform = 'win32'
|
||||||
flags = ['/char', 'signed', '/env', target_platform, '/Oicf']
|
flags = ['/char', 'signed', '/env', target_platform, '/Oicf']
|
||||||
return outdir, output, variables, flags
|
return outdir, output, variables, flags
|
||||||
|
|
||||||
|
3
deps/npm/node_modules/node-gyp/lib/configure.js
generated
vendored
3
deps/npm/node_modules/node-gyp/lib/configure.js
generated
vendored
@ -142,6 +142,9 @@ function configure (gyp, argv, callback) {
|
|||||||
|
|
||||||
// set the target_arch variable
|
// set the target_arch variable
|
||||||
variables.target_arch = gyp.opts.arch || process.arch || 'ia32'
|
variables.target_arch = gyp.opts.arch || process.arch || 'ia32'
|
||||||
|
if (variables.target_arch == 'arm64') {
|
||||||
|
defaults['msvs_configuration_platform'] = 'ARM64'
|
||||||
|
}
|
||||||
|
|
||||||
// set the node development directory
|
// set the node development directory
|
||||||
variables.nodedir = nodeDir
|
variables.nodedir = nodeDir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user