Skip to content

Commit 31e49d4

Browse files
authored
Make CUB NVRTC commandline arguments come from a cmake template (#3292)
1 parent b9c21e4 commit 31e49d4

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cub/test/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,8 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id)
227227
endif() # CUB_SEPARATE_CATCH2
228228

229229
if ("${test_target}" MATCHES "nvrtc")
230-
target_compile_definitions(${test_target} PRIVATE NVRTC_CUB_PATH="-I${CMAKE_SOURCE_DIR}/cub")
231-
target_compile_definitions(${test_target} PRIVATE NVRTC_THRUST_PATH="-I${CMAKE_SOURCE_DIR}/thrust")
232-
target_compile_definitions(${test_target} PRIVATE NVRTC_LIBCUDACXX_PATH="-I${CMAKE_SOURCE_DIR}/libcudacxx/include")
233-
target_compile_definitions(${test_target} PRIVATE NVRTC_CTK_PATH="-I${CUDAToolkit_INCLUDE_DIRS}")
230+
configure_file("cmake/nvrtc_args.h.in" ${CMAKE_CURRENT_BINARY_DIR}/nvrtc_args.h)
231+
target_include_directories(${test_target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
234232
endif()
235233

236234
if ("${test_target}" MATCHES "test.iterator")

cub/test/catch2_test_nvrtc.cu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include <c2h/catch2_test_helper.h>
3333
#include <nvrtc.h>
34+
#include <nvrtc_args.h>
3435

3536
TEST_CASE("Test nvrtc", "[test][nvrtc]")
3637
{

cub/test/cmake/nvrtc_args.h.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
const char* NVRTC_CUB_PATH = "-I@CMAKE_SOURCE_DIR@/cub";
4+
const char* NVRTC_THRUST_PATH = "-I@CMAKE_SOURCE_DIR@/thrust";
5+
const char* NVRTC_LIBCUDACXX_PATH = "-I@CMAKE_SOURCE_DIR@/libcudacxx/include";
6+
const char* NVRTC_CTK_PATH = "-I@CUDAToolkit_INCLUDE_DIRS@";

0 commit comments

Comments
 (0)