@ -48,7 +48,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.9.0")
else ( )
include ( CheckLanguage )
check_language ( CUDA )
if ( CMAKE_CUDA_COMPILER )
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 )
@ -65,7 +65,6 @@ else()
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 ( )
@ -83,6 +82,9 @@ if(MSVC)
endif ( )
if ( ENABLE_OPENCV )
find_package ( OpenCV )
if ( OpenCV_FOUND )
list ( APPEND OpenCV_LINKED_COMPONENTS "opencv_video" )
endif ( )
endif ( )
find_package ( Stb REQUIRED )
if ( ${ CMAKE_VERSION } VERSION_LESS "3.11.0" )
@ -126,6 +128,8 @@ if(OpenCV_FOUND)
set ( SKIP_USELIB_TRACK "TRUE" 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" )
else ( )
list ( APPEND OpenCV_LINKED_COMPONENTS "opencv_cudaoptflow" )
endif ( )
endif ( )
@ -276,9 +280,9 @@ if(CUDNN_FOUND)
endif ( )
if ( OpenCV_FOUND )
target_link_libraries ( darknet PRIVATE ${ OpenCV_LIB S } )
target_link_libraries ( uselib PRIVATE ${ OpenCV_LIB S } )
target_link_libraries ( dark PRIVATE ${ OpenCV_LIB S } )
target_link_libraries ( darknet PRIVATE ${ OpenCV_LINKED_COMPONENT S } )
target_link_libraries ( uselib PRIVATE ${ OpenCV_LINKED_COMPONENT S } )
target_link_libraries ( dark PRIVATE ${ OpenCV_LINKED_COMPONENT S } )
target_compile_definitions ( darknet PRIVATE -DOPENCV )
target_compile_definitions ( dark PUBLIC -DOPENCV )
endif ( )
@ -339,7 +343,7 @@ if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRA
target_compile_definitions ( uselib_track PRIVATE -DUSE_CMAKE_LIBS )
# set_target_properties ( uselib_track PROPERTIES LINKER_LANGUAGE CXX )
target_include_directories ( uselib_track PRIVATE ${ CMAKE_CURRENT_LIST_DIR } /include )
target_link_libraries ( uselib_track PRIVATE ${ OpenCV_LIB S } )
target_link_libraries ( uselib_track PRIVATE ${ OpenCV_LINKED_COMPONENT S } )
if ( ENABLE_ZED_CAMERA )
target_link_libraries ( uselib_track PRIVATE ${ ZED_LIBRARIES } )
target_compile_definitions ( uselib_track PRIVATE -DZED_STEREO )