CMakeLists.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. cmake_minimum_required(VERSION 3.0.0)
  2. project(EgoSystem VERSION 1.0.0)
  3. MESSAGE(STATUS "operation system is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
  4. #IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  5. # SET (CMAKE_C_COMPILER "/usr/bin/clang")
  6. # SET (CMAKE_CXX_COMPILER "/usr/bin/clang++")
  7. # SET (CMAKE_AR "/usr/bin/llvm-ar")
  8. # SET (CMAKE_LINKER "/usr/bin/llvm-link")
  9. # SET (CMAKE_NM "/usr/bin/llvm-nm")
  10. # SET (CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
  11. #ENDIF()
  12. if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
  13. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g2 -ggdb -Wall -Wno-unused-variable -pthread")
  14. endif()
  15. add_definitions(-DJSONCPP_USING_SECURE_MEMORY=0)
  16. #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations -Wno-deprecated-declarations -pthread -g -Wall -Wno-unused-variable -DWEBRTC_POSIX=1 -DWEBRTC_LINUX=1")
  17. add_definitions(-DWEBRTC_POSIX=1)
  18. add_definitions(-DWEBRTC_LINUX=1)
  19. set(WEBRTC_DIR ../thirdparty/webrtc)
  20. set(API_DIR ../webrtcinterop/include)
  21. include_directories(${API_DIR})
  22. include_directories(${WEBRTC_DIR}/include)
  23. include_directories(${WEBRTC_DIR}/include/third_party/abseil-cpp)
  24. include_directories(${WEBRTC_DIR}/include/third_party/libyuv/include)
  25. include_directories(${WEBRTC_DIR}/include/third_party/jsoncpp/source/include)
  26. include_directories(${WEBRTC_DIR}/include/third_party/jsoncpp/generated)
  27. #find_package(OpenCV REQUIRED)
  28. find_package(PkgConfig REQUIRED)
  29. pkg_check_modules(GLIB_PKG glib-2.0)
  30. if (GLIB_PKG_FOUND)
  31. message(Found glib-2.0)
  32. endif (GLIB_PKG_FOUND)
  33. #pkg_check_modules(PC_LIBUDEV libudev)
  34. #if(PC_LIBUDEV_FOUND)
  35. # message(Found libudev)
  36. #endif(PC_LIBUDEV_FOUND)
  37. file(GLOB native_srcs "*.cpp")
  38. set(CURDIR ${CMAKE_CURRENT_LIST_DIR})
  39. file(GLOB common_srcs ${CURDIR}/../common/*.cpp)
  40. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  41. include_directories("../thirdparty/protobuf/include")
  42. ELSE()
  43. find_package(Protobuf REQUIRED)
  44. message("found ${Protobuf_INCLUDE_DIRS}")
  45. include_directories(${Protobuf_INCLUDE_DIRS})
  46. include_directories("../thirdparty/Eigen/eigen3")
  47. ENDIF()
  48. #set(RS_DRIVER ${CURDIR}/../thirdparty/rs_driver)
  49. #message(RS_DRIVER "${RS_DRIVER}")
  50. #include_directories(${RS_DRIVER})
  51. #include_directories(${CURDIR}/../thirdparty/protobuf/include)
  52. include_directories(${CURDIR}/../thirdparty/webrtc/include)
  53. include_directories(${CURDIR}/../protocol/linux/)
  54. file(GLOB proto_srcs ${CURDIR}/../protocol/linux/protocol.pb.cc)
  55. #file(GLOB lidar_srcs ${CURDIR}/lidar/*.cpp)
  56. link_directories("../webrtcinterop/build")
  57. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  58. link_directories("../thirdparty/webrtc/lib/linux")
  59. message(${CURDIR}../thirdparty/protobuf/lib/x64)
  60. link_directories(${CURDIR}/../thirdparty/protobuf/lib/x64)
  61. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  62. link_directories("../thirdparty/webrtc/lib/aarch64")
  63. #link_directories("../thirdparty/protobuf/lib/aarch64")
  64. endif()
  65. #message(lidar "${lidar_srcs}")
  66. add_executable(EgoSystem ${native_srcs} ${common_srcs} ${proto_srcs})
  67. find_package(Boost COMPONENTS system REQUIRED)
  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 "libprotobuf.a")
  75. #target_link_libraries(EgoSystem pthread)
  76. target_link_libraries(EgoSystem libwebrtcinterop.a)
  77. target_link_libraries(EgoSystem libwebrtc.a)
  78. target_link_libraries(EgoSystem libsensors.a)
  79. target_link_libraries(EgoSystem -lpthread )
  80. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  81. target_link_libraries(EgoSystem libprotobuf.a)
  82. ELSE()
  83. target_link_libraries(EgoSystem ${Protobuf_LIBRARIES})
  84. ENDIF()
  85. target_link_libraries(EgoSystem libjsoncpp.so)
  86. target_link_libraries(EgoSystem ${Boost_SYSTEM_LIBRARY})
  87. target_link_libraries(EgoSystem dl)
  88. target_link_libraries(EgoSystem X11)
  89. target_link_libraries(EgoSystem ${GLIB_LIBRARIES})
  90. #target_link_libraries(EgoSystem ${PC_LIBUDEV_LIBRARIES})
  91. target_link_libraries(EgoSystem -lpcanbasic)
  92. #target_link_libraries(EgoSystem ${OpenCV_LIBRARIES})