-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
201 lines (169 loc) · 7.33 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
cmake_minimum_required(VERSION 2.8.3)
project(hubo_motion_ros)
set(BUILD_FLAGS "-std=c++0x -Wreturn-type -Wno-enum-compare")
# Add additional CMake files
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS roscpp
message_generation genmsg actionlib actionlib_msgs
std_msgs sensor_msgs geometry_msgs trajectory_msgs control_msgs diagnostic_msgs visualization_msgs interactive_markers
tf tf_conversions eigen_conversions rviz class_loader joystick_integrator urdf)
#find_package(catkin REQUIRED )
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
link_libraries(${QT_LIBRARIES})
# Include Eigen for matrices
find_package(Eigen REQUIRED)
include_directories(${EIGEN_INCLUDE_DIRS})
add_definitions(${EIGEN_DEFINITIONS})
# Include CppUnit
find_package(CppUnit)
include_directories(${CPPUNIT_INCLUDE_DIR})
link_libraries(${CPPUNIT_LIBRARIES})
#######################################
## Declare ROS messages and services ##
#######################################
## Generate messages in the 'msg' folder
file(GLOB message_source "msg/*.msg")
list(SORT message_source)
foreach(message_src_file ${message_source})
get_filename_component(message_base ${message_src_file} NAME)
message(STATUS "Adding message ${message_base}" )
add_message_files(DIRECTORY msg FILES ${message_base})
endforeach(message_src_file)
## Generate services in the 'srv' folder
file(GLOB service_source "srv/*.srv")
list(SORT service_source)
foreach(service_src_file ${service_source})
get_filename_component(service_base ${service_src_file} NAME)
message(STATUS "Adding service ${service_base}" )
add_service_files(DIRECTORY srv FILES ${service_base})
endforeach(service_src_file)
## Generate actions in the 'action' folder
file(GLOB action_source "action/*.action")
list(SORT action_source)
foreach(action_src_file ${action_source})
get_filename_component(action_base ${action_src_file} NAME)
message(STATUS "Adding action ${action_base}" )
add_action_files(DIRECTORY action FILES ${action_base})
endforeach(action_src_file)
## Actually generate the language-specific message and service files
generate_messages(DEPENDENCIES std_msgs sensor_msgs geometry_msgs trajectory_msgs diagnostic_msgs actionlib_msgs hubo_robot_msgs)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES hubo_motion_ros
CATKIN_DEPENDS roscpp
message_runtime genmsg actionlib actionlib_msgs
std_msgs sensor_msgs geometry_msgs trajectory_msgs control_msgs diagnostic_msgs visualization_msgs interactive_markers
tf tf_conversions eigen_conversions rviz class_loader joystick_integrator urdf
DEPENDS ach rt QtCore QtGui
)
## Your package locations should be listed before other locations
include_directories(include ${catkin_INCLUDE_DIRS})
link_libraries(${catkin_LIBRARIES})
###########
## Build ##
###########
#add_definitions(-DQT_NO_KEYWORDS)
## Specify additional locations of header files
link_libraries(ach)
link_libraries(rt)
link_libraries(RobotKin)
# Collect the source, node and test files
file(GLOB lib_source "src/libraries/*.cpp")
list(SORT lib_source)
file(GLOB plugins_source "src/plugins/*.cpp")
list(SORT plugins_source)
file(GLOB nodes_source "src/nodes/*.cpp")
list(SORT nodes_source)
file(GLOB unit_tests_source "src/tests/unit/*.cpp")
list(SORT unit_tests_source)
file(GLOB system_tests_source "src/tests/system/*.cpp")
list(SORT system_tests_source)
file(GLOB include_source "include/hubo_motion_ros/*.h")
list(SORT include_source)
file(GLOB include_source "include/hubo_motion_ros/*.h")
qt4_wrap_cpp(MOC_FILES include/hubo_motion_ros/AchNetworkWidget.h include/hubo_motion_ros/hubo_motion_panel.h include/hubo_motion_ros/manip_tab.h)
message(STATUS "${MOC_FILES}")
## Declare a cpp library
add_library(${PROJECT_NAME} SHARED ${lib_source})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS})
add_library(${PROJECT_NAME}_rviz SHARED ${plugins_source} ${include_source} ${MOC_FILES})
set_target_properties(${PROJECT_NAME}_rviz PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS})
## Allow Testing
enable_testing()
# Build unit tests
message(STATUS "\n-- UNIT TESTS: ")
foreach(utest_src_file ${unit_tests_source})
get_filename_component(test_base ${utest_src_file} NAME_WE)
message(STATUS "Adding test ${test_base}" )
add_executable(${test_base} "src/tests/test_units.cpp" ${utest_src_file})
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}/${test_base})
#catkin_add_gtest(${test_base} src/tests/unit/TestParameterizedObject.cpp)
target_link_libraries(${test_base} ${PROJECT_NAME})
set_target_properties(${test_base} PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS})
add_dependencies(tests ${test_base})
endforeach(utest_src_file)
# Build executables
message(STATUS "\n-- ROS NODES: ")
foreach(node_src_file ${nodes_source})
get_filename_component(node_base ${node_src_file} NAME_WE)
message(STATUS "Adding ROS Node ${node_base}" )
add_executable(${node_base} ${node_src_file} ${include_source})
target_link_libraries(${node_base} ${PROJECT_NAME})
add_dependencies(${node_base} ${PROJECT_NAME}_gencpp)
set_target_properties(${node_base} PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS})
endforeach(node_src_file)
# Build system tests
message(STATUS "\n-- ROS TESTING NODES: ")
foreach(test_node_src_file ${system_tests_source})
get_filename_component(test_node_base ${test_node_src_file} NAME_WE)
message(STATUS "Adding ROS Node ${test_node_base}" )
add_executable(${test_node_base} ${test_node_src_file})
target_link_libraries(${test_node_base} ${PROJECT_NAME})
add_dependencies(${test_node_base} ${PROJECT_NAME}_gencpp)
set_target_properties(${test_node_base} PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS})
endforeach(test_node_src_file)
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/groovy/api/catkin/html/adv_user_guide/variables.html
## Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_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(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_hubo_motion_ros.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)