Skip to content

Commit 8918aed

Browse files
committed
feat: bundle nvtx3 headers and remove from install export sets
nvtx3 is header-only. By installing its headers directly into cudf's install tree, consumers find them via cudf's include path without needing find_dependency(nvtx3) or any separate nvtx3 package. Changes: - get_nvtx.cmake: remove INSTALL_EXPORT_SET; propagate nvtx3_SOURCE_DIR to parent scope for header installation - get_rmm.cmake: strip nvtx3::nvtx3-cpp from rmm's INTERFACE_LINK_LIBRARIES after fetch, preventing the absorption loop from promoting it into cudf's installed public interface - CMakeLists.txt: filter nvtx3 from install-side export set merging; install nvtx3 headers from nvtx3_SOURCE_DIR in the DSO headers section
1 parent e55dd2a commit 8918aed

3 files changed

Lines changed: 28 additions & 11 deletions

File tree

cpp/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,9 +1139,9 @@ if(BUILD_SHARED_LIBS)
11391139
PROPERTY "GLOBAL_TARGETS"
11401140
)
11411141
foreach(_pkg IN LISTS _pkg_names)
1142-
# Skip packages that are themselves absorbed into libcudf — they won't be installed or
1143-
# findable at install time.
1144-
if(_mode STREQUAL "install" AND _pkg IN_LIST _absorbed_deps)
1142+
# Skip packages that are themselves absorbed into libcudf or bundled as headers — they won't
1143+
# be installed as separate findable packages.
1144+
if(_mode STREQUAL "install" AND (_pkg IN_LIST _absorbed_deps OR _pkg STREQUAL "nvtx3"))
11451145
continue()
11461146
endif()
11471147
rapids_export_package(${_mode} ${_pkg} cudf-exports GLOBAL_TARGETS ${_global_tgts})
@@ -1398,6 +1398,10 @@ if(NOT CUDF_INSTALL_LIBRARY_DEPS)
13981398
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
13991399
)
14001400
endif()
1401+
# nvtx3 uses SOURCE_SUBDIR c, so headers are at ${nvtx3_SOURCE_DIR}/include/nvtx3/
1402+
if(nvtx3_SOURCE_DIR)
1403+
install(DIRECTORY ${nvtx3_SOURCE_DIR}/include/nvtx3 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
1404+
endif()
14011405
endif()
14021406

14031407
if(CUDF_BUILD_STREAMS_TEST_UTIL)

cpp/cmake/thirdparty/get_nvtx.cmake

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55
# cmake-format: on
66
# =============================================================================
77

8-
# Need to call rapids_cpm_nvtx3 to get support for an installed version of nvtx3 and to support
9-
# installing it ourselves
8+
# Need to call rapids_cpm_nvtx3 to get the nvtx3 target available at configure time.
109
function(find_and_configure_nvtx)
1110
include(${rapids-cmake-dir}/cpm/nvtx3.cmake)
1211

13-
# nvtx3 is private for cudf, but it is a public dependency of rmm. When rmm is absorbed into
14-
# libcudf via whole-archive, rmm's public transitive deps (including nvtx3-cpp) are promoted into
15-
# cudf's public interface. CMake's export validation requires that nvtx3-cpp be in an export set.
16-
rapids_cpm_nvtx3(
17-
BUILD_EXPORT_SET cudf-exports INSTALL_EXPORT_SET cudf-exports
18-
${CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG}
12+
# nvtx3 headers are bundled directly into cudf's install tree, so we only need the build-side
13+
# export set for configure-time target resolution. No INSTALL_EXPORT_SET — consumers get headers
14+
# from cudf's include directory without needing find_dependency(nvtx3).
15+
rapids_cpm_nvtx3(BUILD_EXPORT_SET cudf-exports ${CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG})
16+
17+
# Propagate source dir to parent scope for header installation.
18+
set(nvtx3_SOURCE_DIR
19+
"${nvtx3_SOURCE_DIR}"
20+
PARENT_SCOPE
1921
)
2022

2123
endfunction()

cpp/cmake/thirdparty/get_rmm.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ function(find_and_configure_rmm BUILD_SHARED EXCLUDE_FROM_ALL)
2121
list(APPEND _rmm_args INSTALL_EXPORT_SET cudf-exports)
2222
endif()
2323
rapids_cpm_rmm(${_rmm_args} ${_exclude_flag} CPM_ARGS OPTIONS "BUILD_SHARED_LIBS ${BUILD_SHARED}")
24+
# Remove nvtx3 from rmm's public interface. Since rmm is absorbed into libcudf via whole-archive
25+
# and we bundle nvtx3 headers directly, consumers don't need the nvtx3 target. This prevents the
26+
# absorption loop from promoting nvtx3 into cudf's installed interface.
27+
get_target_property(_rmm_real_target rmm::rmm ALIASED_TARGET)
28+
if(_rmm_real_target)
29+
get_target_property(_rmm_iface_libs ${_rmm_real_target} INTERFACE_LINK_LIBRARIES)
30+
if(_rmm_iface_libs)
31+
list(REMOVE_ITEM _rmm_iface_libs nvtx3::nvtx3-cpp)
32+
set_property(TARGET ${_rmm_real_target} PROPERTY INTERFACE_LINK_LIBRARIES ${_rmm_iface_libs})
33+
endif()
34+
endif()
2435

2536
# If rmm was found as a pre-existing shared library (e.g. conda), we need find_dependency(rmm) in
2637
# the installed config even when EXCLUDE_FROM_ALL is set. EXCLUDE_FROM_ALL controls whether CPM-

0 commit comments

Comments
 (0)