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