Created the new EIGEN_TEST_CUDA_CLANG option to compile the CUDA tests using clang instead of nvcc

This commit is contained in:
Benoit Steiner
2016-04-08 13:16:08 -07:00
parent 2d072b38c1
commit 0d2a532fc3
3 changed files with 37 additions and 5 deletions

View File

@@ -19,10 +19,25 @@ macro(ei_add_test_internal testname testname_with_suffix)
endif()
if(EIGEN_ADD_TEST_FILENAME_EXTENSION STREQUAL cu)
if (${ARGC} GREATER 2)
cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
if(EIGEN_TEST_CUDA_CLANG)
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
if(CUDA_64_BIT_DEVICE_CODE)
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
else()
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
endif()
if (${ARGC} GREATER 2)
add_executable(${targetname} ${filename})
else()
add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
endif()
target_link_libraries(${targetname} "cudart_static" "cuda" "dl" "rt" "pthread")
else()
cuda_add_executable(${targetname} ${filename})
if (${ARGC} GREATER 2)
cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
else()
cuda_add_executable(${targetname} ${filename})
endif()
endif()
else()
add_executable(${targetname} ${filename})
@@ -316,7 +331,11 @@ macro(ei_testing_print_summary)
endif()
if(EIGEN_TEST_CUDA)
message(STATUS "CUDA: ON")
if(EIGEN_TEST_CUDA_CLANG)
message(STATUS "CUDA: ON (using clang)")
else()
message(STATUS "CUDA: ON (using nvcc)")
endif()
else()
message(STATUS "CUDA: OFF")
endif()