CMakeLists.txt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. cmake_minimum_required(VERSION 3.10)
  2. project(rtsp_multi_view C)
  3. set(CMAKE_C_STANDARD 11)
  4. set(CMAKE_C_STANDARD_REQUIRED OFF)
  5. find_package(PkgConfig REQUIRED)
  6. pkg_check_modules(GST REQUIRED gstreamer-1.0 gstreamer-app-1.0
  7. gstreamer-video-1.0 gstreamer-allocators-1.0)
  8. pkg_check_modules(RGA REQUIRED librga)
  9. pkg_check_modules(DRM REQUIRED libdrm)
  10. pkg_check_modules(PNG REQUIRED libpng)
  11. pkg_check_modules(JPEG REQUIRED libjpeg)
  12. pkg_check_modules(FT REQUIRED freetype2)
  13. pkg_check_modules(CURL REQUIRED libcurl)
  14. include_directories(${CMAKE_SOURCE_DIR}
  15. ${GST_INCLUDE_DIRS}
  16. ${RGA_INCLUDE_DIRS}
  17. ${DRM_INCLUDE_DIRS}
  18. ${PNG_INCLUDE_DIRS}
  19. ${JPEG_INCLUDE_DIRS}
  20. ${FT_INCLUDE_DIRS}
  21. ${CURL_INCLUDE_DIRS}
  22. /usr/include/rockchip)
  23. link_directories(${GST_LIBRARY_DIRS}
  24. ${RGA_LIBRARY_DIRS}
  25. ${DRM_LIBRARY_DIRS}
  26. ${PNG_LIBRARY_DIRS}
  27. ${JPEG_LIBRARY_DIRS}
  28. ${FT_LIBRARY_DIRS}
  29. ${CURL_LIBRARY_DIRS})
  30. function(common_cflags tgt)
  31. target_compile_options(${tgt} PRIVATE -Wall -Wextra -O2)
  32. endfunction()
  33. add_executable(rtsp_multi_view
  34. main.c
  35. decoder.c
  36. composer.c
  37. display.c
  38. plc.c
  39. title.c
  40. flog.c
  41. hikvision.c
  42. dma_util.c
  43. web_server.c
  44. )
  45. target_link_libraries(rtsp_multi_view
  46. ${GST_LIBRARIES}
  47. ${RGA_LIBRARIES}
  48. ${DRM_LIBRARIES}
  49. ${PNG_LIBRARIES}
  50. ${JPEG_LIBRARIES}
  51. ${FT_LIBRARIES}
  52. ${CURL_LIBRARIES}
  53. rockchip_mpp
  54. pthread
  55. dl
  56. m
  57. )
  58. common_cflags(rtsp_multi_view)
  59. # --- Unit tests / benchmarks ---
  60. add_executable(test_dma_heap test_dma_heap.c dma_util.c)
  61. target_link_libraries(test_dma_heap ${DRM_LIBRARIES})
  62. common_cflags(test_dma_heap)
  63. add_executable(test_drm_display test_drm_display.c)
  64. target_link_libraries(test_drm_display ${DRM_LIBRARIES})
  65. common_cflags(test_drm_display)
  66. add_executable(test_rga test_rga.c)
  67. target_link_libraries(test_rga ${RGA_LIBRARIES} ${DRM_LIBRARIES})
  68. common_cflags(test_rga)
  69. add_executable(test_rga_color test_rga_color.c)
  70. target_link_libraries(test_rga_color ${RGA_LIBRARIES} ${DRM_LIBRARIES})
  71. common_cflags(test_rga_color)
  72. # RKNN detection benchmark (not part of the main binary; needs rknnrt)
  73. add_executable(test_detector_bench test_detector_bench.c detector.c dma_util.c)
  74. target_link_libraries(test_detector_bench ${RGA_LIBRARIES} ${DRM_LIBRARIES}
  75. rknnrt rockchip_mpp pthread dl m)
  76. common_cflags(test_detector_bench)
  77. target_include_directories(test_detector_bench PRIVATE ${CMAKE_SOURCE_DIR})
  78. add_executable(test_plc test_plc.c plc.c flog.c)
  79. target_link_libraries(test_plc pthread)
  80. common_cflags(test_plc)
  81. add_executable(plc_sim plc_sim.c)
  82. target_link_libraries(plc_sim pthread)
  83. common_cflags(plc_sim)