Node: explicitly define Release and Debug builds, use build flags from build.yaml
This commit is contained in:
parent
6f1e443a51
commit
fef391360c
76
binding.gyp
76
binding.gyp
|
|
@ -47,9 +47,42 @@
|
||||||
# Some Node installations use the system installation of OpenSSL, and on
|
# Some Node installations use the system installation of OpenSSL, and on
|
||||||
# some systems, the system OpenSSL still does not have ALPN support. This
|
# some systems, the system OpenSSL still does not have ALPN support. This
|
||||||
# will let users recompile gRPC to work without ALPN.
|
# 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': {
|
'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_dirs': [
|
||||||
'.',
|
'.',
|
||||||
'include'
|
'include'
|
||||||
|
|
@ -63,6 +96,24 @@
|
||||||
'GRPC_UV'
|
'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"', {
|
['OS!="win" and runtime=="electron"', {
|
||||||
"defines": [
|
"defines": [
|
||||||
'OPENSSL_NO_THREADS'
|
'OPENSSL_NO_THREADS'
|
||||||
|
|
@ -124,25 +175,8 @@
|
||||||
"ws2_32"
|
"ws2_32"
|
||||||
]
|
]
|
||||||
}, { # OS != "win"
|
}, { # OS != "win"
|
||||||
'variables': {
|
|
||||||
'config': '<!(echo $CONFIG)',
|
|
||||||
},
|
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'<(node_root_dir)/deps/zlib'
|
'<(node_root_dir)/deps/zlib'
|
||||||
],
|
|
||||||
'conditions': [
|
|
||||||
['config=="gcov"', {
|
|
||||||
'cflags': [
|
|
||||||
'-ftest-coverage',
|
|
||||||
'-fprofile-arcs',
|
|
||||||
'-O0'
|
|
||||||
],
|
|
||||||
'ldflags': [
|
|
||||||
'-ftest-coverage',
|
|
||||||
'-fprofile-arcs'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
|
|
@ -851,16 +885,10 @@
|
||||||
],
|
],
|
||||||
'cflags': [
|
'cflags': [
|
||||||
'-std=c++11',
|
'-std=c++11',
|
||||||
'-Wall',
|
|
||||||
'-pthread',
|
'-pthread',
|
||||||
'-g',
|
|
||||||
'-zdefs',
|
'-zdefs',
|
||||||
'-Werror',
|
|
||||||
'-Wno-error=deprecated-declarations'
|
'-Wno-error=deprecated-declarations'
|
||||||
],
|
],
|
||||||
'ldflags': [
|
|
||||||
'-g'
|
|
||||||
],
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
['OS=="win" or runtime=="electron"', {
|
['OS=="win" or runtime=="electron"', {
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,37 @@
|
||||||
# Some Node installations use the system installation of OpenSSL, and on
|
# Some Node installations use the system installation of OpenSSL, and on
|
||||||
# some systems, the system OpenSSL still does not have ALPN support. This
|
# some systems, the system OpenSSL still does not have ALPN support. This
|
||||||
# will let users recompile gRPC to work without ALPN.
|
# 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': {
|
'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_dirs': [
|
||||||
'.',
|
'.',
|
||||||
'include'
|
'include'
|
||||||
|
|
@ -65,6 +93,17 @@
|
||||||
'GRPC_UV'
|
'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"', {
|
['OS!="win" and runtime=="electron"', {
|
||||||
"defines": [
|
"defines": [
|
||||||
'OPENSSL_NO_THREADS'
|
'OPENSSL_NO_THREADS'
|
||||||
|
|
@ -126,25 +165,8 @@
|
||||||
"ws2_32"
|
"ws2_32"
|
||||||
]
|
]
|
||||||
}, { # OS != "win"
|
}, { # OS != "win"
|
||||||
'variables': {
|
|
||||||
'config': '<!(echo $CONFIG)',
|
|
||||||
},
|
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'<(node_root_dir)/deps/zlib'
|
'<(node_root_dir)/deps/zlib'
|
||||||
],
|
|
||||||
'conditions': [
|
|
||||||
['config=="gcov"', {
|
|
||||||
'cflags': [
|
|
||||||
'-ftest-coverage',
|
|
||||||
'-fprofile-arcs',
|
|
||||||
'-O0'
|
|
||||||
],
|
|
||||||
'ldflags': [
|
|
||||||
'-ftest-coverage',
|
|
||||||
'-fprofile-arcs'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
|
|
@ -274,16 +296,10 @@
|
||||||
],
|
],
|
||||||
'cflags': [
|
'cflags': [
|
||||||
'-std=c++11',
|
'-std=c++11',
|
||||||
'-Wall',
|
|
||||||
'-pthread',
|
'-pthread',
|
||||||
'-g',
|
|
||||||
'-zdefs',
|
'-zdefs',
|
||||||
'-Werror',
|
|
||||||
'-Wno-error=deprecated-declarations'
|
'-Wno-error=deprecated-declarations'
|
||||||
],
|
],
|
||||||
'ldflags': [
|
|
||||||
'-g'
|
|
||||||
],
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
['OS=="win" or runtime=="electron"', {
|
['OS=="win" or runtime=="electron"', {
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,8 @@ CONFIG=${CONFIG:-opt}
|
||||||
cd $(dirname $0)/../../..
|
cd $(dirname $0)/../../..
|
||||||
|
|
||||||
case "$CONFIG" in
|
case "$CONFIG" in
|
||||||
'dbg') config_flag='--debug' ;;
|
'dbg') config_flags='--debug' ;;
|
||||||
|
'gcov') config_flags="--debug --grpc_gcov=true" ;;
|
||||||
*) config_flag='--release' ;;
|
*) config_flag='--release' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue