2018-02-09 18:30:04 +08:00
|
|
|
ocv_install_example_src(gpu *.cpp *.hpp CMakeLists.txt)
|
|
|
|
|
|
|
|
set(OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
|
|
|
|
opencv_core
|
|
|
|
opencv_flann
|
|
|
|
opencv_imgproc
|
|
|
|
opencv_imgcodecs
|
|
|
|
opencv_videoio
|
|
|
|
opencv_highgui
|
|
|
|
opencv_ml
|
|
|
|
opencv_video
|
|
|
|
opencv_objdetect
|
|
|
|
opencv_features2d
|
2020-12-02 04:42:15 +08:00
|
|
|
opencv_3d
|
2018-02-09 18:30:04 +08:00
|
|
|
opencv_superres
|
|
|
|
opencv_cudaarithm
|
|
|
|
opencv_cudafilters
|
|
|
|
opencv_cudawarping
|
|
|
|
opencv_cudaimgproc
|
|
|
|
opencv_cudafeatures2d
|
|
|
|
opencv_cudaoptflow
|
|
|
|
opencv_cudabgsegm
|
|
|
|
opencv_cudastereo
|
|
|
|
opencv_cudaobjdetect)
|
2013-07-24 17:55:18 +08:00
|
|
|
ocv_check_dependencies(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2018-02-09 18:30:04 +08:00
|
|
|
if(NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND)
|
|
|
|
return()
|
|
|
|
endif()
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2018-02-09 18:30:04 +08:00
|
|
|
project(gpu_samples)
|
2018-09-04 02:56:04 +08:00
|
|
|
if(HAVE_CUDA OR CUDA_FOUND)
|
|
|
|
add_definitions(-DHAVE_CUDA=1)
|
|
|
|
endif()
|
2018-04-05 18:44:44 +08:00
|
|
|
if(COMMAND ocv_warnings_disable)
|
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wsuggest-override -Winconsistent-missing-override)
|
|
|
|
endif()
|
2018-02-09 18:30:04 +08:00
|
|
|
ocv_include_modules_recurse(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
|
|
|
|
if(HAVE_opencv_xfeatures2d)
|
|
|
|
ocv_include_modules_recurse(opencv_xfeatures2d)
|
|
|
|
endif()
|
|
|
|
if(HAVE_opencv_cudacodec)
|
|
|
|
ocv_include_modules_recurse(opencv_cudacodec)
|
|
|
|
endif()
|
|
|
|
if(HAVE_CUDA)
|
|
|
|
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
|
|
|
endif()
|
2018-03-26 19:30:49 +08:00
|
|
|
if((CV_GCC OR CV_CLANG) AND NOT ENABLE_NOISY_WARNINGS)
|
2018-02-09 18:30:04 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
|
|
|
|
endif()
|
|
|
|
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
|
|
|
foreach(sample_filename ${all_samples})
|
|
|
|
ocv_define_sample(tgt ${sample_filename} gpu)
|
2019-12-13 22:52:40 +08:00
|
|
|
ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
|
2014-08-22 21:33:24 +08:00
|
|
|
if(HAVE_opencv_xfeatures2d)
|
2019-12-13 22:52:40 +08:00
|
|
|
ocv_target_link_libraries(${tgt} PRIVATE opencv_xfeatures2d)
|
2013-03-15 18:09:39 +08:00
|
|
|
endif()
|
2013-07-23 18:29:21 +08:00
|
|
|
if(HAVE_opencv_cudacodec)
|
2019-12-13 22:52:40 +08:00
|
|
|
ocv_target_link_libraries(${tgt} PRIVATE opencv_cudacodec)
|
2012-10-17 07:18:30 +08:00
|
|
|
endif()
|
2018-02-09 18:30:04 +08:00
|
|
|
endforeach()
|