[C++][CMake] Fix install/export targets and Windows runtime handling - #819
[C++][CMake] Fix install/export targets and Windows runtime handling#819tanmoyPaul12 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #819 +/- ##
============================================
+ Coverage 77.17% 77.18% +0.01%
Complexity 607 607
============================================
Files 84 85 +1
Lines 8854 8858 +4
Branches 1043 1043
============================================
+ Hits 6833 6837 +4
Misses 1781 1781
Partials 240 240
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @tanmoyPaul12 Thanks for the update! This PR improves the installation paths (especially for Windows), but it doesn't fully resolve #810 yet. To fully support find_package(GraphAr) and the requested distribution goals, we still need:
Could you please address these points? |
|
@yangxk1 I’ll update this PR to:
Thanks for the clarification — I’ll follow up with the changes shortly. |
keksmd
left a comment
There was a problem hiding this comment.
@tanmoyPaul12 thanks for chasing #810 — reliable install/export is a real gap, and the MSVC + vcpkg validation you did is exactly the kind of testing this area was missing.
Unfortunately I think this PR has been overtaken by main and needs a rebase before it can be reviewed on its merits. GitHub currently reports it as CONFLICTING / DIRTY.
What changed underneath it
refactor(build): restructure CMake files into subdirectories (#877) (commit d1fe7f9) split cpp/CMakeLists.txt apart. The build_graphar() / build_graphar_with_arrow_bundled() macros and the install_graphar_target() helper that this PR edits no longer exist in cpp/CMakeLists.txt. The library and its install rule moved to cpp/src/CMakeLists.txt, which on current main reads:
install(TARGETS graphar graphar_thirdparty
EXPORT graphar-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES
DESTINATION include)So the three headline items of this PR — removing the duplicate/conflicting install logic, defining a single canonical install(TARGETS graphar ...), and adding a RUNTIME destination so the Windows DLL is installed — appear to already be in place. Before rebasing, it is probably worth re-testing your MSVC + vcpkg scenario against current main to see whether #810 is still reproducible at all.
One thing that does still look wrong on main
The two halves of the install disagree about the library directory. cpp/src/CMakeLists.txt hardcodes lib and bin, while cpp/CMakeLists.txt places the package config files using the GNU variable:
install(FILES "${PROJECT_BINARY_DIR}/graphar-config.cmake"
"${PROJECT_BINARY_DIR}/graphar-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/graphar)
install(EXPORT graphar-targets
FILE graphar-targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/graphar)include(GNUInstallDirs) is already present (cpp/CMakeLists.txt), and on distributions where CMAKE_INSTALL_LIBDIR is not plain lib (lib64 on Fedora/RHEL, lib/<triplet> on Debian multiarch) the package config lands in one tree while the library lands in another. Making cpp/src/CMakeLists.txt use ${CMAKE_INSTALL_LIBDIR}, ${CMAKE_INSTALL_BINDIR} and ${CMAKE_INSTALL_INCLUDEDIR} would be a small, self-contained follow-up, and a good scope for this PR after the rebase.
Style note for whatever survives
The diff comments the old calls out rather than deleting them:
- install_graphar_target(graphar)
+ # install_graphar_target(graphar)Commented-out code should be removed outright; the indentation also drops from four spaces to three on the first hunk, which cmake-format would flag.
Fixes #810
Reason for this PR
The current CMake installation logic in GraphAr does not reliably support
library distribution and downstream consumption, especially on Windows.
This PR addresses the CMake install and export issues discussed in #810
and makes runtime installation behavior consistent across platforms.
What changes are included in this PR?
graphartargetinstall(TARGETS graphar ...)rulecmake --installAre these changes tested?
cmake --build . --config Releasecmake --install . --config ReleaseAre there any user-facing changes?
No. This change affects CMake install and packaging behavior only and does not
modify GraphAr APIs or runtime behavior.