opencv/samples/cpp/CMakeLists.txt
Vadim Pisarevsky 2ed6d0f590
Merge pull request #26469 from vpisarev:move_gapi_to_contrib_part1
Removed g-api from the main repo #26469

Following #25000.
CI patch: https://github.com/opencv/ci-gha-workflow/pull/196

This is migration of G-API from opencv to opencv_contrib, part 1.
Here we simply remove G-API from the main repo. The next patch should bring G-API to opencv_contrib.

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-11-19 10:29:24 +03:00

82 lines
2.9 KiB
CMake

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_video
opencv_objdetect
opencv_photo
opencv_features
opencv_3d
opencv_stereo
opencv_calib
opencv_stitching
opencv_dnn
${OPENCV_MODULES_PUBLIC}
${OpenCV_LIB_COMPONENTS})
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
if(NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND)
return()
endif()
set(DEPS_example_snippet_imgproc_segmentation opencv_core opencv_imgproc)
set(DEPS_example_cpp_intelligent_scissors opencv_core opencv_imgproc opencv_imgcodecs opencv_highgui)
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_opencv_cudaarithm OR NOT HAVE_opencv_cudafilters)
ocv_list_filterout(cpp_samples "/gpu/")
endif()
ocv_list_filterout(cpp_samples "real_time_pose_estimation/")
ocv_list_filterout(cpp_samples "parallel_backend/")
foreach(sample_filename ${cpp_samples})
set(package "cpp")
if(sample_filename MATCHES "tutorial_code/snippet")
set(package "snippet")
elseif(sample_filename MATCHES "tutorial_code")
set(package "tutorial")
endif()
ocv_define_sample(tgt ${sample_filename} ${package})
set(deps ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
if(DEFINED DEPS_${tgt})
set(deps ${DEPS_${tgt}})
endif()
ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${deps})
if(sample_filename MATCHES "/gpu/" AND HAVE_opencv_cudaarithm AND HAVE_opencv_cuda_filters)
ocv_target_link_libraries(${tgt} PRIVATE opencv_cudaarithm opencv_cudafilters)
endif()
if(sample_filename MATCHES "/viz/")
ocv_target_link_libraries(${tgt} PRIVATE ${VTK_LIBRARIES})
target_compile_definitions(${tgt} PRIVATE -DUSE_VTK)
endif()
if(HAVE_OPENGL AND sample_filename MATCHES "detect_mser")
target_compile_definitions(${tgt} PRIVATE HAVE_OPENGL)
ocv_target_link_libraries(${tgt} PRIVATE "${OPENGL_LIBRARIES}")
endif()
if(sample_filename MATCHES "simd_")
# disabled intentionally - demonstration purposes only
#target_include_directories(${tgt} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
#target_compile_definitions(${tgt} PRIVATE OPENCV_SIMD_CONFIG_HEADER=opencv_simd_config_custom.hpp)
#target_compile_definitions(${tgt} PRIVATE OPENCV_SIMD_CONFIG_INCLUDE_DIR=1)
#target_compile_options(${tgt} PRIVATE -mavx2)
endif()
endforeach()
include("tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt" OPTIONAL)
# Standalone samples only
if(OpenCV_FOUND AND NOT CMAKE_VERSION VERSION_LESS "3.1")
add_subdirectory("example_cmake")
endif()
if(OpenCV_FOUND AND NOT CMAKE_VERSION VERSION_LESS "3.9"
AND NOT OPENCV_EXAMPLES_SKIP_PARALLEL_BACKEND
)
add_subdirectory("tutorial_code/core/parallel_backend")
endif()