added choise in compute capability
This commit is contained in:
parent
6849e14dab
commit
789b02ad76
@ -2,6 +2,7 @@
|
|||||||
set(name "gpu")
|
set(name "gpu")
|
||||||
set(DEPS "opencv_core")
|
set(DEPS "opencv_core")
|
||||||
|
|
||||||
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu)
|
||||||
|
|
||||||
set(the_target "opencv_${name}")
|
set(the_target "opencv_${name}")
|
||||||
|
|
||||||
@ -35,7 +36,29 @@ if (HAVE_CUDA)
|
|||||||
include_directories(${CUDA_INCLUDE_DIRS})
|
include_directories(${CUDA_INCLUDE_DIRS})
|
||||||
link_directories(${CUDA_LIBRARIES})
|
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)
|
if (UNIX OR APPLE)
|
||||||
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;")
|
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user