humotion / CMakeLists.txt @ 95dd1012
History | View | Annotate | Download (6.56 KB)
1 |
cmake_minimum_required(VERSION 2.8.3) |
---|---|
2 |
project(humotion) |
3 |
|
4 |
set(ENV{ROS_LANG_DISABLE} "genjava") |
5 |
|
6 |
set(ROS_BUILD_TYPE Debug) |
7 |
|
8 |
################################################################ |
9 |
# check for ROS support: |
10 |
find_package(catkin REQUIRED COMPONENTS |
11 |
roscpp |
12 |
std_msgs |
13 |
sensor_msgs |
14 |
message_generation |
15 |
genmsg |
16 |
dynamic_reconfigure |
17 |
) |
18 |
|
19 |
IF (NOT catkin_FOUND) |
20 |
MESSAGE(FATAL_ERROR "Error: could not find ROS middleware!") |
21 |
ENDIF (NOT catkin_FOUND) |
22 |
|
23 |
INCLUDE(FindPkgConfig) |
24 |
|
25 |
##libreflexxes |
26 |
#IF (libreflexxes_DIR) |
27 |
# MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')") |
28 |
# SET(REFLEXXES_PREFIX ${libreflexxes_DIR}) |
29 |
# SET(REFLEXXES_LIBRARY "ReflexxesTypeII") |
30 |
#ELSE () |
31 |
PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3) |
32 |
IF (NOT REFLEXXES_FOUND) |
33 |
message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII") |
34 |
ENDIF () |
35 |
#ENDIF () |
36 |
|
37 |
|
38 |
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib") |
39 |
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include") |
40 |
#resolve to absolute library filename |
41 |
#or is there an easier way to get the absolute lib filename from pkg config files?! |
42 |
find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS}) |
43 |
|
44 |
MESSAGE("-- using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}") |
45 |
MESSAGE("-- will link against ${REFLEXXES_LIBRARY}") |
46 |
|
47 |
set(CMAKE_CXX_FLAGS "-g -Wall") |
48 |
add_definitions ("-Wall") |
49 |
|
50 |
####################################### |
51 |
## Declare ROS messages and services ## |
52 |
####################################### |
53 |
|
54 |
add_message_files( |
55 |
FILES |
56 |
gaze.msg |
57 |
position_lcr.msg |
58 |
mouth.msg |
59 |
) |
60 |
|
61 |
## Generate added messages and services with any dependencies listed here |
62 |
generate_messages( |
63 |
DEPENDENCIES |
64 |
std_msgs |
65 |
humotion |
66 |
) |
67 |
|
68 |
# add dynamic reconfigure api |
69 |
generate_dynamic_reconfigure_options( |
70 |
cfg/humotion.cfg |
71 |
) |
72 |
|
73 |
# |
74 |
################################### |
75 |
## catkin specific configuration ## |
76 |
################################### |
77 |
## The catkin_package macro generates cmake config files for your package |
78 |
## Declare things to be passed to dependent projects |
79 |
## INCLUDE_DIRS: uncomment this if you package contains header files |
80 |
## LIBRARIES: libraries you create in this project that dependent projects also need |
81 |
## CATKIN_DEPENDS: catkin_packages dependent projects also need |
82 |
## DEPENDS: system dependencies of this project that dependent projects also need |
83 |
catkin_package( |
84 |
INCLUDE_DIRS include |
85 |
LIBRARIES humotion |
86 |
#CATKIN_DEPENDS message_runtime |
87 |
#DEPENDS system_lib |
88 |
) |
89 |
|
90 |
########### |
91 |
## Build ## |
92 |
########### |
93 |
|
94 |
## Specify additional locations of header files |
95 |
## Your package locations should be listed before other locations |
96 |
include_directories(BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS}) |
97 |
include_directories(BEFORE include) |
98 |
|
99 |
#make sure to use ros messages from current build |
100 |
include_directories(BEFORE ${CATKIN_DEVEL_PREFIX}/include) |
101 |
|
102 |
#this should be appended: |
103 |
include_directories(${catkin_INCLUDE_DIRS}) |
104 |
|
105 |
#link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS}) |
106 |
|
107 |
## Declare a cpp library |
108 |
add_library(${PROJECT_NAME} |
109 |
src/client/client.cpp |
110 |
src/client/middleware.cpp |
111 |
src/client/middleware_ros.cpp |
112 |
|
113 |
src/server/server.cpp |
114 |
src/server/config.cpp |
115 |
src/server/middleware.cpp |
116 |
src/server/middleware_ros.cpp |
117 |
src/server/controller.cpp |
118 |
src/server/joint_interface.cpp |
119 |
src/server/motion_generator.cpp |
120 |
src/server/gaze_motion_generator.cpp |
121 |
src/server/reflexxes_motion_generator.cpp |
122 |
src/server/mouth_motion_generator.cpp |
123 |
src/server/eye_motion_generator.cpp |
124 |
src/server/eyelid_motion_generator.cpp |
125 |
src/server/eyebrow_motion_generator.cpp |
126 |
src/server/neck_motion_generator.cpp |
127 |
|
128 |
src/mouth_state.cpp |
129 |
src/gaze_state.cpp |
130 |
src/timestamp.cpp |
131 |
src/timestamped_list.cpp |
132 |
) |
133 |
|
134 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") |
135 |
|
136 |
## Add cmake target dependencies of the executable/library |
137 |
## as an example, message headers may need to be generated before nodes |
138 |
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencpp ${PROJECT_NAME}_gencfg) |
139 |
|
140 |
## Specify libraries to link a library or executable target against |
141 |
target_link_libraries(${PROJECT_NAME} |
142 |
${Boost_LIBRARIES} |
143 |
${catkin_LIBRARIES} |
144 |
${REFLEXXES_LIBRARY} |
145 |
) |
146 |
|
147 |
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) |
148 |
|
149 |
############# |
150 |
## Install ## |
151 |
############# |
152 |
|
153 |
# all install targets should use catkin DESTINATION variables |
154 |
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html |
155 |
|
156 |
## Mark executable scripts (Python etc.) for installation |
157 |
## in contrast to setup.py, you can choose the destination |
158 |
# install(PROGRAMS |
159 |
# scripts/my_python_script |
160 |
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
161 |
# ) |
162 |
|
163 |
## Mark executables and/or libraries for installation |
164 |
install(TARGETS ${PROJECT_NAME} |
165 |
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
166 |
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
167 |
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
168 |
) |
169 |
## Mark cpp header files for installation |
170 |
install(DIRECTORY include/humotion/ |
171 |
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
172 |
) |
173 |
|
174 |
############# |
175 |
## Testing ## |
176 |
############# |
177 |
## Add gtest based cpp test target and link libraries |
178 |
catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp) |
179 |
if(TARGET ${PROJECT_NAME}-test-server) |
180 |
target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME}) |
181 |
endif() |
182 |
catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp) |
183 |
if(TARGET ${PROJECT_NAME}-test-client) |
184 |
target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME}) |
185 |
endif() |
186 |
catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp) |
187 |
if(TARGET ${PROJECT_NAME}-test-timestamp) |
188 |
target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME}) |
189 |
endif() |
190 |
|
191 |
### Add folders to be run by python nosetests |
192 |
# catkin_add_nosetests(test) |
193 |
|
194 |
|
195 |
#finally build (some) examples |
196 |
#add_subdirectory(./examples) |
197 |
|
198 |
|
199 |
################# |
200 |
## style guide ## |
201 |
################# |
202 |
set(ENABLE_CPPLINT 1) |
203 |
include(${CMAKE_CURRENT_SOURCE_DIR}/stylecheck/CpplintWrapper.cmake) |
204 |
CPPLINT_RECURSIVE(cpplint_include |
205 |
${CMAKE_CURRENT_SOURCE_DIR}/include |
206 |
${CMAKE_CURRENT_SOURCE_DIR}/include |
207 |
${CMAKE_CURRENT_BINARY_DIR}/include) |
208 |
CPPLINT_RECURSIVE(cpplint_src |
209 |
${CMAKE_CURRENT_SOURCE_DIR}/src |
210 |
${CMAKE_CURRENT_SOURCE_DIR}/src |
211 |
${CMAKE_CURRENT_BINARY_DIR}/src) |
212 |
add_dependencies(${PROJECT_NAME} cpplint_src cpplint_include) |
213 |
|
214 |
#workaround for qtcreator ide integration. do not remove! |
215 |
file(GLOB_RECURSE NODE_DUMMY_TARGETS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.cfg *.yaml *.xml *.launch) |
216 |
add_custom_target(_dummy_target SOURCES ${NODE_DUMMY_TARGETS}) |