Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 414a3516

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