Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 2be6243f

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