Skip to content

Commit

Permalink
Add support to build node.js with chakracore for ARM.
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kunalspathak authored and bnoordhuis committed Feb 15, 2017
1 parent a04ea30 commit ec5fc36
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
32 changes: 32 additions & 0 deletions gyp/pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec5fc36

Please sign in to comment.