BewareMyPower opened a new pull request, #73:
URL: https://github.com/apache/pulsar-client-cpp/pull/73

   ### Motivation
   
   Currently it's impossible to build Pulsar C++ client on Windows with 
`LINK_STATIC=ON`. It means users have to package all 3rd-party DLLs as well as 
`pulsar.dll`, which harms the experience.
   
   ### Modifications
   
   Enable `LINK_STATIC` when the Vcpkg triplet is `xxx-static`. In this case, 
find the 3rd party libraries with correct names on Windows. And replace 
`Threads::Threads` with `CMAKE_THREAD_LIB_INIT`.
   
   The most important change is replacing the `/MD` compile option with `/MT`. 
It should have been done by setting the
   
[`MSVC_RUNTIME_LIBRARY`](https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html)
 property, but it seems not work. So this PR just modifies the 
`CMAKE_CXX_FLAGS_<CONFIG>` variables.
   
   For `pulsarWithAllDeps.lib`, add the actual library (`*.lib`) to 
`COMMON_LIBS` instead of the target name (`dlfcn-win32::dl`).
   
   Some warnings on Windows caused by incorrect compile options are fixed as 
well.
   
   A workflow is added to verify the static build for x64 and x86 Windows. And 
a simple example is added as `win-examples` to show the `pulsarWithAllDeps.lib` 
can be linked without any other dependency to run an executable.
   
   ### TODO
   
   - Add the workflow to build Windows releases when pushing a tag
   - Support debug building with `LINK_STATIC=ON`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to