-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] Support Windows Debug mode build #11302
Merged
merlimat
merged 13 commits into
apache:master
from
BewareMyPower:bewaremypower/cpp-debug-mode
Jul 13, 2021
Merged
[C++] Support Windows Debug mode build #11302
merlimat
merged 13 commits into
apache:master
from
BewareMyPower:bewaremypower/cpp-debug-mode
Jul 13, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BewareMyPower
added
area/build
component/c++
doc-not-needed
Your PR changes do not impact docs
labels
Jul 13, 2021
BewareMyPower
requested review from
merlimat,
aahmed-se,
codelipenghui,
jiazhai,
rdhabalia and
sijie
July 13, 2021 09:26
It looks like CMakeLists.txt is not compatible with apachepulsar/pulsar-build:manylinux-cp37-cp37m image, I'll fix it soon. |
BewareMyPower
changed the title
[C++] Support Windows Debug mode build
[WIP][C++] Support Windows Debug mode build
Jul 13, 2021
BewareMyPower
changed the title
[WIP][C++] Support Windows Debug mode build
[C++] Support Windows Debug mode build
Jul 13, 2021
merlimat
approved these changes
Jul 13, 2021
codelipenghui
pushed a commit
that referenced
this pull request
Jul 14, 2021
* Use find_package for CURL * Add version check for findCurl * Use find_package for Protobuf * Find snappyd and zstdd for MSVC Debug mode * Restore the Protobuf variables name * Remove predefined Protobuf_LITE_LIBRARIES variable * Add comments for why use CONFIG mode for find_package * Update C++ client README * Minor fix * Fix ZLIB debug libraries path error * Fix build error when LINK_STATIC is ON * Fix Windows x86 link error * Fix ZSTD and Snappy not found on Windows x86 platform (cherry picked from commit 878cc44)
bharanic-dev
pushed a commit
to bharanic-dev/pulsar
that referenced
this pull request
Mar 18, 2022
* Use find_package for CURL * Add version check for findCurl * Use find_package for Protobuf * Find snappyd and zstdd for MSVC Debug mode * Restore the Protobuf variables name * Remove predefined Protobuf_LITE_LIBRARIES variable * Add comments for why use CONFIG mode for find_package * Update C++ client README * Minor fix * Fix ZLIB debug libraries path error * Fix build error when LINK_STATIC is ON * Fix Windows x86 link error * Fix ZSTD and Snappy not found on Windows x86 platform
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/build
cherry-picked/branch-2.8
Archived: 2.8 is end of life
doc-not-needed
Your PR changes do not impact docs
release/2.8.1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 undervcpkg_installed/<triplet>/lib
and could not find the debug version libraries undervcpkg_installed/<triplet>/debug/lib
. Ifpulsar.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 offind_library
with the explicit library names. For example, after Protobuf was found successfully, theProtobuf_LITE_LIBRARIES
would be set withZLIB and OpenSSL don't support config mode for
find_package
, so here we set hint path likeZLIB_ROOT
to force CMake find debug version libraries whenCMAKE_BUILD_TYPE
isDebug
.For ZSTD and Snappy, use the correct name for MSVC with Debug mode.
In addition, this PR doesn't handle the case when
LINK_STATIC=ON
so it still doesn't supportLINK_STATIC=ON
on Windows currently.Verifying this change
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.