18
18
19
19
find_package (CUDAToolkit REQUIRED)
20
20
21
- # Some tests always build with RDC, so make sure that the sm_XX flags are
22
- # compatible. See note in CubCudaConfig.cmake.
23
- # TODO once we're using CUDA_ARCHITECTURES, we can setup non-rdc fallback
24
- # tests to build for non-rdc arches. But for now, all files in a given directory
25
- # must build with the same `CMAKE_CUDA_FLAGS` due to CMake constraints around
26
- # how CUDA_FLAGS works.
27
- set (CMAKE_CUDA_FLAGS "${CUB_CUDA_FLAGS_BASE} ${CUB_CUDA_FLAGS_RDC} " )
28
-
29
21
# The function below reads the filepath `src`, extracts the %PARAM% comments,
30
22
# and fills `labels_var` with a list of `label1_value1.label2_value2...`
31
23
# strings, and puts the corresponding `DEFINITION=value1:DEFINITION=value2`
@@ -144,6 +136,11 @@ function(cub_add_test target_name_var test_name test_src cub_target)
144
136
set (config_meta_target ${config_prefix} .tests)
145
137
146
138
if (is_catch2_test)
139
+ set (use_rdc_for_catch2_utils OFF )
140
+ if (CUB_ENABLE_RDC_TESTS OR CUB_FORCE_RDC)
141
+ set (use_rdc_for_catch2_utils ON )
142
+ endif ()
143
+
147
144
# Per config helper library:
148
145
set (config_c2h_target ${config_prefix} .test .catch2_helper)
149
146
if (NOT TARGET ${config_c2h_target} )
@@ -162,15 +159,12 @@ function(cub_add_test target_name_var test_name test_src cub_target)
162
159
)
163
160
164
161
cub_clone_target_properties(${config_c2h_target} ${cub_target} )
162
+ cub_configure_cuda_target(${config_c2h_target} RDC ${use_rdc_for_catch2_utils} )
165
163
target_link_libraries (${config_c2h_target} PRIVATE CUDA::curand ${cub_target} )
166
164
167
165
if (CUB_IN_THRUST)
168
166
thrust_fix_clang_nvcc_build_for(${config_c2h_target} )
169
167
endif ()
170
-
171
- if (CUB_ENABLE_TESTS_WITH_RDC)
172
- cub_enable_rdc_for_cuda_target(${config_c2h_target} )
173
- endif ()
174
168
endif () # config_c2h_target
175
169
176
170
if (CUB_SEPARATE_CATCH2)
@@ -191,6 +185,7 @@ function(cub_add_test target_name_var test_name test_src cub_target)
191
185
Catch2::Catch2
192
186
)
193
187
cub_clone_target_properties(${config_c2run_target} ${cub_target} )
188
+ cub_configure_cuda_target(${config_c2run_target} RDC ${use_rdc_for_catch2_utils} )
194
189
add_dependencies (${config_meta_target} ${config_c2run_target} )
195
190
target_include_directories (${config_c2run_target} PRIVATE
196
191
"${CUB_SOURCE_DIR} /test"
0 commit comments