Skip to content

Commit ce74285

Browse files
committed
Merge pull request opencv#17478 from tomoaki0705:dropOldCC
2 parents f162c08 + d92af2a commit ce74285

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

cmake/OpenCVDetectCUDA.cmake

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ if(CUDA_FOUND)
7878

7979
message(STATUS "CUDA detected: " ${CUDA_VERSION})
8080

81-
set(_generations "Fermi" "Kepler" "Maxwell" "Pascal" "Volta" "Turing" "Ampere")
81+
OCV_OPTION(CUDA_ENABLE_DEPRECATED_GENERATION "Enable deprecated generations in the list" OFF)
82+
set(_generations "Maxwell" "Pascal" "Volta" "Turing" "Ampere")
83+
if(CUDA_ENABLE_DEPRECATED_GENERATION)
84+
set(_generations "Fermi" "${_generations}")
85+
set(_generations "Kepler" "${_generations}")
86+
endif()
8287
set(_arch_fermi "2.0")
8388
set(_arch_kepler "3.0;3.5;3.7")
8489
set(_arch_maxwell "5.0;5.2")
@@ -199,10 +204,6 @@ if(CUDA_FOUND)
199204
endif()
200205
endmacro()
201206

202-
macro(ocv_wipeout_deprecated _arch_bin_list)
203-
string(REPLACE "2.1" "2.1(2.0)" ${_arch_bin_list} "${${_arch_bin_list}}")
204-
endmacro()
205-
206207
set(__cuda_arch_ptx "")
207208
if(CUDA_GENERATION STREQUAL "Fermi")
208209
set(__cuda_arch_bin ${_arch_fermi})
@@ -265,18 +266,21 @@ if(CUDA_FOUND)
265266
)
266267
endif()
267268
endif()
268-
ocv_wipeout_deprecated(__cuda_arch_bin)
269269

270270
set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
271271
set(CUDA_ARCH_PTX ${__cuda_arch_ptx} CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")
272272

273273
string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}")
274274
string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}")
275275

276-
# Check if user specified 1.0 compute capability: we don't support it
277-
if(" ${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}" MATCHES " 1.0")
278-
message(SEND_ERROR "CUDA: 1.0 compute capability is not supported - exclude it from ARCH/PTX list are re-run CMake")
279-
endif()
276+
# Check if user specified 1.0/2.1 compute capability: we don't support it
277+
macro(ocv_wipeout_deprecated_cc target_cc)
278+
if(" ${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}" MATCHES " ${target_cc}")
279+
message(SEND_ERROR "CUDA: ${target_cc} compute capability is not supported - exclude it from ARCH/PTX list and re-run CMake")
280+
endif()
281+
endmacro()
282+
ocv_wipeout_deprecated_cc("1.0")
283+
ocv_wipeout_deprecated_cc("2.1")
280284

281285
# NVCC flags to be set
282286
set(NVCC_FLAGS_EXTRA "")

0 commit comments

Comments
 (0)