Skip to content

Commit

Permalink
Make CUB NVRTC commandline arguments come from a cmake template (#3292)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmaxey authored Jan 9, 2025
1 parent b9c21e4 commit 31e49d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cub/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,8 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id)
endif() # CUB_SEPARATE_CATCH2

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

if ("${test_target}" MATCHES "test.iterator")
Expand Down
1 change: 1 addition & 0 deletions cub/test/catch2_test_nvrtc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <c2h/catch2_test_helper.h>
#include <nvrtc.h>
#include <nvrtc_args.h>

TEST_CASE("Test nvrtc", "[test][nvrtc]")
{
Expand Down
6 changes: 6 additions & 0 deletions cub/test/cmake/nvrtc_args.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

const char* NVRTC_CUB_PATH = "-I@CMAKE_SOURCE_DIR@/cub";
const char* NVRTC_THRUST_PATH = "-I@CMAKE_SOURCE_DIR@/thrust";
const char* NVRTC_LIBCUDACXX_PATH = "-I@CMAKE_SOURCE_DIR@/libcudacxx/include";
const char* NVRTC_CTK_PATH = "-I@CUDAToolkit_INCLUDE_DIRS@";

0 comments on commit 31e49d4

Please sign in to comment.