Skip to content

Remove obsolete build system glue from the Thrust/CUB submodule structure. #2016

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

Merged
merged 1 commit into from
Jul 20, 2024
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
12 changes: 5 additions & 7 deletions cub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ endif()

# Support adding CUB to a parent project via add_subdirectory.
# See examples/cmake/add_subdir/CMakeLists.txt for details.
if (NOT CUB_TOPLEVEL_PROJECT AND NOT CUB_IN_THRUST)
if (NOT CUB_TOPLEVEL_PROJECT)
include(cmake/CubAddSubdir.cmake)
return()
endif()
Expand All @@ -51,12 +51,10 @@ mark_as_advanced(CUB_ENABLE_CPP_DIALECT_IN_NAMES)

# This option is only used when CUB is built stand-alone; otherwise the Thrust
# option has the same effect.
if (NOT CUB_IN_THRUST)
option(CUB_IGNORE_DEPRECATED_API
"Suppress warnings about deprecated Thrust/CUB API."
OFF
)
endif()
option(CUB_IGNORE_DEPRECATED_API
"Suppress warnings about deprecated Thrust/CUB API."
OFF
)

# Check if we're actually building anything before continuing. If not, no need
# to search for deps, etc. This is a common approach for packagers that just
Expand Down
41 changes: 10 additions & 31 deletions cub/cmake/CubBuildTargetList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,30 +132,15 @@ function(cub_build_target_list)
# Handle dialect options:
set(num_dialects_enabled 0)
foreach (dialect IN LISTS CUB_CPP_DIALECT_OPTIONS)
if (CUB_IN_THRUST)
# Just use Thrust's settings:
if (THRUST_ENABLE_MULTICONFIG)
set(CUB_ENABLE_DIALECT_CPP${dialect}
${THRUST_MULTICONFIG_ENABLE_DIALECT_CPP${dialect}}
)
else()
set(val OFF)
if (dialect EQUAL ${THRUST_CPP_DIALECT})
set(val ON)
endif()
set(CUB_ENABLE_DIALECT_CPP${dialect} ${val})
endif()
else()
# Create CMake options:
set(default_value OFF)
if (dialect EQUAL 14) # Default to just 14 on:
set(default_value ON)
endif()
option(CUB_ENABLE_DIALECT_CPP${dialect}
"Generate C++${dialect} build configurations."
${default_value}
)
# Create CMake options:
set(default_value OFF)
if (dialect EQUAL 14) # Default to just 14 on:
set(default_value ON)
endif()
option(CUB_ENABLE_DIALECT_CPP${dialect}
"Generate C++${dialect} build configurations."
${default_value}
)

if (CUB_ENABLE_DIALECT_CPP${dialect})
math(EXPR num_dialects_enabled "${num_dialects_enabled} + 1")
Expand Down Expand Up @@ -188,14 +173,8 @@ function(cub_build_target_list)
# Generic config flags:
macro(add_flag_option flag docstring default)
set(cub_opt "CUB_${flag}")
if (CUB_IN_THRUST)
set(thrust_opt "THRUST_${flag}")
# Use thrust's settings:
set(${cub_opt} ${${thrust_opt}})
else()
option(${cub_opt} "${docstring}" "${default}")
mark_as_advanced(${cub_opt})
endif()
option(${cub_opt} "${docstring}" "${default}")
mark_as_advanced(${cub_opt})
endmacro()
add_flag_option(IGNORE_DEPRECATED_CPP_DIALECT "Don't warn about any deprecated C++ standards and compilers." OFF)
add_flag_option(IGNORE_DEPRECATED_CPP_11 "Don't warn about deprecated C++11." OFF)
Expand Down
4 changes: 0 additions & 4 deletions cub/cmake/CubHeaderTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ function(cub_add_header_test label definitions)
cub_clone_target_properties(${headertest_target} ${cub_target})
cub_configure_cuda_target(${headertest_target} RDC ${CUB_FORCE_RDC})

if (CUB_IN_THRUST)
thrust_fix_clang_nvcc_build_for(${headertest_target})
endif()

add_dependencies(cub.all.headers ${headertest_target})
add_dependencies(${config_prefix}.all ${headertest_target})
endforeach()
Expand Down
4 changes: 0 additions & 4 deletions cub/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ function(cub_add_example target_name_var example_name example_src cub_target)
cub_configure_cuda_target(${example_target} RDC ${CUB_FORCE_RDC})
target_include_directories(${example_target} PRIVATE "${CUB_SOURCE_DIR}/examples")

if (CUB_IN_THRUST)
thrust_fix_clang_nvcc_build_for(${example_target})
endif()

# Add to the active configuration's meta target
add_dependencies(${config_meta_target} ${example_target})

Expand Down
15 changes: 0 additions & 15 deletions cub/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id)
else()
target_compile_definitions(${config_c2h_target} PRIVATE C2H_HAS_CURAND=0)
endif()

if (CUB_IN_THRUST)
thrust_fix_clang_nvcc_build_for(${config_c2h_target})
endif()
endif() # config_c2h_target

if (CUB_SEPARATE_CATCH2)
Expand Down Expand Up @@ -240,10 +236,6 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id)
target_link_options(${config_c2run_target} PRIVATE "-cuda")
endif()

if (CUB_IN_THRUST)
thrust_fix_clang_nvcc_build_for(${config_c2run_target})
endif()

add_test(NAME ${config_c2run_target}
COMMAND "$<TARGET_FILE:${config_c2run_target}>"
)
Expand All @@ -265,10 +257,6 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id)
target_compile_definitions(${test_target} PRIVATE NVRTC_CTK_PATH="-I${CUDAToolkit_INCLUDE_DIRS}")
endif()

if (CUB_IN_THRUST)
thrust_fix_clang_nvcc_build_for(${test_target})
endif()

if ("${test_target}" MATCHES "test.iterator")
target_compile_options(${test_target} PRIVATE -ftemplate-depth=1000) # for handling large type lists
endif()
Expand Down Expand Up @@ -297,9 +285,6 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id)
target_link_libraries(${test_target} nvtx3-cpp)
endif()

if (CUB_IN_THRUST)
thrust_fix_clang_nvcc_build_for(${test_target})
endif()

_cub_is_fail_test(is_fail_test "${test_src}")
if (is_fail_test)
Expand Down
12 changes: 1 addition & 11 deletions thrust/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ option(THRUST_ENABLE_HEADER_TESTING "Test that all public headers compile." "ON"
option(THRUST_ENABLE_TESTING "Build Thrust testing suite." "ON")
option(THRUST_ENABLE_EXAMPLES "Build Thrust examples." "ON")
option(THRUST_ENABLE_BENCHMARKS "Build Thrust runtime benchmarks." "${CCCL_ENABLE_BENCHMARKS}")
option(THRUST_INCLUDE_CUB_CMAKE "Build CUB tests and examples. (Requires CUDA)." "OFF")

# Check if we're actually building anything before continuing. If not, no need
# to search for deps, etc. This is a common approach for packagers that just
# need the install rules. See GH issue NVIDIA/thrust#1211.
if (NOT (THRUST_ENABLE_HEADER_TESTING OR
THRUST_ENABLE_TESTING OR
THRUST_ENABLE_EXAMPLES OR
THRUST_ENABLE_BENCHMARKS OR
THRUST_INCLUDE_CUB_CMAKE))
THRUST_ENABLE_BENCHMARKS))
return()
endif()

Expand Down Expand Up @@ -131,11 +129,3 @@ endif()
if (THRUST_ENABLE_BENCHMARKS)
add_subdirectory(benchmarks)
endif()

if (THRUST_INCLUDE_CUB_CMAKE AND THRUST_CUDA_FOUND)
set(CUB_IN_THRUST ON)
# CUB's path is specified generically to support both GitHub and Perforce
# source tree layouts. The include directory used by cub-config.cmake
# for source layouts is the same as the project root.
add_subdirectory("${_CUB_INCLUDE_DIR}" dependencies/cub)
endif()
Loading