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