Skip to content
Merged
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
71 changes: 15 additions & 56 deletions rapids-cmake/cpm/cccl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,73 +70,32 @@ function(rapids_cpm_cccl)
set(to_install ON)
# Make sure we install CCCL into the `include/rapids` subdirectory instead of the default
include(GNUInstallDirs)
set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/rapids")
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/rapids")
string(APPEND CMAKE_INSTALL_INCLUDEDIR "/rapids")
string(APPEND CMAKE_INSTALL_LIBDIR "/rapids")
# We don't specify `CCCL_ENABLE_INSTALL_RULES` as a `rapids_cpm_find` argument so that it isn't
# propagated to users of the build export file which would cause them to also install parts of
# CCCL by mistake ( and in a wrong directory )
get_property(rapids_cccl_install_rules_already_called GLOBAL
PROPERTY rapids_cmake_cccl_install_rules SET)
if(NOT rapids_cccl_install_rules_already_called)
set(CCCL_ENABLE_INSTALL_RULES ON)
set(CUB_ENABLE_INSTALL_RULES ON)
set(Thrust_ENABLE_INSTALL_RULES ON)
set(libcudacxx_ENABLE_INSTALL_RULES ON)
set_property(GLOBAL PROPERTY rapids_cmake_cccl_install_rules ON)
endif()
endif()

include("${rapids-cmake-dir}/cpm/detail/generate_patch_command.cmake")
rapids_cpm_generate_patch_command(CCCL ${version} patch_command build_patch_only)

include("${rapids-cmake-dir}/cpm/find.cmake")
rapids_cpm_find(CCCL ${version} ${ARGN} ${build_patch_only}
GLOBAL_TARGETS CCCL CCCL::CCCL CCCL::CUB CCCL::libcudacxx
CPM_ARGS FIND_PACKAGE_ARGUMENTS EXACT
GIT_REPOSITORY ${repository}
GIT_TAG ${tag}
GIT_SHALLOW ${shallow} ${patch_command}
EXCLUDE_FROM_ALL ${exclude}
OPTIONS "CCCL_TOPLEVEL_PROJECT OFF" # Fixes
# https://github.com/NVIDIA/cccl/pull/2597
"CCCL_ENABLE_INSTALL_RULES ${to_install}")

# rapids_cpm_cccl can be called multiple times from the same scope such as from
# cudf/CMakeLists.txt and cudf's call to find_package(rmm). In these situations, subsequent
# invocations will still have `CCCL_SOURCE_DIR` set due to how `rapids_cpm_find` early termination
# sets up variables
#
# So to properly preserve any custom install location values from the first invocation we need a
# global property that we use to track that the cccl install rules have been called
get_property(rapids_cccl_install_rules_already_called GLOBAL
PROPERTY rapids_cmake_cccl_install_rules SET)
if(CCCL_SOURCE_DIR AND to_install AND NOT rapids_cccl_install_rules_already_called)

set_property(GLOBAL PROPERTY rapids_cmake_cccl_install_rules ON)
# CCCL < 2.8 does not currently correctly support installation of cub/thrust/libcudacxx in a
# subdirectory CCCL_VERSION doesn't exist when using `add_subdirectory`
if(LIBCUDACXX_VERSION VERSION_LESS 2.8)
set(Thrust_SOURCE_DIR "${CCCL_SOURCE_DIR}/thrust")
set(CUB_SOURCE_DIR "${CCCL_SOURCE_DIR}/cub")
set(libcudacxx_SOURCE_DIR "${CCCL_SOURCE_DIR}/libcudacxx")

set(Thrust_BINARY_DIR "${CCCL_BINARY_DIR}")
set(CUB_BINARY_DIR "${CCCL_BINARY_DIR}")
set(libcudacxx_BINARY_DIR "${CCCL_BINARY_DIR}")

set(Thrust_ENABLE_INSTALL_RULES ON)
set(CUB_ENABLE_INSTALL_RULES ON)
set(libcudacxx_ENABLE_INSTALL_RULES ON)

include("${Thrust_SOURCE_DIR}/cmake/ThrustInstallRules.cmake")
include("${CUB_SOURCE_DIR}/cmake/CubInstallRules.cmake")

# libcudacxx's install rules require inserting an extra level of nesting for the include dir.
string(APPEND CMAKE_INSTALL_INCLUDEDIR "/libcudacxx")
include("${libcudacxx_SOURCE_DIR}/cmake/libcudacxxInstallRules.cmake")
else()
# CCCL 2.7 doesn't allow rapids-cmake to place libcudacxx headers into `include/libcudacxx` so
# we manually invoke `cccl_generate_install_rules`
set(CCCL_TOPLEVEL_PROJECT OFF) # Fixes https://github.com/NVIDIA/cccl/pull/2597
set(CUB_ENABLE_INSTALL_RULES ON)
set(Thrust_ENABLE_INSTALL_RULES ON)
set(libcudacxx_ENABLE_INSTALL_RULES ON)
include("${CCCL_SOURCE_DIR}/cmake/install/cub.cmake")
include("${CCCL_SOURCE_DIR}/cmake/install/thrust.cmake")

# libcudacxx's install rules require inserting an extra level of nesting for the include dir.
string(APPEND CMAKE_INSTALL_INCLUDEDIR "/libcudacxx")
include("${CCCL_SOURCE_DIR}/cmake/install/libcudacxx.cmake")
endif()
endif()
EXCLUDE_FROM_ALL ${exclude})

include("${rapids-cmake-dir}/cpm/detail/display_patch_status.cmake")
rapids_cpm_display_patch_status(CCCL)
Expand Down
3 changes: 1 addition & 2 deletions testing/cpm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ add_cmake_build_test(cpm_bs_thread_pool-install-config-works.cmake)

add_cmake_config_test(cpm_cccl-simple.cmake)
add_cmake_config_test(cpm_cccl-export.cmake)
add_cmake_build_test(cpm_cccl-version-2-5.cmake NO_CPM_CACHE)
add_cmake_build_test(cpm_cccl-version-2-7.cmake NO_CPM_CACHE)
add_cmake_build_test(cpm_cccl-version-2-8.cmake NO_CPM_CACHE)
add_cmake_build_test(cpm_cccl-version-3-0.cmake NO_CPM_CACHE)
add_cmake_build_test(cpm_cccl-preserve-custom-install-loc)

add_cmake_config_test(cpm_cuco-simple.cmake)
Expand Down
79 changes: 0 additions & 79 deletions testing/cpm/cpm_cccl-version-2-5.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions testing/cpm/cpm_cccl-version-2-8.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ project(verify_install_targets LANGUAGES CXX)

# Verify include dirs
set(include_dirs_to_verify include/rapids/cub
include/rapids/libcudacxx/cuda
include/rapids/libcudacxx/nv
include/rapids/cuda
include/rapids/nv
include/rapids/thrust)

# Verify lib/cmake dirs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json
{
"packages": {
"CCCL": {
"version": "2.7.0",
"version": "3.0.0",
"git_shallow": false,
"git_url": "https://github.com/NVIDIA/cccl.git",
"git_tag": "v2.7.0"
"git_tag": "dc1db8aefcfe52c66c26c6038fef58da37a46ae9"
}
}
}
Expand All @@ -54,8 +54,8 @@ project(verify_install_targets LANGUAGES CXX)

# Verify include dirs
set(include_dirs_to_verify include/rapids/cub
include/rapids/libcudacxx/cuda
include/rapids/libcudacxx/nv
include/rapids/cuda
include/rapids/nv
include/rapids/thrust)

# Verify lib/cmake dirs
Expand Down