aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/binding.gyp
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/binding.gyp')
-rw-r--r--src/node/binding.gyp52
1 files changed, 38 insertions, 14 deletions
diff --git a/src/node/binding.gyp b/src/node/binding.gyp
index 83f72fabca..e0220397d6 100644
--- a/src/node/binding.gyp
+++ b/src/node/binding.gyp
@@ -16,14 +16,45 @@
'ldflags': [
'-g'
],
- 'link_settings': {
- 'libraries': [
- '-lpthread',
- '-lgrpc',
- '-lgpr'
- ]
- },
"conditions": [
+ ['OS != "win"', {
+ 'variables': {
+ 'has_pkg_config': '<!(command -v pkg-config >/dev/null 2>&1 && echo true || echo false)'
+ },
+ 'conditions': [
+ ['has_pkg_config == "true"', {
+ 'link_settings': {
+ 'libraries': [
+ '<!@(pkg-config --libs-only-l grpc)'
+ ]
+ },
+ 'cflags': [
+ '<!@(pkg-config --cflags grpc)'
+ ],
+ 'libraries': [
+ '<!@(pkg-config --libs-only-L 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 +63,6 @@
'-stdlib=libc++'
]
}
- }],
- ['OS != "mac"', {
- 'link_settings': {
- 'libraries': [
- '-lrt'
- ]
- }
}]
],
"target_name": "grpc",