Skip to content

Commit ec5fc36

Browse files
kunalspathakbnoordhuis
authored andcommitted
Add support to build node.js with chakracore for ARM.
* Support building node.js with chakracore on Windows on ARM * Building chakracore for ARM has a dependency on Windows SDK installed on the machine. Update python script to populate `WindowsSDKDesktopARMSupport` and `WindowsTargetPlatformVersion` for ARM builds. This will be using in node repo to build`chakracore.gyp`. PR-URL: #873 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent a04ea30 commit ec5fc36

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

gyp/pylib/gyp/generator/msvs.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,22 @@ def _ConfigFullName(config_name, config_data):
285285
return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name)
286286

287287

288+
def _ConfigWindowsTargetPlatformVersion(config_data):
289+
ver = config_data.get('msvs_windows_target_platform_version')
290+
if not ver or re.match(r'^\d+', ver):
291+
return ver
292+
for key in [r'HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s',
293+
r'HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s']:
294+
sdkdir = MSVSVersion._RegistryGetValue(key % ver, 'InstallationFolder')
295+
if not sdkdir:
296+
continue
297+
version = MSVSVersion._RegistryGetValue(key % ver, 'ProductVersion') or ''
298+
# find a matching entry in sdkdir\include
299+
names = sorted([x for x in os.listdir(r'%s\include' % sdkdir) \
300+
if x.startswith(version)], reverse = True)
301+
return names[0]
302+
303+
288304
def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
289305
quote_cmd, do_setup_env):
290306

@@ -2664,6 +2680,22 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
26642680
else:
26652681
properties[0].append(['ApplicationType', 'Windows Store'])
26662682

2683+
platform_name = None
2684+
msvs_windows_target_platform_version = None
2685+
for configuration in spec['configurations'].itervalues():
2686+
platform_name = platform_name or _ConfigPlatform(configuration)
2687+
msvs_windows_target_platform_version = \
2688+
msvs_windows_target_platform_version or \
2689+
_ConfigWindowsTargetPlatformVersion(configuration)
2690+
if platform_name and msvs_windows_target_platform_version:
2691+
break
2692+
2693+
if platform_name == 'ARM':
2694+
properties[0].append(['WindowsSDKDesktopARMSupport', 'true'])
2695+
if msvs_windows_target_platform_version:
2696+
properties[0].append(['WindowsTargetPlatformVersion', \
2697+
str(msvs_windows_target_platform_version)])
2698+
26672699
return properties
26682700

26692701
def _GetMSBuildConfigurationDetails(spec, build_file):

lib/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ function build (gyp, argv, callback) {
226226

227227
// Specify the build type, Release by default
228228
if (win) {
229-
var p = arch === 'x64' ? 'x64' : 'Win32'
229+
var archLower = arch.toLowerCase()
230+
var p = archLower === 'x64' ? 'x64' :
231+
(archLower === 'arm' ? 'ARM' : 'Win32')
230232
argv.push('/p:Configuration=' + buildType + ';Platform=' + p)
231233
if (jobs) {
232234
var j = parseInt(jobs, 10)

0 commit comments

Comments
 (0)