diff options
Diffstat (limited to 'src/node/binding.gyp')
-rw-r--r-- | src/node/binding.gyp | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/src/node/binding.gyp b/src/node/binding.gyp index 83f72fabca..6ba233388a 100644 --- a/src/node/binding.gyp +++ b/src/node/binding.gyp @@ -10,20 +10,54 @@ '-pthread', '-pedantic', '-g', - '-zdefs' + '-zdefs', '-Werror' ], 'ldflags': [ '-g' ], - 'link_settings': { - 'libraries': [ - '-lpthread', - '-lgrpc', - '-lgpr' - ] - }, "conditions": [ + ['OS != "win"', { + 'variables': { + 'pkg_config_grpc': '<!(pkg-config --exists grpc >/dev/null 2>&1 && echo true || echo false)' + }, + 'conditions': [ + ['pkg_config_grpc == "true"', { + 'link_settings': { + 'libraries': [ + '<!@(pkg-config --libs-only-l --static grpc)' + ] + }, + 'cflags': [ + '<!@(pkg-config --cflags grpc)' + ], + 'libraries': [ + '<!@(pkg-config --libs-only-L --static grpc)' + ], + 'ldflags': [ + '<!@(pkg-config --libs-only-other --static grpc)' + ] + }, { + 'link_settings': { + 'libraries': [ + '-lpthread', + '-lgrpc', + '-lgpr' + ], + }, + 'conditions':[ + ['OS != "mac"', { + 'link_settings': { + 'libraries': [ + '-lrt' + ] + } + }] + ] + } + ] + ] + }], ['OS == "mac"', { 'xcode_settings': { 'MACOSX_DEPLOYMENT_TARGET': '10.9', @@ -32,13 +66,6 @@ '-stdlib=libc++' ] } - }], - ['OS != "mac"', { - 'link_settings': { - 'libraries': [ - '-lrt' - ] - } }] ], "target_name": "grpc", |