Skip to content

feat(cpp): improve CMake configuration for portable distribution and …#906

Open
shivendra-dev54 wants to merge 10 commits intoapache:mainfrom
shivendra-dev54:810-improve-cmakelists
Open

feat(cpp): improve CMake configuration for portable distribution and …#906
shivendra-dev54 wants to merge 10 commits intoapache:mainfrom
shivendra-dev54:810-improve-cmakelists

Conversation

@shivendra-dev54
Copy link
Contributor

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::graphar namespace via install(EXPORT).
  • Hybrid Linking Strategy: Updated dependencies (Arrow/Parquet) to PUBLIC visibility to ensure proper propagation to consumers.
  • Relocatable Installation: - Integrated GNUInstallDirs for standard-compliant paths.
    • Set CMAKE_INSTALL_RPATH using $ORIGIN (Linux) and @loader_path (macOS) to ensure the library is relocatable.
  • Config File Modernization: Updated graphar-config.in.cmake using @PACKAGE_INIT@ and find_dependency for robust downstream resolution.
  • Backward Compatibility: Preserved the legacy GRAPHAR_LIBRARIES and GRAPHAR_INCLUDE_DIR variables.

Are these changes tested?

  • Verified that all 20 existing C++ unit tests pass (ctest).
  • Confirmed that make install generates a valid relocatable file structure.
  • 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-commenter
Copy link

codecov-commenter commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.60%. Comparing base (b21da29) to head (228e64c).
⚠️ 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.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shivendra-dev54
Copy link
Contributor Author

@yangxk1 can you please give this a look
I tried testing python build locally in devcontainer, that works fine

@SYaoJun
Copy link
Contributor

SYaoJun commented Mar 10, 2026

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

@SYaoJun
Copy link
Contributor

SYaoJun commented Mar 13, 2026

After #908 merged , the CI can pass.

@shivendra-dev54
Copy link
Contributor Author

@yangxk1
please do review this if it meets the issue expectation or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants