simplify cmake due to minimum project requirement already gone to 3.12

pull/5417/head
Stefano Sinigardi 5 years ago
parent be49ab30cd
commit fe879f3baf
  1. 40
      CMakeLists.txt

@ -48,31 +48,27 @@ set(INSTALL_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Path where lib
set(INSTALL_INCLUDE_DIR "include/darknet" CACHE PATH "Path where headers will be installed")
set(INSTALL_CMAKE_DIR "share/darknet" CACHE PATH "Path where cmake configs will be installed")
if(${CMAKE_VERSION} VERSION_LESS "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()
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER AND ENABLE_CUDA)
set(CUDA_ARCHITECTURES "Auto" CACHE STRING "\"Auto\" detects local machine GPU compute arch at runtime, \"Common\" and \"All\" cover common and entire subsets of architectures, \"Names\" is a list of architectures to enable by name, \"Numbers\" is a list of compute capabilities (version number) to enable")
set_property(CACHE CUDA_ARCHITECTURES PROPERTY STRINGS "Auto" "Common" "All" "Kepler Maxwell Kepler+Tegra Maxwell+Tegra Pascal" "3.0 7.5")
enable_language(CUDA)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER AND ENABLE_CUDA)
set(CUDA_ARCHITECTURES "Auto" CACHE STRING "\"Auto\" detects local machine GPU compute arch at runtime, \"Common\" and \"All\" cover common and entire subsets of architectures, \"Names\" is a list of architectures to enable by name, \"Numbers\" is a list of compute capabilities (version number) to enable")
set_property(CACHE CUDA_ARCHITECTURES PROPERTY STRINGS "Auto" "Common" "All" "Kepler Maxwell Kepler+Tegra Maxwell+Tegra Pascal" "3.0 7.5")
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
if(CMAKE_CUDA_COMPILER_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()
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()
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
message(STATUS "Building with CUDA flags: " "${CUDA_ARCH_FLAGS}")
if (NOT "arch=compute_70,code=sm_70" IN_LIST CUDA_ARCH_FLAGS)
set(ENABLE_CUDNN_HALF "FALSE" CACHE BOOL "Enable CUDNN Half precision" FORCE)
message(STATUS "Your setup does not supports half precision (it requires CC >= 7.5)")
endif()
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
message(STATUS "Building with CUDA flags: " "${CUDA_ARCH_FLAGS}")
if (NOT "arch=compute_70,code=sm_70" IN_LIST CUDA_ARCH_FLAGS)
set(ENABLE_CUDNN_HALF "FALSE" CACHE BOOL "Enable CUDNN Half precision" FORCE)
message(STATUS "Your setup does not supports half precision (it requires CC >= 7.5)")
endif()
else()
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
endif()
else()
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
endif()
if (WIN32 AND ENABLE_CUDA AND CMAKE_MAKE_PROGRAM MATCHES "ninja")

Loading…
Cancel
Save