diff options
-rw-r--r-- | binding.gyp | 82 | ||||
-rw-r--r-- | templates/binding.gyp.template | 68 |
2 files changed, 50 insertions, 100 deletions
diff --git a/binding.gyp b/binding.gyp index 70dfd102b1..0b581b356c 100644 --- a/binding.gyp +++ b/binding.gyp @@ -67,6 +67,14 @@ 'ldflags': [ '-g', ], + 'cflags_c': [ + '-Werror', + '-std=c99' + ], + 'cflags_cc': [ + '-Werror', + '-std=c++11' + ], 'include_dirs': [ '.', 'include' @@ -164,6 +172,24 @@ '<(node_root_dir)/deps/zlib', '<(node_root_dir)/deps/cares/include' ] + }], + ['OS == "mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9' + }, + 'OTHER_CFLAGS': [ + '-g', + '-Wall', + '-Wextra', + '-Werror', + '-Wno-long-long', + '-Wno-unused-parameter', + '-DOSATOMIC_USE_INLINED=1', + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], }] ] }, @@ -171,12 +197,6 @@ ['OS=="win" or runtime=="electron"', { 'targets': [ { - 'cflags': [ - '-std=c++11', - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': 'boringssl', 'product_prefix': 'lib', 'type': 'static_library', @@ -488,17 +508,6 @@ 'third_party/boringssl/ssl/tls_method.c', 'third_party/boringssl/ssl/tls_record.c', ], - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9', - 'OTHER_CPLUSPLUSFLAGS': [ - '-stdlib=libc++', - '-std=c++11' - ], - } - }], - ], }, ], }], @@ -536,11 +545,6 @@ 'targets': [ # Only want to compile zlib under Windows { - 'cflags': [ - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': 'z', 'product_prefix': 'lib', 'type': 'static_library', @@ -569,11 +573,6 @@ ], 'targets': [ { - 'cflags': [ - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': 'gpr', 'product_prefix': 'lib', 'type': 'static_library', @@ -627,20 +626,8 @@ 'src/core/lib/support/tmpfile_windows.c', 'src/core/lib/support/wrap_memcpy.c', ], - "conditions": [ - ['OS == "mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9' - } - }] - ] }, { - 'cflags': [ - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': 'grpc', 'product_prefix': 'lib', 'type': 'static_library', @@ -898,20 +885,12 @@ 'src/core/ext/filters/workarounds/workaround_utils.c', 'src/core/plugin_registry/grpc_plugin_registry.c', ], - "conditions": [ - ['OS == "mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9' - } - }] - ] }, { 'include_dirs': [ "<!(node -e \"require('nan')\")" ], 'cflags': [ - '-std=c++11', '-pthread', '-zdefs', '-Wno-error=deprecated-declarations' @@ -922,15 +901,6 @@ "boringssl", ] }], - ['OS=="mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9', - 'OTHER_CFLAGS': [ - '-stdlib=libc++', - '-std=c++11' - ] - } - }], ['OS=="win"', { 'dependencies': [ "z", diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index b304011fdc..b7560fe7df 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -64,6 +64,14 @@ ], % endif % endfor + 'cflags_c': [ + '-Werror', + '-std=c99' + ], + 'cflags_cc': [ + '-Werror', + '-std=c++11' + ], 'include_dirs': [ '.', 'include' @@ -154,6 +162,22 @@ '<(node_root_dir)/deps/zlib', '<(node_root_dir)/deps/cares/include' ] + }], + ['OS == "mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9' + }, + % if defaults['global'].get('CPPFLAGS', None) is not None: + 'OTHER_CFLAGS': [ + % for item in defaults['global'].get('CPPFLAGS').split(): + '${item}', + % endfor + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], + % endif }] ] }, @@ -164,12 +188,6 @@ % for lib in libs: % if lib.name in module.transitive_deps and lib.name == 'boringssl': { - 'cflags': [ - '-std=c++11', - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': '${lib.name}', 'product_prefix': 'lib', 'type': 'static_library', @@ -183,17 +201,6 @@ '${source}', % endfor ], - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9', - 'OTHER_CPLUSPLUSFLAGS': [ - '-stdlib=libc++', - '-std=c++11' - ], - } - }], - ], }, % endif % endfor @@ -237,11 +244,6 @@ % for lib in libs: % if lib.name in module.transitive_deps and lib.name == 'z': { - 'cflags': [ - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': '${lib.name}', 'product_prefix': 'lib', 'type': 'static_library', @@ -267,11 +269,6 @@ % for lib in libs: % if lib.name in module.transitive_deps and lib.name not in ('boringssl', 'z'): { - 'cflags': [ - '-std=c99', - '-Wall', - '-Werror' - ], 'target_name': '${lib.name}', 'product_prefix': 'lib', 'type': 'static_library', @@ -285,13 +282,6 @@ '${source}', % endfor ], - "conditions": [ - ['OS == "mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9' - } - }] - ] }, % endif % endfor @@ -300,7 +290,6 @@ "<!(node -e \"require('nan')\")" ], 'cflags': [ - '-std=c++11', '-pthread', '-zdefs', '-Wno-error=deprecated-declarations' @@ -315,15 +304,6 @@ % endfor ] }], - ['OS=="mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET': '10.9', - 'OTHER_CFLAGS': [ - '-stdlib=libc++', - '-std=c++11' - ] - } - }], ['OS=="win"', { 'dependencies': [ % for dep in getattr(module, 'deps', []): |