CMakeLists.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  6. SET (CMAKE_C_COMPILER "/usr/bin/clang")
  7. SET (CMAKE_CXX_COMPILER "/usr/bin/clang++")
  8. SET (CMAKE_AR "/usr/bin/llvm-ar")
  9. SET (CMAKE_LINKER "/usr/bin/llvm-ld")
  10. SET (CMAKE_NM "/usr/bin/llvm-nm")
  11. SET (CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
  12. ENDIF()
  13. if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
  14. #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g2 -ggdb -Wall -Wno-unused-variable -I /usr/local/ffmpeg/include -L /usr/local/ffmpeg/lib -pthread -lavformat -lavutil -lavdevice -lavcodec ")
  15. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g2 -ggdb -Wall -Wno-unused-variable -pthread")
  16. endif()
  17. add_definitions(-DJSONCPP_USING_SECURE_MEMORY=0)
  18. #set(ffmpeg_libs_DIR /usr/local/ffmpeg/lib)
  19. #set(ffmpeg_headers_DIR /usr/local/ffmpeg/include)
  20. #include_directories( ${ffmpeg_headers_DIR} )
  21. #link_directories(${ffmpeg_libs_DIR} )
  22. add_definitions(-DWEBRTC_POSIX=1)
  23. add_definitions(-DWEBRTC_LINUX=1)
  24. set(API_DIR ../webrtcinterop/include)
  25. include_directories(${API_DIR})
  26. #find_package(protobuf REQUIRED)
  27. find_package(PkgConfig REQUIRED)
  28. pkg_check_modules(GLIB_PKG glib-2.0)
  29. if (GLIB_PKG_FOUND)
  30. message(Found glib-2.0)
  31. endif (GLIB_PKG_FOUND)
  32. #pkg_check_modules(PC_LIBUDEV libudev)
  33. #if(PC_LIBUDEV_FOUND)
  34. # message(Found libudev)
  35. #endif(PC_LIBUDEV_FOUND)123456
  36. #find_package(protobuf REQUIRED)
  37. find_path(MODBUS_INCLUDE_DIR NAMES modbus.h modbus/modbus.h REQUIRED)
  38. message(STATUS "MODBUS_INCLUDE_DIR: ${MODBUS_INCLUDE_DIR}")
  39. message("${protobuf_INCLUDE_DIRS}")
  40. file(GLOB native_srcs "*.cpp")
  41. set(CURDIR ${CMAKE_CURRENT_LIST_DIR})
  42. file(GLOB common_srcs ${CURDIR}/../common/*.cpp)
  43. include_directories(${protobuf_INCLUDE_DIRS})
  44. set(RS_DRIVER ${CURDIR}/../thirdparty/rs_driver)
  45. message(RS_DRIVER "${RS_DRIVER}")
  46. include_directories(${RS_DRIVER})
  47. include_directories(${CURDIR}/../thirdparty/protobuf/include)
  48. include_directories(${CURDIR}/../Protocol/linux/)
  49. file(GLOB proto_srcs ${CURDIR}/../Protocol/linux/*.cc)
  50. file(GLOB lidar_srcs ${CURDIR}/lidar/*.cpp)
  51. link_directories("../webrtcinterop/build")
  52. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  53. link_directories("../thirdparty/webrtc/lib/linux")
  54. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  55. link_directories("../thirdparty/webrtc/lib/aarch64")
  56. link_directories("../thirdparty/protobuf/lib/aarch64")
  57. endif()
  58. include_directories("../thirdparty/Mqtt/inlcude/")
  59. link_directories("../thirdparty/Mqtt/lib/")
  60. #message(lidar "${lidar_srcs}")
  61. add_executable(EgoSystem ${native_srcs} ${common_srcs} ${proto_srcs})
  62. #target_link_libraries(EgoSystem /usr/local/ffmpeg/lib/libavcodec.so)
  63. #target_link_libraries(EgoSystem /usr/local/ffmpeg/lib/libavdevice.so)
  64. #target_link_libraries(EgoSystem /usr/local/ffmpeg/lib/libavformat.so)
  65. #target_link_libraries(EgoSystem /usr/local/ffmpeg/lib/libavutil.so)
  66. find_package(Boost COMPONENTS system REQUIRED)
  67. message(Boost "${Boost_SYSTEM_LIBRARY}")
  68. #find_library(
  69. # UDEV_LIB
  70. # udev
  71. #)
  72. #list(APPEND EXTERNAL_LIBS pcap)
  73. list(APPEND EXTERNAL_LIBS "-lpthread")
  74. #list(APPEND EXTERNAL_LIBS pcap)
  75. list(APPEND EXTERNAL_LIBS "libprotobuf.a")
  76. target_link_libraries(EgoSystem libwebrtcinterop.a)
  77. target_link_libraries(EgoSystem libwebrtc.a)
  78. target_link_libraries(EgoSystem ${EXTERNAL_LIBS} )
  79. #target_link_libraries(EgoSystem /usr/local/lib/libprotobuf.so)
  80. #target_link_libraries(EgoSystem /usr/local/lib/libsensors.a)
  81. target_link_libraries(EgoSystem libmodbus.so)
  82. target_link_libraries(EgoSystem libpaho-mqtt3a.a)
  83. target_link_libraries(EgoSystem libpaho-mqtt3c.a)
  84. target_link_libraries(EgoSystem libpcanbasic.so.8)
  85. target_link_libraries(EgoSystem libpcanbasic.so)
  86. target_link_libraries(EgoSystem libpcanbasic.so.0)
  87. target_link_libraries(EgoSystem libjsoncpp.so)
  88. target_link_libraries(EgoSystem ${Boost_SYSTEM_LIBRARY})
  89. target_link_libraries(EgoSystem dl)
  90. target_link_libraries(EgoSystem X11)
  91. target_link_libraries(EgoSystem ${GLIB_LIBRARIES})
  92. #target_link_libraries(EgoSystem ${PC_LIBUDEV_LIBRARIES})
  93. #target_link_libraries(EgoSystem ${UDEV_LIB})
  94. #find_library(MODBUS_LIBRARY NAMES modbus REQUIRED)
  95. #target_link_libraries(EgoSystem ${MODBUS_LIBRARY})