re-enable cuda choice

pull/3573/head
Stefano Sinigardi 6 years ago
parent 5a6afe96d3
commit e299925c5c
  1. 9
      CMakeLists.txt
  2. 3
      DarknetConfig.cmake.in

@ -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(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_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 "FALSE" CACHE BOOL "Enable CUDNN")
set(ENABLE_CUDNN_HALF "FALSE" CACHE BOOL "Enable CUDNN Half precision") set(ENABLE_CUDNN_HALF "FALSE" CACHE BOOL "Enable CUDNN Half precision")
if(${CMAKE_VERSION} VERSION_LESS "3.9.0") 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+") message(WARNING "To build with CUDA support you need CMake 3.9.0+")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
else() else()
include(CheckLanguage) include(CheckLanguage)
check_language(CUDA) check_language(CUDA)
@ -55,8 +55,8 @@ else()
find_package(CUDA REQUIRED) find_package(CUDA REQUIRED)
if(CUDA_VERSION VERSION_LESS "9.0") if(CUDA_VERSION VERSION_LESS "9.0")
message(STATUS "Unsupported CUDA version, please upgrade to CUDA 9+. Disabling CUDA support") message(STATUS "Unsupported CUDA version, please upgrade to CUDA 9+. Disabling CUDA support")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
else() else()
set(ENABLE_CUDA "TRUE" CACHE BOOL "Enable CUDA support" FORCE)
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES}) cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
message(STATUS "Building with CUDA flags: " "${CUDA_ARCH_FLAGS}") message(STATUS "Building with CUDA flags: " "${CUDA_ARCH_FLAGS}")
if ("arch=compute_75,code=sm_75" IN_LIST 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!") message(STATUS "Your setup supports half precision!")
endif() endif()
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()
endif() endif()

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

Loading…
Cancel
Save