re-enable cuda choice

This commit is contained in:
Stefano Sinigardi 2019-07-09 10:39:48 +02:00
parent 5a6afe96d3
commit e299925c5c
2 changed files with 9 additions and 3 deletions

View File

@ -38,13 +38,13 @@ set(INSTALL_INCLUDE_DIR "include/darknet" CACHE PATH "Path where head
set(INSTALL_CMAKE_DIR "share/darknet" CACHE PATH "Path where cmake configs will be installed")
set(ENABLE_OPENCV "TRUE" CACHE BOOL "Enable OpenCV integration")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support")
set(ENABLE_CUDA "TRUE" CACHE BOOL "Enable CUDA support")
set(ENABLE_CUDNN "FALSE" CACHE BOOL "Enable CUDNN")
set(ENABLE_CUDNN_HALF "FALSE" CACHE BOOL "Enable CUDNN Half precision")
if(${CMAKE_VERSION} VERSION_LESS "3.9.0")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
message(WARNING "To build with CUDA support you need CMake 3.9.0+")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
else()
include(CheckLanguage)
check_language(CUDA)
@ -55,8 +55,8 @@ else()
find_package(CUDA REQUIRED)
if(CUDA_VERSION VERSION_LESS "9.0")
message(STATUS "Unsupported CUDA version, please upgrade to CUDA 9+. Disabling CUDA support")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
else()
set(ENABLE_CUDA "TRUE" CACHE BOOL "Enable CUDA support" FORCE)
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
message(STATUS "Building with CUDA flags: " "${CUDA_ARCH_FLAGS}")
if ("arch=compute_75,code=sm_75" IN_LIST CUDA_ARCH_FLAGS)
@ -64,6 +64,9 @@ else()
message(STATUS "Your setup supports half precision!")
endif()
endif()
else()
message(STATUS "Unable to find a CUDA compiler. Disabling CUDA support")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
endif()
endif()

View File

@ -12,6 +12,9 @@ endif()
find_dependency(Stb)
if(@ENABLE_CUDA@)
enable_language(CUDA)
find_dependency(CUDA)
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
if(@CUDNN_FOUND@)
find_dependency(CUDNN)
endif()