CMakeLists.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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++-12")
  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 -pthread ")
  15. #endif()
  16. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g2 -ggdb -Wall -Wno-unused-variable -pthread -Wno-attributes")
  17. add_definitions(-DJSONCPP_USING_SECURE_MEMORY=0)
  18. add_definitions(-DWEBRTC_POSIX=1)
  19. add_definitions(-DWEBRTC_LINUX=1)
  20. set(API_DIR ../webrtcinterop/include)
  21. include_directories(${API_DIR})
  22. find_package(PkgConfig REQUIRED)
  23. pkg_check_modules(GLIB_PKG glib-2.0)
  24. if (GLIB_PKG_FOUND)
  25. message(Found glib-2.0)
  26. endif (GLIB_PKG_FOUND)
  27. find_path(MODBUS_INCLUDE_DIR NAMES modbus.h modbus/modbus.h REQUIRED)
  28. message(STATUS "MODBUS_INCLUDE_DIR: ${MODBUS_INCLUDE_DIR}")
  29. message("${protobuf_INCLUDE_DIRS}")
  30. file(GLOB native_srcs "*.cpp")
  31. set(CURDIR ${CMAKE_CURRENT_LIST_DIR})
  32. file(GLOB common_srcs ${CURDIR}/../common/*.cpp)
  33. include_directories(${protobuf_INCLUDE_DIRS})
  34. set(RS_DRIVER ${CURDIR}/../thirdparty/rs_driver)
  35. message(RS_DRIVER "${RS_DRIVER}")
  36. include_directories(${RS_DRIVER})
  37. include_directories(${CURDIR}/../thirdparty/protobuf/include)
  38. include_directories(${CURDIR}/../Protocol/linux/)
  39. file(GLOB proto_srcs ${CURDIR}/../Protocol/linux/*.cc)
  40. file(GLOB lidar_srcs ${CURDIR}/lidar/*.cpp)
  41. link_directories("../webrtcinterop/build")
  42. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  43. link_directories("../thirdparty/webrtc/lib/linux")
  44. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  45. link_directories("../thirdparty/webrtc/lib/aarch64")
  46. link_directories("../thirdparty/protobuf/lib/aarch64")
  47. endif()
  48. include_directories("../thirdparty/Mqtt/inlcude/")
  49. link_directories("../thirdparty/Mqtt/lib/")
  50. add_executable(EgoSystem ${native_srcs} ${common_srcs} ${proto_srcs})
  51. find_package(Boost COMPONENTS system REQUIRED)
  52. message(Boost "${Boost_SYSTEM_LIBRARY}")
  53. #find_library(
  54. # UDEV_LIB
  55. # udev
  56. #)
  57. #list(APPEND EXTERNAL_LIBS pcap)
  58. list(APPEND EXTERNAL_LIBS "-lpthread")
  59. #list(APPEND EXTERNAL_LIBS pcap)
  60. list(APPEND EXTERNAL_LIBS "libprotobuf.a")
  61. target_link_libraries(EgoSystem libwebrtcinterop.a)
  62. target_link_libraries(EgoSystem libwebrtc.a)
  63. target_link_libraries(EgoSystem ${EXTERNAL_LIBS} )
  64. target_link_libraries(EgoSystem libpcanbasic.so.8)
  65. target_link_libraries(EgoSystem libpcanbasic.so)
  66. target_link_libraries(EgoSystem libpcanbasic.so.0)
  67. target_link_libraries(EgoSystem libpaho-mqtt3a.a)
  68. target_link_libraries(EgoSystem libpaho-mqtt3c.a)
  69. target_link_libraries(EgoSystem libjsoncpp.so)
  70. target_link_libraries(EgoSystem ${Boost_SYSTEM_LIBRARY})
  71. target_link_libraries(EgoSystem dl)
  72. target_link_libraries(EgoSystem X11)
  73. target_link_libraries(EgoSystem ${GLIB_LIBRARIES})