humotion / CMakeLists.txt @ 482e441c
History | View | Annotate | Download (6.006 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 roscpp std_msgs sensor_msgs message_generation genmsg) |
11 |
IF (NOT catkin_FOUND) |
12 |
MESSAGE(FATAL_ERROR "Error: could not find ROS middleware!") |
13 |
ENDIF (NOT catkin_FOUND) |
14 |
|
15 |
INCLUDE(FindPkgConfig) |
16 |
|
17 |
##libreflexxes |
18 |
#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 |
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 |
#ENDIF () |
28 |
|
29 |
|
30 |
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib") |
31 |
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include") |
32 |
#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 |
MESSAGE("-- will link against ${REFLEXXES_LIBRARY}") |
38 |
|
39 |
set(CMAKE_CXX_FLAGS "-g -Wall") |
40 |
add_definitions ("-Wall") |
41 |
|
42 |
####################################### |
43 |
## Declare ROS messages and services ## |
44 |
####################################### |
45 |
|
46 |
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 |
|
78 |
########### |
79 |
## Build ## |
80 |
########### |
81 |
|
82 |
## Specify additional locations of header files |
83 |
## Your package locations should be listed before other locations |
84 |
include_directories(BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS}) |
85 |
include_directories(BEFORE include) |
86 |
include_directories(BEFORE include/humotion) |
87 |
#make sure to use ros messages from current build |
88 |
include_directories(BEFORE ${CATKIN_DEVEL_PREFIX}/include) |
89 |
#this should be appended: |
90 |
include_directories(${catkin_INCLUDE_DIRS}) |
91 |
#link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS}) |
92 |
|
93 |
##################### |
94 |
# PLEASE DO NOT REMOVE THIS! This is a hack necessary for qtcreator to show cmake header files in the project view! |
95 |
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/*) |
96 |
|
97 |
|
98 |
## Declare a cpp library |
99 |
add_library(humotion |
100 |
src/mouth_state.cpp |
101 |
src/gaze_state.cpp |
102 |
|
103 |
src/client/client.cpp |
104 |
src/client/middleware.cpp |
105 |
src/client/middleware_ros.cpp |
106 |
|
107 |
src/server/server.cpp |
108 |
src/server/middleware.cpp |
109 |
src/server/middleware_ros.cpp |
110 |
|
111 |
src/server/controller.cpp |
112 |
src/server/joint_interface.cpp |
113 |
src/server/motion_generator.cpp |
114 |
src/server/gaze_motion_generator.cpp |
115 |
src/server/reflexxes_motion_generator.cpp |
116 |
src/server/mouth_motion_generator.cpp |
117 |
src/server/eye_motion_generator.cpp |
118 |
src/server/eyelid_motion_generator.cpp |
119 |
src/server/eyebrow_motion_generator.cpp |
120 |
src/server/neck_motion_generator.cpp |
121 |
src/timestamp.cpp |
122 |
src/timestamped_list.cpp |
123 |
${DUMMY_HEADER_LIST} |
124 |
) |
125 |
|
126 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") |
127 |
|
128 |
## Add cmake target dependencies of the executable/library |
129 |
## as an example, message headers may need to be generated before nodes |
130 |
add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp) |
131 |
|
132 |
## Specify libraries to link a library or executable target against |
133 |
target_link_libraries(humotion |
134 |
${Boost_LIBRARIES} |
135 |
${catkin_LIBRARIES} |
136 |
${REFLEXXES_LIBRARY} |
137 |
) |
138 |
|
139 |
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) |
140 |
|
141 |
############# |
142 |
## Install ## |
143 |
############# |
144 |
|
145 |
# all install targets should use catkin DESTINATION variables |
146 |
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html |
147 |
|
148 |
## Mark executable scripts (Python etc.) for installation |
149 |
## in contrast to setup.py, you can choose the destination |
150 |
# install(PROGRAMS |
151 |
# scripts/my_python_script |
152 |
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
153 |
# ) |
154 |
|
155 |
## Mark executables and/or libraries for installation |
156 |
install(TARGETS humotion |
157 |
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
158 |
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
159 |
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
160 |
) |
161 |
## Mark cpp header files for installation |
162 |
install(DIRECTORY include/humotion/ |
163 |
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
164 |
) |
165 |
|
166 |
############# |
167 |
## Testing ## |
168 |
############# |
169 |
## Add gtest based cpp test target and link libraries |
170 |
catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp) |
171 |
if(TARGET ${PROJECT_NAME}-test-server) |
172 |
target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME}) |
173 |
endif() |
174 |
catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp) |
175 |
if(TARGET ${PROJECT_NAME}-test-client) |
176 |
target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME}) |
177 |
endif() |
178 |
catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp) |
179 |
if(TARGET ${PROJECT_NAME}-test-timestamp) |
180 |
target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME}) |
181 |
endif() |
182 |
|
183 |
### Add folders to be run by python nosetests |
184 |
# catkin_add_nosetests(test) |
185 |
|
186 |
|
187 |
#finally build (some) examples |
188 |
#add_subdirectory(./examples) |