You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#7
### Motivation
The Python client cannot be built with MSVC.
### Modifications
Add `vcpkg.json` to download the Boost.Python dependency. Then fix some
CMake errors:
1. Boost.Python cannot be found on Windows. The component of Boost
cannot be `python3`. It should be a specific version like
`python310`.
2. Link to `pulsarWithDeps.lib` for MSVC and modify the compilation
option from `/MD` to `/MT` when `LINK_STATIC` is `ON`.
3. When `LINK_STATIC` is `OFF` (by default), remove the suffix of the
name because CMake will find the correct suffixes on different
platforms.
4. Add the Python3 library to the target on Windows, otherwise the
symbols cannot be found.
Since Python on Windows can only recognize `*.pyd` suffix of a C
extension, change the `CMAKE_SHARED_LIBRARY_SUFFIX` and use
`_pulsar.pyd` in `setup.py` on Windows.
Add README to tell users how to build Python client on Windows.
### TODO
Add a GitHub Actions workflow to verify the Windows build.
> NOTE: For Windows 32-bit library, change `x64-windows` to `x86-windows`, see [here](https://github.com/microsoft/vcpkg/tree/master/triplets) for all available triplets.
43
+
44
+
Then, build and install the Python wheel.
45
+
46
+
```PowerShell
47
+
# Assuming the Pulsar C++ client has been installed under the `PULSAR_CPP` directory.
Since the Python client links to Boost.Python dynamically, you have to copy the dll (e.g. `boost_python310-vc142-mt-x64-1_80.dll`) into the system path (the `PATH` environment variable). If the `-DLINK_STATIC=ON` option is not specified, you have to copy the `pulsar.dll` into the system path as well.
56
+
57
+
### Linux or macOS
58
+
59
+
Assuming the Pulsar C++ client and Boost.Python have been installed under the system path.
> 1. Here a separate `build` directory is created to store all CMake temporary files. However, the `setup.py` requires the `_pulsar.so` is under the project directory.
46
72
> 2. Add the `--force-reinstall` option to overwrite the existing Python wheel in case your system has already installed a wheel before.
47
73
74
+
## Running examples
75
+
48
76
You can run `python3 -c 'import pulsar'` to see whether the wheel has been installed successfully. If it failed, check whether dependencies (e.g. `libpulsar.so`) are in the system path. If not, make sure the dependencies are in `LD_LIBRARY_PATH` (on Linux) or `DYLD_LIBRARY_PATH` (on macOS).
49
77
50
78
Then you can run examples as a simple end-to-end test.
0 commit comments