-
Notifications
You must be signed in to change notification settings - Fork 162
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
Rework CMake code for v3.0.0. #897
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #897 +/- ##
==========================================
- Coverage 85.75% 84.55% -1.21%
==========================================
Files 89 86 -3
Lines 5695 5220 -475
==========================================
- Hits 4884 4414 -470
+ Misses 811 806 -5 ☔ View full report in Codecov by Sentry. |
Currently, there's two interesting things. First: find_package(HighFive)
target_link_libraries(foo PUBLIC HighFive) still works, if one doesn't use any optional dependencies. If one does, it'll requires changes to the source code, but not the build-system. Second: we don't provide code to link to optional dependencies. The argument is that if a library has dependency on, say, Boost, then they already have requirement to do The question is should we help them? One could by doing the following: find_package(HighFive COMPONENTS boost)
target_link_libraries(foo PUBLIC HighFive::HighFive HighFive::boost) The |
701309b
to
1d8ab03
Compare
AFAICT one one pitfall is that pHDF5 requires linking to MPI, i.e. target_link_libraries(HighFive INTERFACE HDF5::HDF5)
if(HDF5_IS_PARALLEL)
find_package(MPI)
target_link_libraries(HighFive INTERFACE MPI::MPI_C MPI::MPI_CXX)
endif() However, now the target |
cebcc73
to
7ab2ba6
Compare
I'm increasingly convinced that attempting to find and link optional dependencies will likely end up incorrect under too many circumstances. IIUC the Boost ecosystem seems to have not yet settled on a set of commands that works pretty much anywhere. OpenCV has targets, but doesn't document them AFAICT. Even if we did use its targets, they might change them in a manner that's not compatible with our CMake, which seems fair because the project is telling us to not use them. Moreover, we'd probably only include a very small subset of the library and users would almost certainly want more. Same argument for Boost. Not using targets has issues as documented here: |
cc3d00b
to
7640eda
Compare
Please consult `README.md`, the migration guide and `test/cmake_integration` for information about what changed.
253b17d
to
84c1327
Compare
if(HIGHFIVE_TEST_XTENSOR) | ||
set(CMAKE_CXX_STANDARD 14) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) |
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.
Shouldn't this get updated now?
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.
That's been prepped in the other PR: #957.
07c4979
to
912f701
Compare
README.md
Outdated
# Alternatively: | ||
# add_subdirectory(third_party/HighFive) |
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.
It might not be crystal clear that this is an alternative for find_package
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.
Thank you, we just spent the two immediately preceding subsections explaining the difference.
Thanks. It seems fair to simply strip third-party dependencies from the target and leave it up to the user. To stay uniform, the |
I've spotted this. Solving this nicely kinda requires stripping out all the logic in The problem is that XTensor doesn't have a compile time constant rank. Which is a non-issue when implemented Easy-style. When we want to move it into the inspector it starts messing with deduction of rank, which becomes an issue with empty arrays and also messes with the "broad-casting" feature. Additionally, the not related issue of string vs arrays of character which cause stripping of dimensions doesn't make that part of the code any easier to understand. I've mildly come to peace with the idea that Easy is "easy" and opinionated. Therefore, it continues to guess the presence of libraries by checking the existence of dependency related macros. OTOH, it would be nice to make Easy just a light API change. |
A simpler idea is to make the # include <highfive/eigen.hpp>
# include <highfive/xtensor.hpp>
# include <highfive/H5easy.hpp> One could then statically assert on features not (yet) in the core. This would simplify the API, I think. I am not quite up to speed with the templated rank issue. I think it is a separate issue, though. |
Let's track the H5Easy related questions in a different issue/PR. They don't prevent us from merging this as it is; and sort H5Easy separately. |
This PR develops the next version of HighFive's CMake code. The ideas are: