Meta Byte Track
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. macro(ncnn_add_example name)
  2. add_executable(${name} ${name}.cpp)
  3. if(OpenCV_FOUND)
  4. target_include_directories(${name} PRIVATE ${OpenCV_INCLUDE_DIRS})
  5. target_link_libraries(${name} PRIVATE ncnn ${OpenCV_LIBS})
  6. elseif(NCNN_SIMPLEOCV)
  7. target_compile_definitions(${name} PUBLIC USE_NCNN_SIMPLEOCV)
  8. target_link_libraries(${name} PRIVATE ncnn)
  9. endif()
  10. # add test to a virtual project group
  11. set_property(TARGET ${name} PROPERTY FOLDER "examples")
  12. endmacro()
  13. if(NCNN_PIXEL)
  14. find_package(OpenCV QUIET COMPONENTS opencv_world)
  15. # for opencv 2.4 on ubuntu 16.04, there is no opencv_world but OpenCV_FOUND will be TRUE
  16. if("${OpenCV_LIBS}" STREQUAL "")
  17. set(OpenCV_FOUND FALSE)
  18. endif()
  19. if(NOT OpenCV_FOUND)
  20. find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs videoio)
  21. endif()
  22. if(NOT OpenCV_FOUND)
  23. find_package(OpenCV QUIET COMPONENTS core highgui imgproc)
  24. endif()
  25. if(OpenCV_FOUND OR NCNN_SIMPLEOCV)
  26. if(OpenCV_FOUND)
  27. message(STATUS "OpenCV library: ${OpenCV_INSTALL_PATH}")
  28. message(STATUS " version: ${OpenCV_VERSION}")
  29. message(STATUS " libraries: ${OpenCV_LIBS}")
  30. message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
  31. if(${OpenCV_VERSION_MAJOR} GREATER 3)
  32. set(CMAKE_CXX_STANDARD 11)
  33. endif()
  34. endif()
  35. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
  36. include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
  37. include_directories(include)
  38. include_directories(/usr/local/include/eigen3)
  39. ncnn_add_example(squeezenet)
  40. ncnn_add_example(squeezenet_c_api)
  41. ncnn_add_example(fasterrcnn)
  42. ncnn_add_example(rfcn)
  43. ncnn_add_example(yolov2)
  44. ncnn_add_example(yolov3)
  45. if(OpenCV_FOUND)
  46. ncnn_add_example(yolov4)
  47. endif()
  48. ncnn_add_example(yolov5)
  49. ncnn_add_example(yolox)
  50. ncnn_add_example(mobilenetv2ssdlite)
  51. ncnn_add_example(mobilenetssd)
  52. ncnn_add_example(squeezenetssd)
  53. ncnn_add_example(shufflenetv2)
  54. ncnn_add_example(peleenetssd_seg)
  55. ncnn_add_example(simplepose)
  56. ncnn_add_example(retinaface)
  57. ncnn_add_example(yolact)
  58. ncnn_add_example(nanodet)
  59. ncnn_add_example(scrfd)
  60. ncnn_add_example(scrfd_crowdhuman)
  61. ncnn_add_example(rvm)
  62. file(GLOB My_Source_Files src/*.cpp)
  63. add_executable(bytetrack ${My_Source_Files})
  64. if(OpenCV_FOUND)
  65. target_include_directories(bytetrack PRIVATE ${OpenCV_INCLUDE_DIRS})
  66. target_link_libraries(bytetrack PRIVATE ncnn ${OpenCV_LIBS})
  67. elseif(NCNN_SIMPLEOCV)
  68. target_compile_definitions(bytetrack PUBLIC USE_NCNN_SIMPLEOCV)
  69. target_link_libraries(bytetrack PRIVATE ncnn)
  70. endif()
  71. # add test to a virtual project group
  72. set_property(TARGET bytetrack PROPERTY FOLDER "examples")
  73. else()
  74. message(WARNING "OpenCV not found and NCNN_SIMPLEOCV disabled, examples won't be built")
  75. endif()
  76. else()
  77. message(WARNING "NCNN_PIXEL not enabled, examples won't be built")
  78. endif()