Skip to content

Commit 264eff4

Browse files
griwesbrycelelbach
authored andcommitted
Thrust CMake conversion:
* Only enable RDC versions of examples when requested. * Some compilation fixups.
1 parent 8ac2c38 commit 264eff4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ if ("CUDA" STREQUAL "${THRUST_DEVICE_SYSTEM}")
8080
enable_language(CUDA)
8181

8282
# force CUDA C++ standard to be the same as the C++ standard used
83+
#
84+
# now, CMake is unaligned with reality on standard versions: https://gitlab.kitware.com/cmake/cmake/issues/18597
85+
# which means that using standard CMake methods, it's impossible to actually sync the CXX and CUDA versions for pre-11
86+
# versions of C++; CUDA accepts 98 but translates that to 03, while CXX doesn't accept 03 (and doesn't translate that to 03).
87+
# in case this gives You, dear user, any trouble, please escalate the above CMake bug, so we can support reality properly.
8388
unset (CMAKE_CUDA_STANDARD CACHE)
8489
set (CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
8590
endif ()
@@ -469,6 +474,8 @@ endforeach ()
469474

470475
# Handle examples
471476

477+
option(THRUST_ENABLE_EXAMPLES_WITH_RDC "Also build all examples with RDC." OFF)
478+
472479
list(APPEND THRUST_EXAMPLE_GLOBS examples/*.cu)
473480
list(APPEND THRUST_EXAMPLE_GLOBS examples/*.cpp)
474481

@@ -532,7 +539,7 @@ foreach (THRUST_EXAMPLE_SOURCE IN LISTS THRUST_EXAMPLES)
532539

533540
add_test(${THRUST_EXAMPLE} ${THRUST_EXAMPLE})
534541

535-
if ("CUDA" STREQUAL "${THRUST_DEVICE_SYSTEM}")
542+
if ("CUDA" STREQUAL "${THRUST_DEVICE_SYSTEM}" AND THRUST_ENABLE_EXAMPLES_WITH_RDC)
536543
set(THRUST_EXAMPLE_RDC "thrust.example.${THRUST_EXAMPLE_CATEGORY}rdc.${THRUST_EXAMPLE_NAME}")
537544

538545
add_executable(

0 commit comments

Comments
 (0)