From e299925c5c51829e7704ed883b6ec6d4b18984ae Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 9 Jul 2019 10:39:48 +0200 Subject: [PATCH] re-enable cuda choice --- CMakeLists.txt | 9 ++++++--- DarknetConfig.cmake.in | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3024a777..e4a6d624 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/DarknetConfig.cmake.in b/DarknetConfig.cmake.in index 169cfa9b..1f0e2864 100644 --- a/DarknetConfig.cmake.in +++ b/DarknetConfig.cmake.in @@ -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()