-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
111 lines (93 loc) · 3.1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
cmake_minimum_required(VERSION 3.13.4)
project(be2r_cmpc_unitree)
set(CMAKE_CXX_STANDARD 17)
# check arch and os
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64.*")
set(ARCH amd64)
else()
set(ARCH arm64)
endif()
find_package(catkin REQUIRED COMPONENTS
roscpp
unitree_legged_msgs
geometry_msgs
tf
tf2_ros
nav_msgs
visualization_msgs
dynamic_reconfigure
grid_map_msgs
grid_map_ros
cv_bridge
)
# Eigen find
find_package (Eigen3 REQUIRED NO_MODULE PATHS /usr/lib/cmake/eigen3/ NO_DEFAULT_PATH)
set(UNITREE_LEGGED_SDK_PATH "../unitree_legged_sdk")
generate_dynamic_reconfigure_options(config/ros_dynamic_params.cfg)
catkin_package(
INCLUDE_DIRS
LIBRARIES ${PROJECT_NAME}
# CATKIN_DEPENDS roscpp
# DEPENDS system_lib
)
include_directories(
src
src/be2r_cmpc_unitree
src/common
src/common/FootstepPlanner
src/common/Controllers
src/common/ControlParameters
src/common/Dynamics
src/common/Math
src/common/SimUtilities
src/common/SparseCMPC
src/common/Utilities
src/common/debug
src/controllers
src/controllers/convexMPC
src/fsm
src/fsm/fsm_states
src/third_party
src/third_party/ParamHandler
src/third_party/qpOASES/include
${catkin_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
${UNITREE_LEGGED_SDK_PATH}/include/
)
link_directories(${UNITREE_LEGGED_SDK_PATH}/lib/cpp/${ARCH})
set(EXTRA_LIBS libunitree_legged_sdk.a)
# set(CMAKE_CXX_FLAGS "-O3 -fPIC")
add_definitions(-DSDK3_2)
set(CMAKE_CXX_FLAGS "-O3 -no-pie -march=native -ggdb -Wall \
-Wextra -Wcast-align -Wdisabled-optimization -Wformat=2 \
-Winit-self -Woverloaded-virtual \
-Wsign-promo")
set(CMAKE_C_FLAGS "-O3 -ggdb -march=native -std=gnu99 -I.")
#set(CMAKE_BUILD_TYPE "Debug")
SET (THIS_COM "${PROJECT_SOURCE_DIR}/" )
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/Configuration.h)
add_subdirectory(src/third_party)
add_subdirectory(src/common)
add_subdirectory(src/controllers)
add_subdirectory(src/fsm)
# find_library(LEGGED_SDK_LIB unitree_legged_sdk
# PATHS ${UNITREE_LEGGED_SDK_PATH}/lib/cpp/${ARCH}/
# NO_DEFAULT_PATH)
# if(${LEGGED_SDK_LIB} STREQUAL LEGGED_SDK-NOTFOUND)
# message(FATAL_ERROR "UNITREE_LEGGED_SDK not found")
# else()
# message(STATUS "UNITREE_LEGGED_SDK found")
# endif()
#основная либа ноды
add_library(be2r_cmpc_unitree_lib src/be2r_cmpc_unitree/be2r_cmpc_unitree.cpp)
target_include_directories(be2r_cmpc_unitree_lib PUBLIC ${UNITREE_LEGGED_SDK_PATH}/include/)
target_link_libraries(be2r_cmpc_unitree_lib ${catkin_LIBRARIES} ${EXTRA_LIBS} controllers_lib fsm_lib Eigen3::Eigen)
#бинарник ноды
add_executable(unitree_ctrl src/be2r_cmpc_unitree_node.cpp)
#зависимости ноды
add_dependencies(unitree_ctrl ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(unitree_ctrl unitree_legged_msgs_generate_messages_cpp)
#линкуем либы к бинарнику
target_link_libraries(unitree_ctrl ${catkin_LIBRARIES} ${EXTRA_LIBS} be2r_cmpc_unitree_lib Eigen3::Eigen)
add_dependencies(unitree_ctrl ${PROJECT_NAME}_gencfg)