This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
     new bd04459  Fixed pulsar client node mac install script (#196)
bd04459 is described below

commit bd04459bf747920a606586f09db98f21274e22a9
Author: Guangning E <[email protected]>
AuthorDate: Mon Feb 28 09:55:17 2022 +0800

    Fixed pulsar client node mac install script (#196)
    
    * Fixed pulsar client node mac install script
---
 README.md   | 23 +++++++++++++++++++++++
 binding.gyp | 13 +++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/README.md b/README.md
index 57ee0fd..cafc5c9 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,7 @@ cmake \
 cmake --config Release
 ```
 
+
 2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a 
Windows command tool.
 
 ```shell
@@ -79,6 +80,28 @@ set PULSAR_CPP_DIR=C:\pulsar\pulsar-client-cpp
 set OS_ARCH=x64-windows
 ```
 
+### Install on mac
+
+1. Install the Pulsar C++ client on mac.
+
+```shell
+brew install libpulsar
+```
+
+2. Get the installation path of libpulsar
+
+```shell
+brew info libpulsar
+```
+
+
+2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a 
mac command tool.
+
+```shell
+# for example
+export PULSAR_CPP_DIR=/usr/local/Cellar/libpulsar/2.9.1_1
+```
+
 
 ### Install pulsar-client to your project
 
diff --git a/binding.gyp b/binding.gyp
index 03dd8b5..68629b1 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -24,6 +24,11 @@
        'pulsar_cpp_dir%': '<!(echo %PULSAR_CPP_DIR%)',
        'os_arch%': '<!(echo %OS_ARCH%)',
       },
+    }],
+    ['OS=="mac"', {
+      'variables': {
+        'pulsar_cpp_dir': '<!(echo $PULSAR_CPP_DIR)'
+      }
     }]
   ],
   "targets": [
@@ -50,6 +55,14 @@
         "src/ReaderConfig.cc",
       ],
       'conditions': [
+        ['OS=="mac"', {
+          "include_dirs": [
+            "<(pulsar_cpp_dir)/include",
+          ],
+          "libraries": [
+            "<(pulsar_cpp_dir)/lib/libpulsar.dylib"
+          ],
+        }],
         ['OS=="win"', {
           "include_dirs": [
             "<(pulsar_cpp_dir)\include",

Reply via email to