2018-02-09 18:30:04 +08:00
|
|
|
ocv_install_example_src(cpp *.cpp *.hpp CMakeLists.txt)
|
|
|
|
|
|
|
|
set(OPENCV_CPP_SAMPLES_REQUIRED_DEPS
|
|
|
|
opencv_core
|
|
|
|
opencv_imgproc
|
|
|
|
opencv_flann
|
|
|
|
opencv_imgcodecs
|
|
|
|
opencv_videoio
|
|
|
|
opencv_highgui
|
|
|
|
opencv_ml
|
|
|
|
opencv_video
|
|
|
|
opencv_objdetect
|
|
|
|
opencv_photo
|
|
|
|
opencv_features2d
|
|
|
|
opencv_calib3d
|
|
|
|
opencv_stitching
|
|
|
|
opencv_videostab
|
|
|
|
opencv_shape
|
|
|
|
${OPENCV_MODULES_PUBLIC}
|
|
|
|
${OpenCV_LIB_COMPONENTS})
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2018-02-09 18:30:04 +08:00
|
|
|
if(NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND)
|
|
|
|
return()
|
|
|
|
endif()
|
2012-02-03 19:26:49 +08:00
|
|
|
|
2018-02-09 18:30:04 +08:00
|
|
|
project(cpp_samples)
|
|
|
|
ocv_include_modules_recurse(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
|
|
|
file(GLOB_RECURSE cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
|
|
|
if(NOT HAVE_OPENGL)
|
|
|
|
ocv_list_filterout(cpp_samples Qt_sample)
|
|
|
|
endif()
|
|
|
|
if(NOT HAVE_opencv_cudaarithm OR NOT HAVE_opencv_cudafilters)
|
|
|
|
ocv_list_filterout(cpp_samples "/gpu/")
|
|
|
|
endif()
|
2018-02-14 17:45:10 +08:00
|
|
|
if(NOT BUILD_opencv_viz OR NOT VTK_USE_FILE)
|
2018-02-09 18:30:04 +08:00
|
|
|
ocv_list_filterout(cpp_samples "/viz/")
|
|
|
|
endif()
|
|
|
|
if(NOT HAVE_IPP_A)
|
|
|
|
ocv_list_filterout(cpp_samples "/ippasync/")
|
|
|
|
endif()
|
|
|
|
ocv_list_filterout(cpp_samples "real_time_pose_estimation/")
|
|
|
|
foreach(sample_filename ${cpp_samples})
|
2018-02-12 23:39:32 +08:00
|
|
|
if(sample_filename MATCHES "/viz/")
|
2018-02-09 18:30:04 +08:00
|
|
|
include(${VTK_USE_FILE})
|
2018-03-20 23:31:01 +08:00
|
|
|
if(COMMAND ocv_warnings_disable) # eliminate warnings from VTK headers (include directory is not "SYSTEM")
|
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Winconsistent-missing-override -Wsuggest-override)
|
|
|
|
endif()
|
2013-06-04 17:32:35 +08:00
|
|
|
endif()
|
2018-02-09 18:30:04 +08:00
|
|
|
set(package "cpp")
|
|
|
|
if(sample_filename MATCHES "tutorial_code")
|
|
|
|
set(package "tutorial")
|
2013-06-04 17:32:35 +08:00
|
|
|
endif()
|
2018-02-09 18:30:04 +08:00
|
|
|
ocv_define_sample(tgt ${sample_filename} ${package})
|
|
|
|
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
2018-02-12 23:39:32 +08:00
|
|
|
if(sample_filename MATCHES "/gpu/" AND HAVE_opencv_cudaarithm AND HAVE_opencv_cuda_filters)
|
2018-02-09 18:30:04 +08:00
|
|
|
ocv_target_link_libraries(${tgt} opencv_cudaarithm opencv_cudafilters)
|
2013-06-04 17:32:35 +08:00
|
|
|
endif()
|
2018-02-12 23:39:32 +08:00
|
|
|
if(sample_filename MATCHES "/viz/")
|
2018-02-09 18:30:04 +08:00
|
|
|
ocv_target_link_libraries(${tgt} ${VTK_LIBRARIES})
|
|
|
|
target_compile_definitions(${tgt} PRIVATE -DUSE_VTK)
|
2012-02-03 19:26:49 +08:00
|
|
|
endif()
|
2018-02-09 18:30:04 +08:00
|
|
|
if(HAVE_OPENGL AND sample_filename MATCHES "detect_mser")
|
|
|
|
target_compile_definitions(${tgt} PRIVATE HAVE_OPENGL)
|
2012-02-03 19:26:49 +08:00
|
|
|
endif()
|
2018-02-09 18:30:04 +08:00
|
|
|
endforeach()
|
2012-06-29 01:23:50 +08:00
|
|
|
|
2018-02-09 18:30:04 +08:00
|
|
|
include("tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt" OPTIONAL)
|