CMakeLists.txt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. cmake_minimum_required(VERSION 3.0.0)
  2. project(Ego 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(API_DIR ../webrtcinterop/include)
  20. include_directories(${API_DIR})
  21. #find_package(OpenCV REQUIRED)
  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. #pkg_check_modules(PC_LIBUDEV libudev)
  28. #if(PC_LIBUDEV_FOUND)
  29. # message(Found libudev)
  30. #endif(PC_LIBUDEV_FOUND)
  31. file(GLOB native_srcs "*.cpp")
  32. set(CURDIR ${CMAKE_CURRENT_LIST_DIR})
  33. file(GLOB common_srcs ${CURDIR}/../common/*.cpp)
  34. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  35. include_directories("../thirdparty/protobuf/include")
  36. ELSE()
  37. find_package(Protobuf REQUIRED)
  38. include_directories(${Protobuf_INCLUDE_DIRS})
  39. include_directories("../thirdparty/Eigen/eigen3")
  40. ENDIF()
  41. #set(RS_DRIVER ${CURDIR}/../thirdparty/rs_driver)
  42. #message(RS_DRIVER "${RS_DRIVER}")
  43. #include_directories(${RS_DRIVER})
  44. #include_directories(${CURDIR}/../thirdparty/protobuf/include)
  45. include_directories(${CURDIR}/../protocol/linux/)
  46. file(GLOB proto_srcs ${CURDIR}/../protocol/linux/*.cc)
  47. #file(GLOB lidar_srcs ${CURDIR}/lidar/*.cpp)
  48. link_directories("../webrtcinterop/build")
  49. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  50. link_directories("../thirdparty/webrtc/lib/linux")
  51. message(${CURDIR}../thirdparty/protobuf/lib/x64)
  52. link_directories(${CURDIR}/../thirdparty/protobuf/lib/x64)
  53. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  54. link_directories("../thirdparty/webrtc/lib/aarch64")
  55. #link_directories("../thirdparty/protobuf/lib/aarch64")
  56. endif()
  57. #message(lidar "${lidar_srcs}")
  58. add_executable(Ego ${native_srcs} ${common_srcs} ${proto_srcs})
  59. find_package(Boost COMPONENTS system REQUIRED)
  60. #find_library(
  61. # UDEV_LIB
  62. # udev
  63. #)
  64. #list(APPEND EXTERNAL_LIBS pcap)
  65. #list(APPEND EXTERNAL_LIBS "-lpthread")
  66. #list(APPEND EXTERNAL_LIBS "libprotobuf.a")
  67. #target_link_libraries(EgoSystem pthread)
  68. target_link_libraries(Ego libwebrtcinterop.a)
  69. target_link_libraries(Ego libwebrtc.a)
  70. target_link_libraries(Ego libsensors.a)
  71. target_link_libraries(Ego -lpthread )
  72. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  73. target_link_libraries(Ego libprotobuf.a)
  74. ELSE()
  75. target_link_libraries(Ego ${Protobuf_LIBRARIES})
  76. ENDIF()
  77. target_link_libraries(Ego libjsoncpp.so)
  78. target_link_libraries(Ego ${Boost_SYSTEM_LIBRARY})
  79. target_link_libraries(Ego dl)
  80. target_link_libraries(Ego X11)
  81. target_link_libraries(Ego ${GLIB_LIBRARIES})
  82. #target_link_libraries(EgoSystem ${PC_LIBUDEV_LIBRARIES})
  83. target_link_libraries(Ego -lpcanbasic)
  84. #target_link_libraries(EgoSystem ${OpenCV_LIBRARIES})