Commit 789b02ad authored by Andrey Morozov's avatar Andrey Morozov

added choise in compute capability

parent 6849e14d
......@@ -2,6 +2,7 @@
set(name "gpu")
set(DEPS "opencv_core")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu)
set(the_target "opencv_${name}")
......@@ -35,7 +36,29 @@ if (HAVE_CUDA)
include_directories(${CUDA_INCLUDE_DIRS})
link_directories(${CUDA_LIBRARIES})
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-arch=sm_13")
set(CUDA_NVCC_FLAGS_ARCH "1.2 1.3 2.0" CACHE STRING "Add or remove compute copability" FORCE)
set(CUDA_NVCC_FLAGS_NUM "")
while(NOT ${CUDA_NVCC_FLAGS_ARCH} STREQUAL "")
string(REGEX MATCH "[0-9]+.[0-9]+" RESULT_NUM ${CUDA_NVCC_FLAGS_ARCH})
string(REGEX MATCHALL "[0-9]" RESULT_STR ${RESULT_NUM})
string(REGEX REPLACE ";" "\ " RESULT ${RESULT_STR})
list(APPEND CUDA_NVCC_FLAGS_NUM ${RESULT})
string(REGEX REPLACE "${RESULT_NUM}" "\ " CUDA_NVCC_FLAGS_ARCH_STR ${CUDA_NVCC_FLAGS_ARCH})
string(STRIP ${CUDA_NVCC_FLAGS_ARCH_STR} CUDA_NVCC_FLAGS_ARCH)
endwhile()
set (loop_var "")
foreach( loop_var IN LISTS CUDA_NVCC_FLAGS_NUM)
set (CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS} -gencode=arch=compute_${loop_var},code=\"sm_${loop_var},compute_${loop_var}\"")
endforeach()
set (CUDA_NVCC_FLAGS_ARCH ${CUDA_NVCC_FLAGS_ARCH_STR} CACHE STRING "Add or remove compute copability" FORCE)
message(STATUS " CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS} ")
if (UNIX OR APPLE)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment