feat(cpp): improve CMake configuration for portable distribution and …
Reason for this PR
This PR addresses #810 to improve the portability and installation of the GraphAr C++ library. The current setup makes it difficult for downstream projects to use find_package(graphar), which this update resolves by modernizing the CMake export logic.
What changes are included in this PR?
- Modern CMake Targets: Added support for the
graphar::grapharnamespace viainstall(EXPORT). - Hybrid Linking Strategy: Updated dependencies (Arrow/Parquet) to
PUBLICvisibility to ensure proper propagation to consumers. - Relocatable Installation: - Integrated
GNUInstallDirsfor standard-compliant paths.- Set
CMAKE_INSTALL_RPATHusing$ORIGIN(Linux) and@loader_path(macOS) to ensure the library is relocatable.
- Set
- Config File Modernization: Updated
graphar-config.in.cmakeusing@PACKAGE_INIT@andfind_dependencyfor robust downstream resolution. - Backward Compatibility: Preserved the legacy
GRAPHAR_LIBRARIESandGRAPHAR_INCLUDE_DIRvariables.
Are these changes tested?
- [x] Verified that all 20 existing C++ unit tests pass (
ctest). - [x] Confirmed that
make installgenerates a valid relocatable file structure. - [x] Successfully linked a separate "Hello World" project using
find_package(graphar REQUIRED).
Are there any user-facing changes?
Yes. Users can now integrate GraphAr into their own projects using the standard CMake pattern:
find_package(graphar REQUIRED)
target_link_libraries(my_app PRIVATE graphar::graphar)
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 80.60%. Comparing base (b21da29) to head (228e64c).
:warning: Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #906 +/- ##
=========================================
Coverage 80.60% 80.60%
Complexity 615 615
=========================================
Files 94 94
Lines 10709 10709
Branches 1055 1055
=========================================
Hits 8632 8632
Misses 1837 1837
Partials 240 240
| Flag | Coverage Δ | |
|---|---|---|
| cpp | 70.90% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@yangxk1 can you please give this a look I tried testing python build locally in devcontainer, that works fine
@yangxk1 can you please give this a look I tried testing python build locally in devcontainer, that works fine
The current CI has some issues. Maybe we should fix the CI first before considering merging the existing PRs. What do you think?
After #908 merged , the CI can pass.
@yangxk1 please do review this if it meets the issue expectation or not