2021-09-01 20:46:41 +08:00
|
|
|
cmake_minimum_required(VERSION 2.8.3)
|
|
|
|
project(unitree_legged_real)
|
|
|
|
|
|
|
|
add_compile_options(-std=c++11)
|
|
|
|
|
|
|
|
find_package(catkin REQUIRED COMPONENTS
|
|
|
|
roscpp
|
|
|
|
geometry_msgs
|
|
|
|
unitree_legged_msgs
|
|
|
|
)
|
|
|
|
|
2022-05-24 16:05:24 +08:00
|
|
|
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64.*")
|
|
|
|
set(ARCH amd64)
|
|
|
|
else()
|
|
|
|
set(ARCH arm64)
|
|
|
|
endif()
|
|
|
|
set(LEGGED_SDK_NAME -pthread libunitree_legged_sdk_${ARCH}.so lcm)
|
|
|
|
|
|
|
|
set(EXTRA_LIBS ${LEGGED_SDK_NAME} lcm)
|
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "-O3 -fPIC")
|
|
|
|
|
|
|
|
|
2021-09-01 20:46:41 +08:00
|
|
|
|
|
|
|
include_directories(
|
|
|
|
include
|
|
|
|
${catkin_INCLUDE_DIRS}
|
2022-05-24 16:05:24 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/unitree_legged_sdk-master/include
|
2021-09-01 20:46:41 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-09-02 18:24:10 +08:00
|
|
|
|
2022-05-24 16:05:24 +08:00
|
|
|
link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk-master/lib)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_executable(example_walk src/exe/example_walk.cpp)
|
|
|
|
target_link_libraries(example_walk ${EXTRA_LIBS} ${catkin_LIBRARIES})
|
|
|
|
add_dependencies(example_walk ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
2021-09-01 20:46:41 +08:00
|
|
|
|
2022-05-24 16:05:24 +08:00
|
|
|
add_executable(example_position src/exe/example_position.cpp)
|
|
|
|
target_link_libraries(example_position ${EXTRA_LIBS} ${catkin_LIBRARIES})
|
|
|
|
add_dependencies(example_position ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
2021-09-01 20:46:41 +08:00
|
|
|
|
2022-05-24 16:05:24 +08:00
|
|
|
add_executable(state_sub src/exe/state_sub.cpp)
|
|
|
|
target_link_libraries(state_sub ${EXTRA_LIBS} ${catkin_LIBRARIES})
|
|
|
|
add_dependencies(state_sub ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
2021-09-01 20:46:41 +08:00
|
|
|
|
2022-05-24 16:05:24 +08:00
|
|
|
add_executable(ros_udp src/exe/ros_udp.cpp)
|
|
|
|
target_link_libraries(ros_udp ${EXTRA_LIBS} ${catkin_LIBRARIES})
|
|
|
|
add_dependencies(ros_udp ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
2021-09-01 20:46:41 +08:00
|
|
|
|