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