BewareMyPower opened a new pull request #11302:
URL: https://github.com/apache/pulsar/pull/11302


   Fixes #11081
   
   ### Motivation
   
   The current `CMakeLists.txt` doesn't work well for Windows build. If the 
dependencies were installed by Vcpkg, CMake would always find the release 
version libraries under `vcpkg_installed/<triplet>/lib` and could not find the 
debug version libraries under `vcpkg_installed/<triplet>/debug/lib`. If 
`pulsar.dll` was built in release mode while the application was built in debug 
mode, some link errors might happen.
   
   ### Modifications
   
   Use `find_package` with config mode to find curl and protobuf instead of 
`find_library` with the explicit library names.  For example, after Protobuf 
was found successfully, the `Protobuf_LITE_LIBRARIES` would be set with
   
   > 
optimized;./vcpkg_installed/x64-windows/bin/libprotobuf-lite.dll;debug;./vcpkg_installed/x64-windows/debug/bin/libprotobuf-lited.dll
   
   ZLIB and OpenSSL don't support config mode for `find_package`, so here we 
set hint path like `ZLIB_ROOT` to force CMake find debug version libraries when 
`CMAKE_BUILD_TYPE` is `Debug`.
   
   For ZSTD and Snappy, use the correct name for MSVC with Debug mode. 
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   It's hard to test in CI because it's something with linking in runtime. We 
can test the fixed CMakeLists.txt on Windows local machine with Visual Studio 
2017 x64 compiler tools CMD window.
   
   ```bash
   vcpkg install --feature-flags=manifests --triplet x64-windows
   cmake -B ./build -A x64 -DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF 
-DVCPKG_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=Debug -S .
   cmake --build ./build --config Debug
   set 
PATH=%CD%\vcpkg_installed\x64-windows\debug\bin;%CD%\build\lib\Debug;%PATH%
   ```


-- 
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