You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by gu...@apache.org on 2022/02/17 11:15:21 UTC
[pulsar-client-node] branch master updated: Fixed windows install client (#194)
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 d2c0d1e Fixed windows install client (#194)
d2c0d1e is described below
commit d2c0d1e374f8e9f25934bd679436da0872b6bc8e
Author: Guangning E <gu...@apache.org>
AuthorDate: Thu Feb 17 19:09:25 2022 +0800
Fixed windows install client (#194)
* Support for specified architectures
---
README.md | 19 ++++++++++++++++++-
binding.gyp | 21 +++++++++++----------
2 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 5b8593a..57ee0fd 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,17 @@ If an incompatible version of the C++ client is installed, you may fail to build
### Install on windows
-1. [Build the Pulsar C++ client on windows](https://pulsar.apache.org/docs/en/next/client-libraries-cpp/).
+1. Build the Pulsar C++ client on windows.
+
+```shell
+cmake \
+ -A x64 \
+ -DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF \
+ -DVCPKG_TRIPLET=x64-windows \
+ -DCMAKE_BUILD_TYPE=Release \
+ -S .
+cmake --config Release
+```
2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a Windows command tool.
@@ -63,6 +73,13 @@ If an incompatible version of the C++ client is installed, you may fail to build
set PULSAR_CPP_DIR=C:\pulsar\pulsar-client-cpp
```
+3. Set the variable `OS_ARCH` in a Windows command tool, `OS_ARCH` is related to the configuration of VCPKG_TRIPLET on the command line above.(Optional)
+
+```shell
+set OS_ARCH=x64-windows
+```
+
+
### Install pulsar-client to your project
```shell
diff --git a/binding.gyp b/binding.gyp
index a524f19..03dd8b5 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -22,6 +22,7 @@
['OS=="win"', {
'variables': {
'pulsar_cpp_dir%': '<!(echo %PULSAR_CPP_DIR%)',
+ 'os_arch%': '<!(echo %OS_ARCH%)',
},
}]
],
@@ -54,7 +55,7 @@
"<(pulsar_cpp_dir)\include",
],
"libraries": [
- "-l<(pulsar_cpp_dir)\\build\lib\Release\pulsar.lib"
+ "-l<(pulsar_cpp_dir)\\lib\Release\pulsar.lib"
],
"dependencies": [
"<!(node -p \"require('node-addon-api').gyp\")"
@@ -63,15 +64,15 @@
{
"destination": "<(PRODUCT_DIR)",
"files": [
- "<(pulsar_cpp_dir)\\build\lib\Release\pulsar.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libcurl.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libprotobuf.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libssl-1_1-x64.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libcrypto-1_1-x64.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\dl.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\snappy.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\zlib1.dll",
- "<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\zstd.dll",
+ "<(pulsar_cpp_dir)\\lib\Release\pulsar.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libcurl.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libprotobuf.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libssl-1_1-x64.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libcrypto-1_1-x64.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\dl.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\snappy.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\zlib1.dll",
+ "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\zstd.dll",
]
}
]