aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/binding.gyp.template
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2017-03-23 17:45:21 -0700
committerGravatar murgatroid99 <mlumish@google.com>2017-03-23 17:45:21 -0700
commitfef391360cfb470355cb6ec00f247ccbd885ef0e (patch)
tree8302500901f1342f5c45c5df945d4a1e63fca101 /templates/binding.gyp.template
parent6f1e443a519cd28d97be78c5ca2ca72a45f6b598 (diff)
Node: explicitly define Release and Debug builds, use build flags from build.yaml
Diffstat (limited to 'templates/binding.gyp.template')
-rw-r--r--templates/binding.gyp.template64
1 files changed, 40 insertions, 24 deletions
diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template
index 5e401e8977..3ad99ec22c 100644
--- a/templates/binding.gyp.template
+++ b/templates/binding.gyp.template
@@ -49,9 +49,37 @@
# 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'
@@ -65,6 +93,17 @@
'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'
@@ -126,25 +165,8 @@
"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'
- ]
- }
- ]
]
}]
]
@@ -274,16 +296,10 @@
],
'cflags': [
'-std=c++11',
- '-Wall',
'-pthread',
- '-g',
'-zdefs',
- '-Werror',
'-Wno-error=deprecated-declarations'
],
- 'ldflags': [
- '-g'
- ],
"conditions": [
['OS=="win" or runtime=="electron"', {
'dependencies': [