From ec5fc36a80ea1e98eac1f490545ccb4e71fce846 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Wed, 27 Jan 2016 12:40:02 -0800 Subject: [PATCH] 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: https://github.com/nodejs/node-gyp/pull/873 Reviewed-By: Ben Noordhuis --- gyp/pylib/gyp/generator/msvs.py | 32 ++++++++++++++++++++++++++++++++ lib/build.js | 4 +++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/gyp/pylib/gyp/generator/msvs.py b/gyp/pylib/gyp/generator/msvs.py index 29c0cea5d7..2b3ae19b0c 100644 --- a/gyp/pylib/gyp/generator/msvs.py +++ b/gyp/pylib/gyp/generator/msvs.py @@ -285,6 +285,22 @@ def _ConfigFullName(config_name, config_data): return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name) +def _ConfigWindowsTargetPlatformVersion(config_data): + ver = config_data.get('msvs_windows_target_platform_version') + if not ver or re.match(r'^\d+', ver): + return ver + for key in [r'HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s', + r'HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s']: + sdkdir = MSVSVersion._RegistryGetValue(key % ver, 'InstallationFolder') + if not sdkdir: + continue + version = MSVSVersion._RegistryGetValue(key % ver, 'ProductVersion') or '' + # find a matching entry in sdkdir\include + names = sorted([x for x in os.listdir(r'%s\include' % sdkdir) \ + if x.startswith(version)], reverse = True) + return names[0] + + def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, quote_cmd, do_setup_env): @@ -2664,6 +2680,22 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name): else: properties[0].append(['ApplicationType', 'Windows Store']) + platform_name = None + msvs_windows_target_platform_version = None + for configuration in spec['configurations'].itervalues(): + platform_name = platform_name or _ConfigPlatform(configuration) + msvs_windows_target_platform_version = \ + msvs_windows_target_platform_version or \ + _ConfigWindowsTargetPlatformVersion(configuration) + if platform_name and msvs_windows_target_platform_version: + break + + if platform_name == 'ARM': + properties[0].append(['WindowsSDKDesktopARMSupport', 'true']) + if msvs_windows_target_platform_version: + properties[0].append(['WindowsTargetPlatformVersion', \ + str(msvs_windows_target_platform_version)]) + return properties def _GetMSBuildConfigurationDetails(spec, build_file): diff --git a/lib/build.js b/lib/build.js index 22f2583694..0374fbc810 100644 --- a/lib/build.js +++ b/lib/build.js @@ -226,7 +226,9 @@ function build (gyp, argv, callback) { // Specify the build type, Release by default if (win) { - var p = arch === 'x64' ? 'x64' : 'Win32' + var archLower = arch.toLowerCase() + var p = archLower === 'x64' ? 'x64' : + (archLower === 'arm' ? 'ARM' : 'Win32') argv.push('/p:Configuration=' + buildType + ';Platform=' + p) if (jobs) { var j = parseInt(jobs, 10)