mirror of https://github.com/AlexeyAB/darknet.git
move bool from set cache to option
This commit is contained in:
parent
4d135b5992
commit
a57a16998d
|
@ -5,16 +5,25 @@ set(Darknet_MINOR_VERSION 2)
|
|||
set(Darknet_PATCH_VERSION 5)
|
||||
set(Darknet_VERSION ${Darknet_MAJOR_VERSION}.${Darknet_MINOR_VERSION}.${Darknet_PATCH_VERSION})
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE "FALSE" CACHE BOOL "Create verbose makefile")
|
||||
set(BUILD_SHARED_LIBS "TRUE" CACHE BOOL "Create dark as a shared library")
|
||||
option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" OFF)
|
||||
option(CUDA_VERBOSE_BUILD "Create verbose CUDA build" OFF)
|
||||
option(BUILD_SHARED_LIBS "Create dark as a shared library" ON)
|
||||
option(BUILD_AS_CPP "Build Darknet using C++ compiler also for C files" OFF)
|
||||
option(BUILD_USELIB_TRACK "Build uselib_track" ON)
|
||||
option(MANUALLY_EXPORT_TRACK_OPTFLOW "Manually export the TRACK_OPTFLOW=1 define" OFF)
|
||||
option(ENABLE_OPENCV "Enable OpenCV integration" ON)
|
||||
option(ENABLE_CUDA "Enable CUDA support" ON)
|
||||
option(ENABLE_CUDNN "Enable CUDNN" ON)
|
||||
option(ENABLE_CUDNN_HALF "Enable CUDNN Half precision" ON)
|
||||
option(ENABLE_ZED_CAMERA "Enable ZED Camera support" ON)
|
||||
option(ENABLE_VCPKG_INTEGRATION "Enable VCPKG integration" ON)
|
||||
if (WIN32)
|
||||
set(SELECT_OPENCV_MODULES "TRUE" CACHE BOOL "Use only few selected OpenCV modules to circumvent some Ninja+CMake bugs on Windows")
|
||||
option(SELECT_OPENCV_MODULES "Use only few selected OpenCV modules to circumvent some Ninja+CMake bugs on Windows" ON)
|
||||
else()
|
||||
set(SELECT_OPENCV_MODULES "FALSE" CACHE BOOL "Use only few selected OpenCV modules to circumvent some Ninja+CMake bugs on Windows")
|
||||
option(SELECT_OPENCV_MODULES "Use only few selected OpenCV modules to circumvent some Ninja+CMake bugs on Windows" OFF)
|
||||
endif()
|
||||
set(BUILD_AS_CPP "FALSE" CACHE BOOL "Build Darknet using C++ compiler also for C files")
|
||||
|
||||
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
if(ENABLE_VCPKG_INTEGRATION AND DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
|
||||
message(STATUS "VCPKG found: $ENV{VCPKG_ROOT}")
|
||||
message(STATUS "Using VCPKG integration")
|
||||
|
@ -43,11 +52,6 @@ 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")
|
||||
|
||||
set(ENABLE_OPENCV "TRUE" CACHE BOOL "Enable OpenCV integration")
|
||||
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")
|
||||
message(WARNING "To build with CUDA support you need CMake 3.9.0+")
|
||||
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
|
||||
|
@ -65,9 +69,9 @@ else()
|
|||
else()
|
||||
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)
|
||||
set(ENABLE_CUDNN_HALF "TRUE" CACHE BOOL "Enable CUDNN Half precision" FORCE)
|
||||
message(STATUS "Your setup supports half precision!")
|
||||
if (NOT "arch=compute_75,code=sm_75" 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()
|
||||
endif()
|
||||
else()
|
||||
|
@ -156,10 +160,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a")
|
||||
endif()
|
||||
|
||||
set(SKIP_USELIB_TRACK "FALSE" CACHE BOOL "Skip building uselib_track" FORCE)
|
||||
if(OpenCV_FOUND)
|
||||
if(ENABLE_CUDA AND NOT OpenCV_CUDA_VERSION)
|
||||
set(SKIP_USELIB_TRACK "TRUE" CACHE BOOL "Skip building uselib_track" FORCE)
|
||||
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Skip building uselib_track" FORCE)
|
||||
message(STATUS " -> darknet is fine for now, but uselib_track has been disabled!")
|
||||
message(STATUS " -> Please rebuild OpenCV from sources with CUDA support to enable it")
|
||||
elseif(ENABLE_CUDA AND OpenCV_CUDA_VERSION)
|
||||
|
@ -174,8 +177,8 @@ endif()
|
|||
|
||||
if(ENABLE_CUDA)
|
||||
find_package(CUDNN)
|
||||
if(CUDNN_FOUND)
|
||||
set(ENABLE_CUDNN "TRUE" CACHE BOOL "Enable CUDNN" FORCE)
|
||||
if(NOT CUDNN_FOUND)
|
||||
set(ENABLE_CUDNN "FALSE" CACHE BOOL "Enable CUDNN" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -206,7 +209,6 @@ if(ENABLE_CUDA)
|
|||
message(STATUS "CMAKE_CUDA_FLAGS: ${CMAKE_CUDA_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(ENABLE_ZED_CAMERA "TRUE" CACHE BOOL "Enable ZED Camera support")
|
||||
if(ENABLE_CUDA)
|
||||
if(ENABLE_ZED_CAMERA)
|
||||
find_package(ZED 2 QUIET)
|
||||
|
@ -292,7 +294,7 @@ if(BUILD_AS_CPP)
|
|||
set_target_properties(dark PROPERTIES LINKER_LANGUAGE CXX)
|
||||
endif()
|
||||
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND BUILD_USELIB_TRACK)
|
||||
add_executable(uselib_track ${CMAKE_CURRENT_LIST_DIR}/src/yolo_console_dll.cpp)
|
||||
endif()
|
||||
|
||||
|
@ -315,6 +317,10 @@ target_compile_definitions(darknet PRIVATE -DUSE_CMAKE_LIBS)
|
|||
target_compile_definitions(dark PRIVATE -DUSE_CMAKE_LIBS)
|
||||
target_compile_definitions(uselib PRIVATE -DUSE_CMAKE_LIBS)
|
||||
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND BUILD_USELIB_TRACK AND NOT MANUALLY_EXPORT_TRACK_OPTFLOW)
|
||||
target_compile_definitions(dark PUBLIC TRACK_OPTFLOW=1)
|
||||
endif()
|
||||
|
||||
if(CUDNN_FOUND)
|
||||
target_link_libraries(darknet PRIVATE CuDNN::CuDNN)
|
||||
target_link_libraries(dark PRIVATE CuDNN::CuDNN)
|
||||
|
@ -388,7 +394,7 @@ if(USE_INTEGRATED_LIBS)
|
|||
endif()
|
||||
|
||||
target_link_libraries(uselib PRIVATE dark)
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND BUILD_USELIB_TRACK)
|
||||
target_link_libraries(uselib_track PRIVATE dark)
|
||||
target_compile_definitions(uselib_track PRIVATE TRACK_OPTFLOW=1)
|
||||
target_compile_definitions(uselib_track PRIVATE -DUSE_CMAKE_LIBS)
|
||||
|
@ -423,7 +429,7 @@ install(TARGETS dark EXPORT DarknetTargets
|
|||
install(TARGETS uselib darknet
|
||||
DESTINATION "${INSTALL_BIN_DIR}"
|
||||
)
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
|
||||
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND BUILD_USELIB_TRACK)
|
||||
install(TARGETS uselib_track
|
||||
DESTINATION "${INSTALL_BIN_DIR}"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue