-
Notifications
You must be signed in to change notification settings - Fork 34
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
Import https://github.com/pybind/pybind11_protobuf/pull/73 #108
Conversation
d0cc085
to
5a9ba08
Compare
5a9ba08
to
73c2bbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are comments copy-pasted (with slight edits) from an internal review by @mkruskal-google
Sorry it's a bit awkward with me in the middle (knowing very little about cmake). I hope that's ok.
CMakeLists.txt
Outdated
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
set(CMAKE_CXX_FLAGS | ||
"-fPIC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE_POSITION_INDEPENDENT_CODE is a more portable way to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in a3e1bff
CMakeLists.txt
Outdated
|
||
option(BUILD_pybind11 "Build the pybind11 dependency Library" ON) | ||
message(STATUS "Python: Build pybind11: ${BUILD_pybind11}") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kindof an anti-pattern for cmake. The typical approach is to assume your callers have already installed the necessary dependencies. by default you should use find_package
assuming the dependencies have been installed, and fall back to option
only if that fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 44a9c21.
- Removed option to build dependencies.
- Moved dependency settings to top-level
CMakeLists.txt
- Try
find_package
first thenFetchContent
if package not found.
CMakeLists.txt
Outdated
include(CMakeFindDependencyMacro) | ||
include(FindProtobuf) | ||
if(NOT protobuf_FOUND | ||
AND NOT PROTOBUF_FOUND | ||
AND NOT TARGET protobuf::libprotobuf) | ||
if(BUILD_protobuf) | ||
find_dependency(protobuf CONFIG REQUIRED) | ||
endif() | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these necessary? You've already either used find_package or FetchContent_Declare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in e388b89
# ============================================================================ | ||
# tests | ||
# ============================================================================ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like it's ever getting invoked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - the cmake build for tests is not yet complete and integrated. Can look to add if required for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just omit this file in this PR? Would we lose something if we did that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes can remove. No we won't lose anything. Removed in 6159ace.
No prob. I'm not a cmake expert either and adapted the fetch content usage from another project, so happy to take on board improvements. Will update #73 with the reviewers suggestions. |
d18e856
to
d47e377
Compare
d47e377
to
fc85063
Compare
Import #73
Manual import. The Google-internal repo is the source of truth for pybind11_protobuf. Sorry we didn't get to automating imports from GitHub PRs.