Skip to content

Commit 6c07b44

Browse files
committed
Merge pull request opencv#8555 from tomoaki0705:jetsontx2
2 parents 0a63ab3 + 9cd4265 commit 6c07b44

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cmake/OpenCVDetectCUDA.cmake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,24 @@ if(CUDA_FOUND)
8888
set(__cuda_arch_bin "3.2")
8989
set(__cuda_arch_ptx "")
9090
elseif(AARCH64)
91-
set(__cuda_arch_bin "5.3")
91+
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
92+
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
93+
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
94+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
95+
if(NOT _nvcc_res EQUAL 0)
96+
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
97+
set(__cuda_arch_bin "5.3 6.2")
98+
else()
99+
set(__cuda_arch_bin "${_nvcc_out}")
100+
string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}")
101+
endif()
92102
set(__cuda_arch_ptx "")
93103
else()
94104
if(${CUDA_VERSION} VERSION_LESS "8.0")
95105
set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2")
96106
else()
97107
set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1")
98108
endif()
99-
set(__cuda_arch_ptx "")
100109
endif()
101110
endif()
102111

0 commit comments

Comments
 (0)