Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch/2.2.x to main #308

Merged
merged 1 commit into from
Aug 7, 2023
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
6 changes: 3 additions & 3 deletions cub/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ function(cub_add_test target_name_var test_name test_src cub_target)

if (is_catch2_test)
set(use_rdc_for_catch2_utils OFF)
if (CUB_ENABLE_RDC_TESTS OR CUB_FORCE_RDC)
set(use_rdc_for_catch2_utils ON)
endif()
if (CUB_ENABLE_RDC_TESTS OR CUB_FORCE_RDC)
set(use_rdc_for_catch2_utils ON)
endif()

# Per config helper library:
set(config_c2h_target ${config_prefix}.test.catch2_helper)
Expand Down
37 changes: 37 additions & 0 deletions lib/cmake/cccl/cccl-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ else()
set(components Thrust CUB libcudacxx)
endif()

if (NOT TARGET CCCL::CCCL)
add_library(CCCL::CCCL INTERFACE IMPORTED GLOBAL)
endif()

foreach(component IN LISTS components)
string(TOLOWER "${component}" component_lower)

Expand All @@ -36,6 +40,12 @@ foreach(component IN LISTS components)
"${cccl_cmake_dir}/../../../libcudacxx/lib/cmake/" # Source layout (GitHub)
"${cccl_cmake_dir}/.." # Install layout
)
# Can't alias other alias targets, so use the uglified target name instead
# of libcudacxx::libcudacxx:
if (TARGET _libcudacxx_libcudacxx AND NOT TARGET CCCL::libcudacxx)
add_library(CCCL::libcudacxx ALIAS _libcudacxx_libcudacxx)
target_link_libraries(CCCL::CCCL INTERFACE CCCL::libcudacxx)
endif()
elseif(component_lower STREQUAL "cub")
find_package(CUB ${CCCL_VERSION} EXACT CONFIG
${cccl_quiet_flag}
Expand All @@ -45,6 +55,12 @@ foreach(component IN LISTS components)
"${cccl_cmake_dir}/../../../cub/cub/cmake/" # Source layout (GitHub)
"${cccl_cmake_dir}/.." # Install layout
)
# Can't alias other alias targets, so use the uglified target name instead
# of CUB::CUB:
if (TARGET _CUB_CUB AND NOT TARGET CCCL::CUB)
add_library(CCCL::CUB ALIAS _CUB_CUB)
target_link_libraries(CCCL::CCCL INTERFACE CCCL::CUB)
endif()
elseif(component_lower STREQUAL "thrust")
find_package(Thrust ${CCCL_VERSION} EXACT CONFIG
${cccl_quiet_flag}
Expand All @@ -54,6 +70,27 @@ foreach(component IN LISTS components)
"${cccl_cmake_dir}/../../../thrust/thrust/cmake/" # Source layout (GitHub)
"${cccl_cmake_dir}/.." # Install layout
)

if (TARGET Thrust::Thrust AND NOT CCCL::Thrust)
# By default, configure a CCCL::Thrust target with host=cpp device=cuda
option(CCCL_ENABLE_DEFAULT_THRUST_TARGET
"Create a CCCL::Thrust target using CCCL_THRUST_[HOST|DEVICE]_SYSTEM."
ON
)
mark_as_advanced(CCCL_ENABLE_DEFAULT_THRUST_TARGET)
if (CCCL_ENABLE_DEFAULT_THRUST_TARGET)
thrust_create_target(CCCL::Thrust FROM_OPTIONS
HOST_OPTION CCCL_THRUST_HOST_SYSTEM
DEVICE_OPTION CCCL_THRUST_DEVICE_SYSTEM
HOST_OPTION_DOC
"Host system for CCCL::Thrust target."
DEVICE_OPTION_DOC
"Device system for CCCL::Thrust target."
ADVANCED
)
target_link_libraries(CCCL::CCCL INTERFACE CCCL::Thrust)
endif()
endif()
else()
message(FATAL_ERROR "Invalid CCCL component requested: '${component}'")
endif()
Expand Down
Loading