aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/binding.gyp.template
diff options
context:
space:
mode:
Diffstat (limited to 'templates/binding.gyp.template')
-rw-r--r--templates/binding.gyp.template93
1 files changed, 60 insertions, 33 deletions
diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template
index 5e401e8977..55a91c5b93 100644
--- a/templates/binding.gyp.template
+++ b/templates/binding.gyp.template
@@ -41,17 +41,43 @@
{
'variables': {
'runtime%': 'node',
- # UV integration in C core is disabled by default while bugs are ironed
- # out. It can be re-enabled for one build by setting the npm config
- # variable grpc_uv to true, and it can be re-enabled permanently by
- # setting it to true here.
- 'grpc_uv%': 'false',
+ # UV integration in C core is enabled by default. It can be disabled
+ # by setting this argument to anything else.
+ 'grpc_uv%': 'true',
# Some Node installations use the system installation of OpenSSL, and on
# some systems, the system OpenSSL still does not have ALPN support. This
# will let users recompile gRPC to work without ALPN.
- 'grpc_alpn%': 'true'
+ 'grpc_alpn%': 'true',
+ # Indicates that the library should be built with gcov.
+ 'grpc_gcov%': 'false'
},
'target_defaults': {
+ 'configurations': {
+ % for name, args in configs.iteritems():
+ % if name in ['dbg', 'opt']:
+ '${{'dbg':'Debug', 'opt': 'Release'}[name]}': {
+ % for arg, prop in [('CPPFLAGS', 'cflags'), ('DEFINES', 'defines')]:
+ % if args.get(arg, None) is not None:
+ '${prop}': [
+ % for item in args.get(arg).split():
+ '${item}',
+ % endfor
+ ],
+ % endif
+ % endfor
+ },
+ % endif
+ % endfor
+ },
+ % for arg, prop in [('CPPFLAGS', 'cflags'), ('LDFLAGS', 'ldflags')]:
+ % if defaults['global'].get(arg, None) is not None:
+ '${prop}': [
+ % for item in defaults['global'].get(arg).split():
+ '${item}',
+ % endfor
+ ],
+ % endif
+ % endfor
'include_dirs': [
'.',
'include'
@@ -62,9 +88,23 @@
'conditions': [
['grpc_uv=="true"', {
'defines': [
+ 'GRPC_ARES=0',
+ # Disabling this while bugs are ironed out. Uncomment this to
+ # re-enable libuv integration in C core.
'GRPC_UV'
]
}],
+ ['grpc_gcov=="true"', {
+ % for arg, prop in [('CPPFLAGS', 'cflags'), ('DEFINES', 'defines'), ('LDFLAGS', 'ldflags')]:
+ % if configs['gcov'].get(arg, None) is not None:
+ '${prop}': [
+ % for item in configs['gcov'].get(arg).split():
+ '${item}',
+ % endfor
+ ],
+ % endif
+ % endfor
+ }],
['OS!="win" and runtime=="electron"', {
"defines": [
'OPENSSL_NO_THREADS'
@@ -107,7 +147,8 @@
}],
['OS == "win"', {
"include_dirs": [
- "third_party/zlib"
+ "third_party/zlib",
+ "third_party/cares/cares"
],
"defines": [
'_WIN32_WINNT=0x0600',
@@ -126,25 +167,9 @@
"ws2_32"
]
}, { # OS != "win"
- 'variables': {
- 'config': '<!(echo $CONFIG)',
- },
'include_dirs': [
- '<(node_root_dir)/deps/zlib'
- ],
- 'conditions': [
- ['config=="gcov"', {
- 'cflags': [
- '-ftest-coverage',
- '-fprofile-arcs',
- '-O0'
- ],
- 'ldflags': [
- '-ftest-coverage',
- '-fprofile-arcs'
- ]
- }
- ]
+ '<(node_root_dir)/deps/zlib',
+ '<(node_root_dir)/deps/cares/include'
]
}]
]
@@ -192,9 +217,10 @@
# the OpenSSL headers, from the downloaded Node development package,
# which is typically located in `.node-gyp` in your home directory.
'target_name': 'WINDOWS_BUILD_WARNING',
- 'actions': [
+ 'rules': [
{
- 'action_name': 'WINDOWS_BUILD_WARNING',
+ 'rule_name': 'WINDOWS_BUILD_WARNING',
+ 'extension': 'S',
'inputs': [
'package.json'
],
@@ -236,6 +262,13 @@
}]
],
'targets': [
+ <%
+ for lib in libs:
+ if 'grpc' in lib.transitive_deps or lib.name == 'grpc':
+ lib.deps.append('node_modules/cares/deps/cares/cares.gyp:cares')
+ for module in node_modules:
+ module.deps.append('node_modules/cares/deps/cares/cares.gyp:cares')
+ %>
% for module in node_modules:
% for lib in libs:
% if lib.name in module.transitive_deps and lib.name not in ('boringssl', 'z'):
@@ -274,16 +307,10 @@
],
'cflags': [
'-std=c++11',
- '-Wall',
'-pthread',
- '-g',
'-zdefs',
- '-Werror',
'-Wno-error=deprecated-declarations'
],
- 'ldflags': [
- '-g'
- ],
"conditions": [
['OS=="win" or runtime=="electron"', {
'dependencies': [