Skip to content

Commit d2c0d1e

Browse files
authored
Fixed windows install client (#194)
* Support for specified architectures
1 parent f696d2f commit d2c0d1e

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@ If an incompatible version of the C++ client is installed, you may fail to build
5454

5555
### Install on windows
5656

57-
1. [Build the Pulsar C++ client on windows](https://pulsar.apache.org/docs/en/next/client-libraries-cpp/).
57+
1. Build the Pulsar C++ client on windows.
58+
59+
```shell
60+
cmake \
61+
-A x64 \
62+
-DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF \
63+
-DVCPKG_TRIPLET=x64-windows \
64+
-DCMAKE_BUILD_TYPE=Release \
65+
-S .
66+
cmake --config Release
67+
```
5868

5969
2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a Windows command tool.
6070

@@ -63,6 +73,13 @@ If an incompatible version of the C++ client is installed, you may fail to build
6373
set PULSAR_CPP_DIR=C:\pulsar\pulsar-client-cpp
6474
```
6575

76+
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)
77+
78+
```shell
79+
set OS_ARCH=x64-windows
80+
```
81+
82+
6683
### Install pulsar-client to your project
6784

6885
```shell

binding.gyp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
['OS=="win"', {
2323
'variables': {
2424
'pulsar_cpp_dir%': '<!(echo %PULSAR_CPP_DIR%)',
25+
'os_arch%': '<!(echo %OS_ARCH%)',
2526
},
2627
}]
2728
],
@@ -54,7 +55,7 @@
5455
"<(pulsar_cpp_dir)\include",
5556
],
5657
"libraries": [
57-
"-l<(pulsar_cpp_dir)\\build\lib\Release\pulsar.lib"
58+
"-l<(pulsar_cpp_dir)\\lib\Release\pulsar.lib"
5859
],
5960
"dependencies": [
6061
"<!(node -p \"require('node-addon-api').gyp\")"
@@ -63,15 +64,15 @@
6364
{
6465
"destination": "<(PRODUCT_DIR)",
6566
"files": [
66-
"<(pulsar_cpp_dir)\\build\lib\Release\pulsar.dll",
67-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libcurl.dll",
68-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libprotobuf.dll",
69-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libssl-1_1-x64.dll",
70-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\libcrypto-1_1-x64.dll",
71-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\dl.dll",
72-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\snappy.dll",
73-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\zlib1.dll",
74-
"<(pulsar_cpp_dir)\\vcpkg_installed\\x64-windows\\bin\zstd.dll",
67+
"<(pulsar_cpp_dir)\\lib\Release\pulsar.dll",
68+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libcurl.dll",
69+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libprotobuf.dll",
70+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libssl-1_1-x64.dll",
71+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libcrypto-1_1-x64.dll",
72+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\dl.dll",
73+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\snappy.dll",
74+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\zlib1.dll",
75+
"<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\zstd.dll",
7576
]
7677
}
7778
]

0 commit comments

Comments
 (0)