-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
66 lines (54 loc) · 1.79 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
cmake_minimum_required(VERSION 2.8.3)
project(dynamixel_control_hw)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(LIBDYNAMIXEL "")
find_package(catkin REQUIRED COMPONENTS
roscpp
urdf
std_msgs
message_generation
hardware_interface
controller_manager
)
catkin_package(CATKIN_DEPENDS
roscpp
urdf
std_msgs
message_runtime
)
# Searching for libdynamixel
if ("$ENV{RESIBOTS_DIR}" STREQUAL "" AND "${LIBDYNAMIXEL}" STREQUAL "")
message("Using default location for libdynamixel : ~")
set(libdynamixel_dir "~")
elseif (NOT ("${LIBDYNAMIXEL}" STREQUAL ""))
message("Using user-defined location for libdynamixel : ${LIBDYNAMIXEL}")
set(libdynamixel_dir "$ENV{LIBDYNAMIXEL}")
elseif (NOT ("$ENV{RESIBOTS_DIR}" STREQUAL ""))
message("Using enviromnetal-defined location for libdynamixel : $ENV{RESIBOTS_DIR}")
set(libdynamixel_dir "$ENV{RESIBOTS_DIR}")
endif()
if (NOT (EXISTS "${libdynamixel_dir}/include/dynamixel/"))
message(FATAL_ERROR "libdynamixel was not found!")
endif()
include_directories(
${catkin_INCLUDE_DIRS}
"${libdynamixel_dir}/include"
include
)
add_executable(dynamixel_control_p1 src/dynamixel_control.cpp)
target_compile_definitions(dynamixel_control_p1 PRIVATE PROTOCOL1)
target_link_libraries(dynamixel_control_p1 ${catkin_LIBRARIES})
add_executable(dynamixel_control_p2 src/dynamixel_control.cpp)
target_link_libraries(dynamixel_control_p2 ${catkin_LIBRARIES})
add_library(dynamixel_hw
src/hardware_interface.cpp
)
target_link_libraries(dynamixel_hw ${catkin_LIBRARIES})
install(TARGETS dynamixel_hw
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(FILES dynamixel_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)