Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
eaf54e5
Introduce centralized dependency management infrastructure
vyasr May 5, 2026
010e729
Refactor core dependency fetchers for shared/static controls
vyasr May 5, 2026
d9150bf
Apply exclude-from-all flags to shared dependency fetchers
vyasr May 5, 2026
56fcec0
Align remaining dependency wrappers with centralized flags
vyasr May 5, 2026
72ac0f3
Update test dependency exclusion settings
vyasr May 5, 2026
1bac96a
Ensure install metadata for Java and stream tests
vyasr May 5, 2026
039fbf7
Just export nvtx for now
vyasr May 5, 2026
7b85d4f
Fix and clean up rmm args
vyasr May 5, 2026
40cab9b
One more fix
vyasr May 5, 2026
7064610
Merge remote-tracking branch 'upstream/main' into feat/minimize_insta…
vyasr May 6, 2026
a2d675c
Merge remote-tracking branch 'upstream/main' into feat/minimize_insta…
vyasr May 6, 2026
4fbc4e1
Absorb rmm and rapids_logger into shared libcudf via whole-archive
vyasr May 5, 2026
f91c272
Only apply WHOLE_ARCHIVE when linking a static library
vyasr May 5, 2026
8621029
First simplification
vyasr May 5, 2026
7d6c383
Second simplification
vyasr May 5, 2026
156ff42
Fix nvtx export set and case sensitivity in export merging
vyasr May 6, 2026
245e1ce
Filter absorbed deps from install export sets
vyasr May 6, 2026
8774c14
Filter absorbed and private deps from promoted interface libraries
vyasr May 6, 2026
a596864
Style
vyasr May 6, 2026
5ec4b0f
feat: bundle nvtx3 headers and remove from install export sets
vyasr May 6, 2026
2c4938a
fix: make nvtx3 bundling conditional on rmm absorption
vyasr May 6, 2026
210b656
fix: conditionally include nvtx3 INSTALL_EXPORT_SET based on absorpti…
vyasr May 6, 2026
a0ff4c2
fix: use cache variable for nvtx3_SOURCE_DIR to get correct SOURCE_SU…
vyasr May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 185 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ option(CUDA_ENABLE_LINEINFO
)
option(CUDA_WARNINGS_AS_ERRORS "Enable -Werror=all-warnings for all CUDA compilation" ON)

# CUDF_BUILD_STATIC_DEPS should almost never be set to OFF since there is no reason to prefer
# building shared libraries for dependencies under normal circumstances. FORCE is a necessary
# setting for building a standalone binary with no external dependencies.
set(CUDF_BUILD_STATIC_DEPS
"ON"
CACHE
STRING
"Three-state control for static library dependencies. ON (default) = use static when a CPM build is triggered, OFF = prefer shared (rarely useful), FORCE = guarantee using a static build by rebuilding or downloading even when local copies of a library exist"
)
set_property(CACHE CUDF_BUILD_STATIC_DEPS PROPERTY STRINGS "ON" "OFF" "FORCE")

# cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)
# FORCE mode implies static CUDA runtime
if(CUDF_BUILD_STATIC_DEPS STREQUAL "FORCE")
set(CUDA_STATIC_RUNTIME
ON
CACHE BOOL "Statically link the CUDA runtime" FORCE
)
else()
set(CUDA_STATIC_RUNTIME
OFF
CACHE BOOL "Statically link the CUDA runtime" FORCE
)
endif()

set(DEFAULT_CUDF_BUILD_STREAMS_TEST_UTIL ON)

if(NOT BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -98,6 +124,44 @@ message(VERBOSE
"CUDF: Build with remote IO (e.g. AWS S3) support through KvikIO: ${CUDF_KVIKIO_REMOTE_IO}"
)

# CUDF_INSTALL_LIBRARY_DEPS: Derived variable indicating whether to install library dependencies
if(NOT BUILD_SHARED_LIBS)
# A static libcudf.a will not contain the code for its dependencies, so we must install them to
# ensure downstream projects can find them
set(CUDF_INSTALL_LIBRARY_DEPS ON)
elseif(CUDF_BUILD_STATIC_DEPS STREQUAL "OFF")
# If dependencies are built as shared they will be needed at runtime
set(CUDF_INSTALL_LIBRARY_DEPS ON)
else()
# If dependencies are statically linked into a libcudf shared library they aren't needed at
# runtime
set(CUDF_INSTALL_LIBRARY_DEPS OFF)
endif()

# Derived flags for EXCLUDE_FROM_ALL handling across dependency fetching.
# CUDF_EXCLUDE_DEPS_FROM_ALL: ON/OFF value for rapids_cpm_find() calls (key-value style)
# CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG: "EXCLUDE_FROM_ALL" or "" for rapids_cpm_* wrapper calls (flag
# style) We need both because of https://github.com/cpm-cmake/CPM.cmake/issues/693
if(CUDF_INSTALL_LIBRARY_DEPS)
set(CUDF_EXCLUDE_DEPS_FROM_ALL OFF)
set(CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG)
else()
set(CUDF_EXCLUDE_DEPS_FROM_ALL ON)
set(CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG EXCLUDE_FROM_ALL)
endif()

# CUDF_DEPS_BUILD_SHARED: Boolean reduction of the 3-state CUDF_BUILD_STATIC_DEPS for passing to
# dependency configuration functions that accept a BUILD_SHARED parameter.
if(CUDF_BUILD_STATIC_DEPS STREQUAL "OFF")
set(CUDF_DEPS_BUILD_SHARED ON)
else()
set(CUDF_DEPS_BUILD_SHARED OFF)
endif()

message(VERBOSE "CUDF: Build static library dependencies: ${CUDF_BUILD_STATIC_DEPS}")
message(VERBOSE "CUDF: Install library dependencies: ${CUDF_INSTALL_LIBRARY_DEPS}")
message(VERBOSE "CUDF: Build dependencies as shared libraries: ${CUDF_DEPS_BUILD_SHARED}")

# Set a default build type if none was specified
rapids_cmake_build_type("Release")
set(CUDF_BUILD_TESTS ${BUILD_TESTS})
Expand Down Expand Up @@ -253,11 +317,32 @@ if(CUDF_BUILD_TESTUTIL)
)
endif()

# Set CPM_DOWNLOAD_ALL if CUDF_BUILD_STATIC_DEPS is FORCE to skip find_package for all CPM packages
if(CUDF_BUILD_STATIC_DEPS STREQUAL "FORCE")
set(CPM_DOWNLOAD_ALL ON)
endif()

# add third party dependencies using CPM
rapids_cpm_init()

include(${rapids-cmake-dir}/cpm/rapids_logger.cmake)
rapids_cpm_rapids_logger(BUILD_EXPORT_SET cudf-exports INSTALL_EXPORT_SET cudf-exports)
set(_rapids_logger_args BUILD_EXPORT_SET cudf-exports)
if(NOT CUDF_BUILD_STATIC_DEPS STREQUAL "OFF")
list(APPEND _rapids_logger_args ${CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG} CPM_ARGS OPTIONS
"BUILD_SHARED_LIBS OFF"
)
endif()
rapids_cpm_rapids_logger(${_rapids_logger_args})

# If dynamically linking to a preexisting rapids_logger library then find_dependency(rapids_logger)
# must be in the installed config when CUDF_INSTALL_LIBRARY_DEPS is OFF. If it's ON then we always
# export
get_target_property(_rapids_logger_type rapids_logger::rapids_logger TYPE)
if(CUDF_INSTALL_LIBRARY_DEPS OR NOT _rapids_logger_type STREQUAL "STATIC_LIBRARY")
include("${rapids-cmake-dir}/export/package.cmake")
rapids_export_package(INSTALL rapids_logger cudf-exports VERSION ${rapids_logger_VERSION})
endif()

create_logger_macros(CUDF "cudf::default_logger()" include/cudf)

# find jitify
Expand Down Expand Up @@ -998,11 +1083,87 @@ add_dependencies(cudf jitify_preprocess_run)
# Specify the target module library dependencies
target_link_libraries(
cudf
PUBLIC CCCL::CCCL rapids_logger::rapids_logger rmm::rmm $<BUILD_LOCAL_INTERFACE:BS::thread_pool>
PUBLIC CCCL::CCCL $<BUILD_LOCAL_INTERFACE:BS::thread_pool>
PRIVATE $<BUILD_LOCAL_INTERFACE:nvtx3::nvtx3-cpp> $<BUILD_LOCAL_INTERFACE:cuco::cuco> ZLIB::ZLIB
nvcomp::nvcomp kvikio::kvikio nanoarrow::nanoarrow zstd
${CUDF_nvcomp_TARGET} kvikio::kvikio ${CUDF_nanoarrow_TARGET} zstd
)

# When building a shared libcudf with static deps, we absorb them via whole-archive linking so that
# their symbols are available to downstream users linking to libcudf.so without needing to link
# against them directly. In this scenario, its public transitive dependencies must be promoted into
# cudf's installed interface (consumers still need them at link time), and its export set metadata
# (find_dependency calls, global targets) is merged into cudf-exports.
set(_absorbed_deps rmm rapids_logger)
foreach(_dep IN LISTS _absorbed_deps)
set(_${_dep}_link ${_dep}::${_dep})
endforeach()
if(BUILD_SHARED_LIBS)
# When rmm is a static library being absorbed via whole-archive, strip nvtx3 from its public
# interface. We bundle nvtx3 headers directly into cudf's install tree, so consumers get them from
# cudf's include path without needing the nvtx3 target or find_dependency(nvtx3).
get_target_property(_rmm_type rmm::rmm TYPE)
if(_rmm_type STREQUAL "STATIC_LIBRARY")
get_target_property(_rmm_real rmm::rmm ALIASED_TARGET)
if(_rmm_real)
get_target_property(_rmm_libs ${_rmm_real} INTERFACE_LINK_LIBRARIES)
if(_rmm_libs)
list(REMOVE_ITEM _rmm_libs nvtx3::nvtx3-cpp)
set_property(TARGET ${_rmm_real} PROPERTY INTERFACE_LINK_LIBRARIES ${_rmm_libs})
endif()
endif()
endif()
foreach(_dep IN LISTS _absorbed_deps)
get_target_property(_target_type ${_dep}::${_dep} TYPE)
if(NOT _target_type STREQUAL "STATIC_LIBRARY")
continue()
endif()

# Wrap with WHOLE_ARCHIVE + BUILD_INTERFACE so the static lib is absorbed into libcudf.so and
# hidden from the installed interface.
set(_${_dep}_link $<BUILD_INTERFACE:$<LINK_LIBRARY:WHOLE_ARCHIVE,${_dep}::${_dep}>>)

# Promote the absorbed library's public transitive deps into cudf's public interface. Filter out
# deps that are themselves absorbed — they are already linked via whole-archive. Also filter
# LINK_ONLY entries — those are private link deps already statically linked in.
get_target_property(_iface_libs ${_dep}::${_dep} INTERFACE_LINK_LIBRARIES)
if(_iface_libs)
foreach(_absorbed IN LISTS _absorbed_deps)
list(REMOVE_ITEM _iface_libs ${_absorbed}::${_absorbed})
endforeach()
list(FILTER _iface_libs EXCLUDE REGEX "\\\$<LINK_ONLY:")
target_link_libraries(cudf PUBLIC ${_iface_libs})
endif()

# Merge the absorbed library's export set metadata into cudf-exports so the installed config has
# find_dependency() calls for all transitive deps (e.g. nvtx3, CUDAToolkit from rmm).
foreach(_mode build install)
set(_src_target rapids_export_${_mode}_${_dep}-exports)
if(NOT TARGET ${_src_target})
continue()
endif()
get_property(
_pkg_names
TARGET ${_src_target}
PROPERTY "PACKAGE_NAMES"
)
get_property(
_global_tgts
TARGET ${_src_target}
PROPERTY "GLOBAL_TARGETS"
)
foreach(_pkg IN LISTS _pkg_names)
# Skip packages that are themselves absorbed into libcudf or bundled as headers — they won't
# be installed as separate findable packages.
if(_mode STREQUAL "install" AND (_pkg IN_LIST _absorbed_deps OR _pkg STREQUAL "nvtx3"))
continue()
endif()
rapids_export_package(${_mode} ${_pkg} cudf-exports GLOBAL_TARGETS ${_global_tgts})
endforeach()
endforeach()
endforeach()
endif()
target_link_libraries(cudf PUBLIC ${_rapids_logger_link} ${_rmm_link})

# Add Conda library, and include paths if specified
if(TARGET conda_env)
target_link_libraries(cudf PRIVATE conda_env)
Expand Down Expand Up @@ -1232,6 +1393,27 @@ install(DIRECTORY ${CUDF_SOURCE_DIR}/include/cudf ${CUDF_SOURCE_DIR}/include/cud
${CUDF_SOURCE_DIR}/include/nvtext DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

# In standalone DSO mode, rmm and rapids_logger are absorbed into libcudf via whole-archive. Their
# headers are still needed by consumers, so install them manually.
if(NOT CUDF_INSTALL_LIBRARY_DEPS)
# rmm uses SOURCE_SUBDIR cpp, so headers are at ${rmm_SOURCE_DIR}/cpp/include/rmm/ Generated
# headers (version_config.hpp, logger_macros.hpp) are at ${rmm_BINARY_DIR}/include/rmm/
if(rmm_SOURCE_DIR)
install(DIRECTORY ${rmm_SOURCE_DIR}/cpp/include/rmm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY ${rmm_BINARY_DIR}/include/rmm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
if(rapids_logger_SOURCE_DIR)
install(DIRECTORY ${rapids_logger_SOURCE_DIR}/include/rapids_logger
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()
# nvtx3 headers: nvtx3_SOURCE_DIR resolves to the cache variable set by FetchContent, which
# includes the SOURCE_SUBDIR (c/), so the headers are at ${nvtx3_SOURCE_DIR}/include/nvtx3/.
if(nvtx3_SOURCE_DIR)
install(DIRECTORY ${nvtx3_SOURCE_DIR}/include/nvtx3 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
endif()

if(CUDF_BUILD_STREAMS_TEST_UTIL)
install(
TARGETS cudf_identify_stream_usage_mode_cudf
Expand Down
25 changes: 14 additions & 11 deletions cpp/cmake/thirdparty/get_arrow.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# =============================================================================
# cmake-format: off
# SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# cmake-format: on
# =============================================================================
Expand Down Expand Up @@ -380,15 +380,6 @@ if(NOT DEFINED CUDF_VERSION_Arrow)
endif()

# Default to static arrow builds
if(NOT DEFINED CUDF_USE_ARROW_STATIC)
set(CUDF_USE_ARROW_STATIC ON)
endif()

# Default to excluding from installation since we generally privately and statically link Arrow.
if(NOT DEFINED CUDF_EXCLUDE_ARROW_FROM_ALL)
set(CUDF_EXCLUDE_ARROW_FROM_ALL OFF)
endif()

if(NOT DEFINED CUDF_ENABLE_ARROW_PARQUET)
set(CUDF_ENABLE_ARROW_PARQUET OFF)
endif()
Expand All @@ -397,7 +388,19 @@ if(NOT DEFINED CUDF_ENABLE_ARROW_COMPUTE)
set(CUDF_ENABLE_ARROW_COMPUTE OFF)
endif()

# Derive arrow build mode from CUDF_BUILD_STATIC_DEPS
if(CUDF_BUILD_STATIC_DEPS STREQUAL "OFF")
set(_cudf_arrow_static OFF)
else()
set(_cudf_arrow_static ON)
endif()
if(CUDF_INSTALL_LIBRARY_DEPS)
set(_cudf_arrow_exclude_from_all OFF)
else()
set(_cudf_arrow_exclude_from_all ON)
endif()

find_and_configure_arrow(
${CUDF_VERSION_Arrow} ${CUDF_USE_ARROW_STATIC} ${CUDF_EXCLUDE_ARROW_FROM_ALL}
${CUDF_VERSION_Arrow} ${_cudf_arrow_static} ${_cudf_arrow_exclude_from_all}
${CUDF_ENABLE_ARROW_PARQUET} ${CUDF_ENABLE_ARROW_COMPUTE}
)
8 changes: 4 additions & 4 deletions cpp/cmake/thirdparty/get_croaring.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
# =============================================================================

# Use CPM to clone CRoaring and set up the necessary targets and include directories.
function(find_and_configure_roaring VERSION)
set(_exclude_from_all EXCLUDE_FROM_ALL ${BUILD_SHARED_LIBS})
function(find_and_configure_roaring VERSION EXCLUDE_FROM_ALL)

rapids_cpm_find(
roaring ${VERSION}
GLOBAL_TARGETS roaring
CPM_ARGS
GIT_REPOSITORY https://github.com/RoaringBitmap/CRoaring.git
GIT_TAG v${VERSION}
GIT_SHALLOW TRUE ${_exclude_from_all}
GIT_SHALLOW TRUE
EXCLUDE_FROM_ALL ${EXCLUDE_FROM_ALL}
OPTIONS "ROARING_BUILD_STATIC ON"
"BUILD_SHARED_LIBS OFF"
"ENABLE_ROARING_TESTS OFF"
Expand All @@ -39,4 +39,4 @@ function(find_and_configure_roaring VERSION)
endfunction()

set(roaring_VERSION_cudf "4.3.11")
find_and_configure_roaring(${roaring_VERSION_cudf})
find_and_configure_roaring(${roaring_VERSION_cudf} ${CUDF_EXCLUDE_DEPS_FROM_ALL})
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_cucollections.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
function(find_and_configure_cucollections)
include(${rapids-cmake-dir}/cpm/cuco.cmake)

rapids_cpm_cuco(BUILD_EXPORT_SET cudf-exports)
rapids_cpm_cuco(${CUDF_EXCLUDE_DEPS_FROM_ALL_FLAG})
endfunction()

find_and_configure_cucollections()
11 changes: 8 additions & 3 deletions cpp/cmake/thirdparty/get_dlpack.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# =============================================================================
# cmake-format: off
# SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# cmake-format: on
# =============================================================================

# This function finds dlpack and sets any additional necessary environment variables.
function(find_and_configure_dlpack VERSION)
function(find_and_configure_dlpack VERSION EXCLUDE_FROM_ALL)

include(${rapids-cmake-dir}/find/generate_module.cmake)
rapids_find_generate_module(DLPACK HEADER_NAMES dlpack.h)
Expand All @@ -17,6 +17,7 @@ function(find_and_configure_dlpack VERSION)
GIT_TAG v${VERSION}
GIT_SHALLOW TRUE
DOWNLOAD_ONLY TRUE
EXCLUDE_FROM_ALL ${EXCLUDE_FROM_ALL}
OPTIONS "BUILD_MOCK OFF"
)

Expand All @@ -31,4 +32,8 @@ endfunction()

set(CUDF_MIN_VERSION_dlpack 0.8)

find_and_configure_dlpack(${CUDF_MIN_VERSION_dlpack})
if(NOT DEFINED CUDF_EXCLUDE_DEPS_FROM_ALL)
set(CUDF_EXCLUDE_DEPS_FROM_ALL OFF)
endif()

find_and_configure_dlpack(${CUDF_MIN_VERSION_dlpack} ${CUDF_EXCLUDE_DEPS_FROM_ALL})
8 changes: 4 additions & 4 deletions cpp/cmake/thirdparty/get_flatbuffers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
# =============================================================================

# Use CPM to find or clone flatbuffers
function(find_and_configure_flatbuffers VERSION)
set(_exclude_from_all EXCLUDE_FROM_ALL ${BUILD_SHARED_LIBS})
function(find_and_configure_flatbuffers VERSION EXCLUDE_FROM_ALL)

rapids_cpm_find(
flatbuffers ${VERSION}
GLOBAL_TARGETS flatbuffers
CPM_ARGS
GIT_REPOSITORY https://github.com/google/flatbuffers.git
GIT_TAG v${VERSION}
GIT_SHALLOW TRUE ${_exclude_from_all}
GIT_SHALLOW TRUE
EXCLUDE_FROM_ALL ${EXCLUDE_FROM_ALL}
OPTIONS "FLATBUFFERS_BUILD_TESTS OFF"
)

Expand All @@ -25,4 +25,4 @@ function(find_and_configure_flatbuffers VERSION)

endfunction()

find_and_configure_flatbuffers(24.3.25)
find_and_configure_flatbuffers(24.3.25 ${CUDF_EXCLUDE_DEPS_FROM_ALL})
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_kvikio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

# This function finds KvikIO
function(find_and_configure_kvikio VERSION)
set(_exclude_from_all EXCLUDE_FROM_ALL ${BUILD_SHARED_LIBS})

rapids_cpm_find(
kvikio ${VERSION}
GLOBAL_TARGETS kvikio::kvikio
CPM_ARGS
GIT_REPOSITORY https://github.com/rapidsai/kvikio.git
GIT_TAG "${RAPIDS_BRANCH}"
GIT_SHALLOW TRUE SOURCE_SUBDIR cpp ${_exclude_from_all}
GIT_SHALLOW TRUE SOURCE_SUBDIR cpp
EXCLUDE_FROM_ALL ${CUDF_EXCLUDE_DEPS_FROM_ALL}
OPTIONS "KvikIO_BUILD_EXAMPLES OFF" "KvikIO_REMOTE_SUPPORT ${CUDF_KVIKIO_REMOTE_IO}"
"BUILD_SHARED_LIBS OFF"
)
Expand Down
Loading
Loading