CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright(c) 2019 livoxtech limited.
  2. cmake_minimum_required(VERSION 2.8.3)
  3. #---------------------------------------------------------------------------------------
  4. # Start livox_ros_driver project
  5. #---------------------------------------------------------------------------------------
  6. project(navigation)
  7. #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  8. #SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  9. find_package(Protobuf CONFIG REQUIRED)
  10. message(STATUS "Using protobuf ${Protobuf_VERSION}")
  11. set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
  12. set(_REFLECTION gRPC::grpc++_reflection)
  13. if(CMAKE_CROSSCOMPILING)
  14. find_program(_PROTOBUF_PROTOC protoc)
  15. else()
  16. set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
  17. endif()
  18. # Find gRPC installation
  19. # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
  20. find_package(gRPC CONFIG REQUIRED)
  21. message(STATUS "Using gRPC ${gRPC_VERSION}")
  22. set(_GRPC_GRPCPP gRPC::grpc++)
  23. if(CMAKE_CROSSCOMPILING)
  24. find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
  25. else()
  26. set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
  27. endif()
  28. find_package (Eigen3 REQUIRED CONFIG QUIET)
  29. #---------------------------------------------------------------------------------------
  30. # Set default build to release
  31. #---------------------------------------------------------------------------------------
  32. if(NOT CMAKE_BUILD_TYPE)
  33. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
  34. endif()
  35. #---------------------------------------------------------------------------------------
  36. # Compiler config
  37. #---------------------------------------------------------------------------------------
  38. set(CMAKE_CXX_STANDARD 11)
  39. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  40. set(CMAKE_CXX_EXTENSIONS OFF)
  41. include_directories(
  42. define
  43. /usr/include
  44. /usr/local/include
  45. ${EIGEN3_INCLUDE_DIR}
  46. ${GRPC_INCLUDE_DIR}
  47. )
  48. link_directories("/usr/local/lib")
  49. ## PCL library
  50. #link_directories(${PCL_LIBRARY_DIRS})
  51. #add_definitions(${PCL_DEFINITIONS})
  52. #---------------------------------------------------------------------------------------
  53. # generate excutable and add libraries
  54. #---------------------------------------------------------------------------------------
  55. add_executable(${PROJECT_NAME}
  56. controller.cpp
  57. define/TimerRecord.cpp
  58. MPC/parameter.pb.cc
  59. MPC/loaded_mpc.cpp
  60. MPC/trajectory.cpp
  61. MPC/pose2d.cpp
  62. MPC/navigation.cpp
  63. MPC/monitor/monitor_emqx.cpp
  64. MPC/monitor/emqx/mqttmsg.cpp
  65. MPC/monitor/emqx/paho_client.cpp
  66. MPC/monitor/emqx/message.pb.cc
  67. MPC/monitor/emqx/message.grpc.pb.cc
  68. MPC/monitor/terminator_emqx.cpp
  69. tool/pathcreator.cpp
  70. tool/singleton.cpp
  71. tool/proto_tool.cpp
  72. MPC/navigation_main.cpp
  73. nav_server.cpp)
  74. #---------------------------------------------------------------------------------------
  75. # link libraries ${Boost_LIBRARY} -lpthread
  76. #---------------------------------------------------------------------------------------
  77. target_link_libraries(${PROJECT_NAME}
  78. absl::flags
  79. absl::flags_parse
  80. ${_REFLECTION}
  81. ${_GRPC_GRPCPP}
  82. ${_PROTOBUF_LIBPROTOBUF}
  83. libglog.a libgflags.a
  84. paho-mqtt3a
  85. ipopt
  86. )
  87. #---------------------------------------------------------------------------------------
  88. # end of CMakeList.txt
  89. #---------------------------------------------------------------------------------------