CMakeLists.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. set(BUILD_opencv_cnn_3dobj_INIT OFF) # Must be disabled by default - requires custom build of Caffe.
  2. if(NOT BUILD_opencv_cnn_3dobj)
  3. return()
  4. endif()
  5. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
  6. find_package(Caffe)
  7. if(Caffe_FOUND)
  8. message(STATUS "Caffe: YES")
  9. set(HAVE_CAFFE 1)
  10. else()
  11. message(STATUS "Caffe: NO")
  12. endif()
  13. if(NOT BUILD_PROTOBUF)
  14. find_package(Protobuf)
  15. endif()
  16. if(Protobuf_FOUND)
  17. message(STATUS "Protobuf: YES")
  18. set(HAVE_PROTOBUF 1)
  19. else()
  20. message(STATUS "Protobuf: NO")
  21. endif()
  22. find_package(Glog)
  23. if(Glog_FOUND)
  24. message(STATUS "Glog: YES")
  25. set(HAVE_GLOG 1)
  26. else()
  27. message(STATUS "Glog: NO")
  28. endif()
  29. if(NOT HAVE_CAFFE)
  30. ocv_module_disable(cnn_3dobj)
  31. else()
  32. include_directories(${CMAKE_CURRENT_BINARY_DIR})
  33. include_directories(${Caffe_INCLUDE_DIR})
  34. set(the_description "CNN for 3D object recognition and pose estimation including a completed Sphere View on 3D objects")
  35. ocv_define_module(cnn_3dobj opencv_core opencv_imgproc ${Caffe_LIBS} ${Glog_LIBS} ${Protobuf_LIBS} OPTIONAL opencv_features2d opencv_viz opencv_calib3d WRAP python)
  36. ocv_add_testdata(testdata/cv contrib/cnn_3dobj)
  37. if(TARGET opencv_test_cnn_3dobj)
  38. target_link_libraries(opencv_test_cnn_3dobj PUBLIC boost_system)
  39. endif()
  40. foreach(exe_TGT classify video sphereview_data model_analysis)
  41. if(TARGET example_cnn_3dobj_${exe_TGT})
  42. target_link_libraries(example_cnn_3dobj_${exe_TGT} PUBLIC boost_system)
  43. endif()
  44. endforeach()
  45. endif()