Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 1caa7724

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