From fef391360cfb470355cb6ec00f247ccbd885ef0e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 23 Mar 2017 17:45:21 -0700 Subject: [PATCH] Node: explicitly define Release and Debug builds, use build flags from build.yaml --- binding.gyp | 76 +++++++++++++------- templates/binding.gyp.template | 64 ++++++++++------- tools/run_tests/helper_scripts/build_node.sh | 3 +- 3 files changed, 94 insertions(+), 49 deletions(-) diff --git a/binding.gyp b/binding.gyp index 2ec57768ae7..f941dc75a94 100644 --- a/binding.gyp +++ b/binding.gyp @@ -47,9 +47,42 @@ # 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': { + 'Release': { + 'cflags': [ + '-O2', + ], + 'defines': [ + 'NDEBUG', + ], + }, + 'Debug': { + 'cflags': [ + '-O0', + ], + 'defines': [ + '_DEBUG', + 'DEBUG', + ], + }, + }, + 'cflags': [ + '-g', + '-Wall', + '-Wextra', + '-Werror', + '-Wno-long-long', + '-Wno-unused-parameter', + '-DOSATOMIC_USE_INLINED=1', + ], + 'ldflags': [ + '-g', + ], 'include_dirs': [ '.', 'include' @@ -63,6 +96,24 @@ 'GRPC_UV' ] }], + ['grpc_gcov=="true"', { + 'cflags': [ + '-O0', + '-fprofile-arcs', + '-ftest-coverage', + '-Wno-return-type', + ], + 'defines': [ + '_DEBUG', + 'DEBUG', + 'GPR_GCOV', + ], + 'ldflags': [ + '-fprofile-arcs', + '-ftest-coverage', + '-rdynamic', + ], + }], ['OS!="win" and runtime=="electron"', { "defines": [ 'OPENSSL_NO_THREADS' @@ -124,25 +175,8 @@ "ws2_32" ] }, { # OS != "win" - 'variables': { - 'config': '