Skip to content

Commit 7e56293

Browse files
committed
gyp: Add support to build node.js with chakracore
Microsoft's chakracore engine is dependent on Windows SDK, and build tools should know the version installed on user machine. This change adds those dependencies in node-gyp tools. Below is the summary: * Configure msvs_windows_target_platform_version to use the right Windows SDK. * Configure msvs_use_library_dependency_inputs to export symbols correctly (otherwise functions not used by node.exe but might be needed by native addon modules could be optimized away by linker). These changes were originally made in nodejs/node#4765, but as @shigeki mentioned, it was more sensible to send these changes as PR to node-gyp repo.
1 parent ff9a6fa commit 7e56293

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

addon.gypi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'<(node_root_dir)/include/node',
99
'<(node_root_dir)/src',
1010
'<(node_root_dir)/deps/uv/include',
11-
'<(node_root_dir)/deps/v8/include'
11+
'<(node_root_dir)/<(node_engine_include_dir)'
1212
],
1313
'defines!': [
1414
'BUILDING_UV_SHARED=1', # Inherited from common.gypi.
@@ -79,6 +79,12 @@
7979
],
8080
}],
8181
[ 'OS=="win"', {
82+
'conditions': [
83+
['node_engine=="chakracore"', {
84+
'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
85+
'libraries': [ '<@(node_engine_libs)' ],
86+
}],
87+
],
8288
'libraries': [
8389
'-lkernel32.lib',
8490
'-luser32.lib',

gyp/pylib/gyp/generator/msvs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
338338
command = ['type']
339339
else:
340340
command = [cmd[0].replace('/', '\\')]
341+
if quote_cmd:
342+
command = ['"%s"' % i for i in command]
341343
# Add call before command to ensure that commands can be tied together one
342344
# after the other without aborting in Incredibuild, since IB makes a bat
343345
# file out of the raw command string, and some commands (like python) are
@@ -3209,6 +3211,9 @@ def _GetMSBuildProjectReferences(project):
32093211
['ReferenceOutputAssembly', 'false']
32103212
]
32113213
for config in dependency.spec.get('configurations', {}).itervalues():
3214+
if config.get('msvs_use_library_dependency_inputs', 0):
3215+
project_ref.append(['UseLibraryDependencyInputs', 'true'])
3216+
break
32123217
# If it's disabled in any config, turn it off in the reference.
32133218
if config.get('msvs_2010_disable_uldi_when_referenced', 0):
32143219
project_ref.append(['UseLibraryDependencyInputs', 'false'])

lib/configure.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ function configure (gyp, argv, callback) {
272272
argv.push('-Dnode_gyp_dir=' + nodeGypDir)
273273
argv.push('-Dnode_lib_file=' + release.name + '.lib')
274274
argv.push('-Dmodule_root_dir=' + process.cwd())
275+
argv.push('-Dnode_engine=' + (gyp.opts.node_engine || process.jsEngine || 'v8'))
275276
argv.push('--depth=.')
276277
argv.push('--no-parallel')
277278

0 commit comments

Comments
 (0)