Skip to content

Commit

Permalink
Allow building with CCCL that's newer than CTK (dmlc#10633)
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Jul 26, 2024
1 parent 831af97 commit 5fdade9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmake/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,20 @@ function(xgboost_set_cuda_flags target)
target_compile_definitions(${target} PRIVATE -DXGBOOST_USE_NVTX=1)
endif()

target_link_libraries(${target} PRIVATE CCCL::CCCL)
# Use CCCL we find before CUDA Toolkit to make sure we get newer headers as intended
# The CUDA Toolkit includes its own copy of CCCL that often lags the latest releases
# (and would be picked up otherwise)
if(BUILD_STATIC_LIB)
# If the downstream user is statically linking with libxgboost, it needs to
# explicitly link with CCCL and CUDA runtime.
target_link_libraries(${target}
PUBLIC CCCL::CCCL CUDA::cudart_static)
else()
# If the downstream user is dynamically linking with libxgboost, it does not
# need to link with CCCL and CUDA runtime.
target_link_libraries(${target}
PRIVATE CCCL::CCCL CUDA::cudart_static)
endif()
target_compile_definitions(${target} PRIVATE -DXGBOOST_USE_CUDA=1)
target_include_directories(
${target} PRIVATE
Expand Down Expand Up @@ -239,7 +252,6 @@ macro(xgboost_target_link_libraries target)

if(USE_CUDA)
xgboost_set_cuda_flags(${target})
target_link_libraries(${target} PUBLIC CUDA::cudart_static)
endif()

if(PLUGIN_RMM)
Expand Down

0 comments on commit 5fdade9

Please sign in to comment.