cmvr-es/CMakeLists.txt

120 lines
3.9 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.22.0)
project(cmvr_es)
# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS -pthread)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# 查找依赖
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}./local")
###########################################################
## DEPENDENCIES
#############################################################
find_package(jsoncpp REQUIRED)
find_package(protobuf REQUIRED)
find_package(gRPC REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLOG REQUIRED libglog)
2025-12-05 16:33:11 +08:00
include_directories(
${CMAKE_SOURCE_DIR}/third_party/pinocchio/3.8.0/include
${CMAKE_SOURCE_DIR}/third_party/coal/3.0.2/include
${CMAKE_SOURCE_DIR}/third_party/urdfdom/5.0.3/include
${CMAKE_SOURCE_DIR}/third_party/urdfdom_headers/2.0.1/include
${CMAKE_SOURCE_DIR}/third_party/mujoco/3.3.7/include
)
link_directories(
${CMAKE_SOURCE_DIR}/third_party/pinocchio/3.8.0/lib
${CMAKE_SOURCE_DIR}/third_party/coal/3.0.2/lib
${CMAKE_SOURCE_DIR}/third_party/urdfdom/5.0.3/lib
${CMAKE_SOURCE_DIR}/third_party/mujoco/3.3.7/lib
)
############################################################
# PROTO
############################################################
set(PROTO_IMPORT_DIR ${PROJECT_SOURCE_DIR}/protos)
set(PROTO_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/_protobuf)
file(MAKE_DIRECTORY ${PROTO_BINARY_DIR})
file(GLOB_RECURSE PROTO_FILES ${PROTO_IMPORT_DIR}/*.proto)
add_library(proto-objects OBJECT ${PROTO_FILES})
message(STATUS "proto files will be loaded in ${PROTO_IMPORT_DIR}")
message(STATUS "proto files will be generated in ${PROTO_BINARY_DIR}")
protobuf_generate(
TARGET proto-objects
IMPORT_DIRS ${PROTO_IMPORT_DIR}
PROTOC_OUT_DIR ${PROTO_BINARY_DIR}
USAGE_REQUIREMENT INTERFACE
)
protobuf_generate(
TARGET proto-objects
LANGUAGE grpc
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
PLUGIN "protoc-gen-grpc=$ENV{HOME}/.local/bin/grpc_cpp_plugin"
USAGE_REQUIREMENT INTERFACE
IMPORT_DIRS ${PROTO_IMPORT_DIR}
PROTOC_OUT_DIR ${PROTO_BINARY_DIR}
)
target_include_directories(proto-objects PUBLIC ${PROTO_BINARY_DIR} ${PROTO_IMPORT_DIR})
2025-11-13 20:25:19 +08:00
target_link_libraries(proto-objects PUBLIC protobuf::libprotobuf gRPC::grpc++ gRPC::grpc++_reflection)
############################################################
# include
############################################################
include_directories(
/usr/include/opencv4
/usr/include/eigen3
/usr/local/include/osqp
2025-12-05 16:33:11 +08:00
/usr/local/share/osqp/codegen_files/inc/prate/
$ENV{HOME}/.local/include
/usr/local/include/
${PROTO_BINARY_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src/devices
2025-11-05 17:41:17 +08:00
${PROJECT_SOURCE_DIR}/src/utils
${PROJECT_SOURCE_DIR}/third_party
2025-11-10 16:54:06 +08:00
${PROJECT_SOURCE_DIR}/src
2025-11-11 11:33:55 +08:00
${PROJECT_SOURCE_DIR}/third_party/toppra/0.6.2/include
2025-11-10 16:54:06 +08:00
)
############################################################
# subdirectory
############################################################
add_subdirectory(src)
2025-11-12 09:58:22 +08:00
add_subdirectory(example)
#add_subdirectory(test)
############################################################
# executables
############################################################
add_executable(cmvr_es src/main.cpp)
target_include_directories(cmvr_es PRIVATE ${GLOG_INCLUDE_DIRS})
target_link_libraries(cmvr_es PRIVATE
proto-objects
service
${GLOG_LIBRARIES}
gflags
jsoncpp_lib
cmvr_es::utils
cmvr_es::service
2025-11-17 16:49:09 +08:00
cmvr_es::monitor_manager
cmvr_es::hardware
cmvr_es::device::canbus
cmvr_es::device::ti5motor
2025-12-05 16:33:11 +08:00
cmvr_es::controller
2025-11-10 16:54:06 +08:00
cmvr_es::data_center
cmvr_es::ik_solver
2025-11-11 11:33:55 +08:00
cmvr_es::planner
2025-11-12 09:58:22 +08:00
cmvr_es::device::humanoid_robot
)