-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
163 lines (135 loc) · 4.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
cmake_minimum_required(VERSION 3.0.2)
project(adi_tmcl)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
roscpp
geometry_msgs
message_generation
std_msgs
)
#################################
## Getting User Configurations ##
#################################
option(TMCL_ROS_DEBUG "Show ROS Debug Stream of tmcl_ros" OFF)
IF(TMCL_ROS_DEBUG)
add_definitions(-DDEBUG)
MESSAGE(STATUS "TMCL_ROS_DEBUG is enabled")
ELSE()
MESSAGE(STATUS "TMCL_ROS_DEBUG is disabled")
ENDIF(TMCL_ROS_DEBUG)
################################################
## Declare ROS messages, services and actions ##
################################################
## Generate messages in the 'msg' folder
add_message_files(
FILES
TmcInfo.msg
TmcParam.msg
)
## Generate services in the 'srv' folder
add_service_files(
FILES
TmcCustomCmd.srv
TmcGapGgpAll.srv
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
)
###################################
## catkin specific configuration ##
###################################
catkin_package(
INCLUDE_DIRS include
LIBRARIES
tmcl_ros
tmcl_interpreter
${PROJECT_NAME}_socket_can_wrapper
tmcl_motor
tmcl_bldc_motor
tmcl_stepper_motor
CATKIN_DEPENDS roscpp message_runtime std_msgs
)
###########
## Build ##
###########
## Specify additional locations of header files
include_directories(
include/tmcl_ros
${catkin_INCLUDE_DIRS}
)
## Declare a C++ library
add_library(${PROJECT_NAME}_socket_can_wrapper src/socket_can_wrapper.cpp)
add_library(tmcl_interpreter src/tmcl_interpreter.cpp)
add_library(tmcl_ros src/tmcl_ros.cpp)
add_library(tmcl_motor src/tmcl_motor.cpp)
add_library(tmcl_bldc_motor src/tmcl_bldc_motor.cpp)
add_library(tmcl_stepper_motor src/tmcl_stepper_motor.cpp)
add_dependencies(tmcl_ros ${PROJECT_NAME}_generate_messages_cpp)
add_dependencies(tmcl_motor ${PROJECT_NAME}_generate_messages_cpp)
add_dependencies(tmcl_bldc_motor ${PROJECT_NAME}_generate_messages_cpp)
add_dependencies(tmcl_stepper_motor ${PROJECT_NAME}_generate_messages_cpp)
## Add cmake target dependencies of the library
add_dependencies(tmcl_ros ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
add_executable(tmcl_ros_node src/tmcl_ros_node.cpp)
## Specify libraries to link a library or executable target against
target_link_libraries(tmcl_interpreter ${PROJECT_NAME}_socket_can_wrapper)
target_link_libraries(tmcl_ros tmcl_interpreter)
target_link_libraries(tmcl_ros tmcl_motor)
target_link_libraries(tmcl_interpreter tmcl_motor)
target_link_libraries(tmcl_motor tmcl_bldc_motor)
target_link_libraries(tmcl_motor tmcl_stepper_motor)
target_link_libraries(tmcl_ros_node tmcl_ros ${catkin_LIBRARIES})
## Add cmake target dependencies of the executable
add_dependencies(tmcl_ros_node ${PROJECT_NAME}_generate_messages_cpp)
#############
## Install ##
#############
## Mark executables for installation
install(TARGETS tmcl_ros_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark libaries for installation
install(TARGETS
${PROJECT_NAME}_socket_can_wrapper
tmcl_interpreter
tmcl_ros
tmcl_motor
tmcl_bldc_motor
tmcl_stepper_motor
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
## Mark other files for installation (e.g. launch and bag files, etc.)
install(DIRECTORY
launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
FILES_MATCHING PATTERN "*.launch"
)
install(DIRECTORY
config/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
FILES_MATCHING PATTERN "*.yaml"
)
install(DIRECTORY
scripts/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/scripts
FILES_MATCHING PATTERN "*.sh"
)
install(FILES
LICENSE
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
#############
## Testing ##
#############
## None