CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ocv_install_example_src(gpu *.cpp *.hpp CMakeLists.txt)
  2. set(OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
  3. opencv_core
  4. opencv_flann
  5. opencv_imgproc
  6. opencv_imgcodecs
  7. opencv_videoio
  8. opencv_highgui
  9. opencv_ml
  10. opencv_video
  11. opencv_objdetect
  12. opencv_features2d
  13. opencv_calib3d
  14. opencv_superres
  15. opencv_cudaarithm
  16. opencv_cudafilters
  17. opencv_cudawarping
  18. opencv_cudaimgproc
  19. opencv_cudafeatures2d
  20. opencv_cudaoptflow
  21. opencv_cudabgsegm
  22. opencv_cudastereo
  23. opencv_cudaobjdetect)
  24. ocv_check_dependencies(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
  25. if(NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND)
  26. return()
  27. endif()
  28. project(gpu_samples)
  29. if(HAVE_CUDA OR CUDA_FOUND)
  30. add_definitions(-DHAVE_CUDA=1)
  31. endif()
  32. if(COMMAND ocv_warnings_disable)
  33. ocv_warnings_disable(CMAKE_CXX_FLAGS -Wsuggest-override -Winconsistent-missing-override)
  34. endif()
  35. ocv_include_modules_recurse(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
  36. if(HAVE_opencv_xfeatures2d)
  37. ocv_include_modules_recurse(opencv_xfeatures2d)
  38. endif()
  39. if(HAVE_opencv_cudacodec)
  40. ocv_include_modules_recurse(opencv_cudacodec)
  41. endif()
  42. if(HAVE_CUDA)
  43. ocv_include_directories(${CUDA_INCLUDE_DIRS})
  44. endif()
  45. if((CV_GCC OR CV_CLANG) AND NOT ENABLE_NOISY_WARNINGS)
  46. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
  47. endif()
  48. file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
  49. foreach(sample_filename ${all_samples})
  50. ocv_define_sample(tgt ${sample_filename} gpu)
  51. ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
  52. if(HAVE_opencv_xfeatures2d)
  53. ocv_target_link_libraries(${tgt} PRIVATE opencv_xfeatures2d)
  54. endif()
  55. if(HAVE_opencv_cudacodec)
  56. ocv_target_link_libraries(${tgt} PRIVATE opencv_cudacodec)
  57. endif()
  58. endforeach()