CMakeLists.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. if(NOT HAVE_VTK)
  2. ocv_module_disable(viz)
  3. endif()
  4. set(the_description "Viz")
  5. if(NOT BUILD_SHARED_LIBS)
  6. # We observed conflict between builtin 3rdparty libraries and
  7. # system-wide similar libraries (but with different versions) from VTK dependencies
  8. set(_conflicts "")
  9. foreach(dep ${VTK_LIBRARIES})
  10. if(("${dep}" MATCHES "libz\\." AND BUILD_ZLIB)
  11. OR ("${dep}" MATCHES "libjpeg\\." AND BUILD_JPEG)
  12. OR ("${dep}" MATCHES "libpng\\." AND BUILD_PNG)
  13. OR ("${dep}" MATCHES "libtiff\\." AND BUILD_TIFF)
  14. )
  15. list(APPEND _conflicts "${dep}")
  16. endif()
  17. endforeach()
  18. if(_conflicts)
  19. message(STATUS "Disabling VIZ module due to conflicts with VTK dependencies: ${_conflicts}")
  20. ocv_module_disable(viz)
  21. endif()
  22. endif()
  23. ocv_warnings_disable(CMAKE_CXX_FLAGS -Winconsistent-missing-override -Wsuggest-override)
  24. ocv_add_module(viz opencv_core WRAP python)
  25. ocv_glob_module_sources()
  26. ocv_module_include_directories()
  27. ocv_create_module()
  28. ocv_add_accuracy_tests()
  29. ocv_add_perf_tests()
  30. ocv_add_samples(opencv_imgproc opencv_calib3d opencv_features2d opencv_flann)
  31. if (VTK_VERSION VERSION_LESS "8.90.0")
  32. include(${VTK_USE_FILE})
  33. ocv_target_link_libraries(${the_module} PRIVATE ${VTK_LIBRARIES})
  34. else ()
  35. ocv_target_link_libraries(${the_module} PRIVATE ${VTK_LIBRARIES})
  36. if(NOT BUILD_opencv_world OR NOT OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD)
  37. vtk_module_autoinit(TARGETS ${the_module} MODULES ${VTK_LIBRARIES})
  38. endif()
  39. endif()
  40. if(APPLE AND BUILD_opencv_viz)
  41. ocv_target_link_libraries(${the_module} PRIVATE "-framework Cocoa")
  42. endif()
  43. if(TARGET opencv_test_viz)
  44. set_target_properties(opencv_test_viz PROPERTIES MACOSX_BUNDLE TRUE)
  45. endif()