Skip to content

Commit a04ea30

Browse files
kunalspathakbnoordhuis
authored andcommitted
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. PR-URL: #873 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 93d7fa8 commit a04ea30

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

addon.gypi

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
{
2+
'variables' : {
3+
'node_engine_include_dir%': 'deps/v8/include',
4+
},
25
'target_defaults': {
36
'type': 'loadable_module',
47
'win_delay_load_hook': 'true',
58
'product_prefix': '',
69

10+
'conditions': [
11+
[ 'node_engine=="chakracore"', {
12+
'variables': {
13+
'node_engine_include_dir%': 'deps/chakrashim/include'
14+
},
15+
}]
16+
],
17+
718
'include_dirs': [
819
'<(node_root_dir)/include/node',
920
'<(node_root_dir)/src',
1021
'<(node_root_dir)/deps/uv/include',
11-
'<(node_root_dir)/deps/v8/include'
22+
'<(node_root_dir)/<(node_engine_include_dir)'
1223
],
1324
'defines!': [
1425
'BUILDING_UV_SHARED=1', # Inherited from common.gypi.
@@ -79,6 +90,12 @@
7990
],
8091
}],
8192
[ 'OS=="win"', {
93+
'conditions': [
94+
['node_engine=="chakracore"', {
95+
'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
96+
'libraries': [ '<@(node_engine_libs)' ],
97+
}],
98+
],
8299
'libraries': [
83100
'-lkernel32.lib',
84101
'-luser32.lib',

gyp/pylib/gyp/generator/msvs.py

+5
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

+2
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ 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=' +
276+
(gyp.opts.node_engine || process.jsEngine || 'v8'))
275277
argv.push('--depth=.')
276278
argv.push('--no-parallel')
277279

0 commit comments

Comments
 (0)