Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ set(CUDF_BUILD_STATIC_DEPS
)
set_property(CACHE CUDF_BUILD_STATIC_DEPS PROPERTY STRINGS "ON" "OFF" "FORCE")

# nvCOMP is also distributed as a shared library by cuDF Java. Allow downstream packages that
# already ship that library to avoid embedding a second, static copy in libcudf.
set(CUDF_NVCOMP_LINKAGE
"AUTO"
CACHE STRING "Link nvCOMP automatically, statically, or dynamically"
)
set_property(CACHE CUDF_NVCOMP_LINKAGE PROPERTY STRINGS "AUTO" "STATIC" "SHARED")

# 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
Expand Down
26 changes: 23 additions & 3 deletions cpp/cmake/thirdparty/get_nvcomp.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# =============================================================================
# cmake-format: off
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# cmake-format: on
# =============================================================================
Expand Down Expand Up @@ -136,10 +136,30 @@ if(CUDF_INSTALL_LIBRARY_DEPS)
endif()
find_and_configure_nvcomp(${_nvcomp_args})

if(CUDF_DEPS_BUILD_SHARED OR NOT TARGET nvcomp::nvcomp_static)
if(NOT DEFINED CUDF_NVCOMP_LINKAGE)
set(CUDF_NVCOMP_LINKAGE "AUTO")
endif()

if(CUDF_NVCOMP_LINKAGE STREQUAL "STATIC")
if(NOT TARGET nvcomp::nvcomp_static)
message(FATAL_ERROR "CUDF_NVCOMP_LINKAGE=STATIC but nvcomp::nvcomp_static is unavailable")
endif()
set(CUDF_nvcomp_TARGET nvcomp::nvcomp_static)
elseif(CUDF_NVCOMP_LINKAGE STREQUAL "SHARED")
if(NOT TARGET nvcomp::nvcomp)
message(FATAL_ERROR "CUDF_NVCOMP_LINKAGE=SHARED but nvcomp::nvcomp is unavailable")
endif()
set(CUDF_nvcomp_TARGET nvcomp::nvcomp)
elseif(CUDF_NVCOMP_LINKAGE STREQUAL "AUTO")
if(CUDF_DEPS_BUILD_SHARED OR NOT TARGET nvcomp::nvcomp_static)
set(CUDF_nvcomp_TARGET nvcomp::nvcomp)
else()
set(CUDF_nvcomp_TARGET nvcomp::nvcomp_static)
endif()
else()
set(CUDF_nvcomp_TARGET nvcomp::nvcomp_static)
message(
FATAL_ERROR "CUDF_NVCOMP_LINKAGE must be AUTO, STATIC, or SHARED; got '${CUDF_NVCOMP_LINKAGE}'"
)
endif()

# Per-thread default stream
Expand Down
Loading