CMakeLists.txt 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. cmake_minimum_required(VERSION 3.0.0)
  2. project(EgoSystem VERSION 1.0.0)
  3. set(USE_LIDAR OFF)
  4. MESSAGE(STATUS "operation system is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
  5. SET (CMAKE_CXX_COMPILER "/usr/bin/clang++-12")
  6. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g2 -ggdb -Wall -Wno-unused-variable -pthread -Wno-attributes")
  7. add_definitions(-DJSONCPP_USING_SECURE_MEMORY=0)
  8. add_definitions(-DWEBRTC_POSIX=1)
  9. add_definitions(-DWEBRTC_LINUX=1)
  10. set(API_DIR ../webrtcinterop/include)
  11. include_directories(${API_DIR})
  12. find_package(PkgConfig REQUIRED)
  13. pkg_check_modules(GLIB_PKG glib-2.0)
  14. if (GLIB_PKG_FOUND)
  15. message(Found glib-2.0)
  16. endif (GLIB_PKG_FOUND)
  17. find_path(MODBUS_INCLUDE_DIR NAMES modbus.h modbus/modbus.h REQUIRED)
  18. message(STATUS "MODBUS_INCLUDE_DIR: ${MODBUS_INCLUDE_DIR}")
  19. message("${protobuf_INCLUDE_DIRS}")
  20. file(GLOB native_srcs "*.cpp")
  21. set(CURDIR ${CMAKE_CURRENT_LIST_DIR})
  22. file(GLOB common_srcs ${CURDIR}/../common/*.cpp)
  23. include_directories(${protobuf_INCLUDE_DIRS})
  24. set(RS_DRIVER ${CURDIR}/../thirdparty/rs_driver)
  25. message(RS_DRIVER "${RS_DRIVER}")
  26. include_directories(${RS_DRIVER})
  27. include_directories(${CURDIR}/../thirdparty/protobuf/include)
  28. include_directories(${CURDIR}/../Protocol/linux/)
  29. file(GLOB proto_srcs ${CURDIR}/../Protocol/linux/*.cc)
  30. file(GLOB lidar_srcs ${CURDIR}/lidar/*.cpp)
  31. link_directories("../webrtcinterop/build")
  32. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  33. link_directories("../thirdparty/webrtc/lib/linux")
  34. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  35. link_directories("../thirdparty/webrtc/lib/aarch64")
  36. link_directories("../thirdparty/protobuf/lib/aarch64")
  37. endif()
  38. include_directories("../thirdparty/Mqtt/inlcude/")
  39. link_directories("../thirdparty/Mqtt/lib/")
  40. include_directories(${CUDA_INCLUDES} ./ ./include ./include/libjpeg-8b /usr/include/libdrm)
  41. aux_source_directory(/usr/src/jetson_multimedia_api/samples/common/classes COMMON)
  42. add_executable(EgoSystem ${native_srcs} ${common_srcs} ${proto_srcs})
  43. find_package(Boost COMPONENTS system REQUIRED)
  44. message(Boost "${Boost_SYSTEM_LIBRARY}")
  45. #list(APPEND EXTERNAL_LIBS pcap)
  46. list(APPEND EXTERNAL_LIBS "-lpthread")
  47. #list(APPEND EXTERNAL_LIBS pcap)
  48. list(APPEND EXTERNAL_LIBS "libprotobuf.a")
  49. target_link_libraries(EgoSystem libwebrtcinterop.a)
  50. target_link_libraries(EgoSystem libwebrtc.a)
  51. target_link_libraries(EgoSystem ${EXTERNAL_LIBS} )
  52. target_link_libraries(EgoSystem libpcanbasic.so.8)
  53. target_link_libraries(EgoSystem libpcanbasic.so)
  54. target_link_libraries(EgoSystem libpcanbasic.so.0)
  55. target_link_libraries(EgoSystem libpaho-mqtt3a.a)
  56. target_link_libraries(EgoSystem libpaho-mqtt3c.a)
  57. target_link_libraries(EgoSystem libjsoncpp.so)
  58. target_link_libraries(EgoSystem ${Boost_SYSTEM_LIBRARY})
  59. target_link_libraries(EgoSystem dl)
  60. target_link_libraries(EgoSystem X11)
  61. target_link_libraries(EgoSystem ${GLIB_LIBRARIES})
  62. link_directories(/usr/lib/aarch64-linux-gnu/tegra /lib/aarch64-linux-gnu /usr/local/lib /usr/lib)
  63. # target_link_libraries(EgoSystem ${CUDA_LIBRARIES} pthread v4l2 EGL GLESv2 X11 nvbufsurface nvbufsurftransform nvjpeg nvosd drm cuda)
  64. target_link_libraries(EgoSystem ${CUDA_LIBRARIES} pthread v4l2 EGL GLESv2 X11 /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurface.so /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurftransform.so
  65. /usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so
  66. /usr/lib/aarch64-linux-gnu/tegra/libnvosd.so
  67. /usr/lib/aarch64-linux-gnu/libdrm.so)