incubator-graphar icon indicating copy to clipboard operation
incubator-graphar copied to clipboard

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

Open shivendra-dev54 opened this issue 8 months ago • 5 comments

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?

  • [x] Verified that all 20 existing C++ unit tests pass (ctest).
  • [x] Confirmed that make install generates 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)

shivendra-dev54 avatar Mar 10 '26 08:03 shivendra-dev54

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.

codecov-commenter avatar Mar 10 '26 08:03 codecov-commenter

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

shivendra-dev54 avatar Mar 10 '26 09:03 shivendra-dev54

@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 avatar Mar 10 '26 16:03 SYaoJun

After #908 merged , the CI can pass.

SYaoJun avatar Mar 13 '26 14:03 SYaoJun

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

shivendra-dev54 avatar Mar 14 '26 06:03 shivendra-dev54