Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 6c893fc3

History | View | Annotate | Download (7.135 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 fe5a9426 Simon Schulz
ELSE ()  
58 8c6c1163 Simon Schulz
  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 fe5a9426 Simon Schulz
ENDIF ()
63 8c6c1163 Simon Schulz
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 fe5a9426 Simon Schulz
#resolve to absolute library filename
72
#or is there an easier way to get the absolute lib filename from pkg config files?!
73
find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS})
74
75
MESSAGE("-- using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
76
MESSAGE("-- will ink against ${REFLEXXES_LIBRARY}")
77 8c6c1163 Simon Schulz
78
set(CMAKE_CXX_FLAGS "-g -Wall")
79
add_definitions ("-Wall")
80
81
82
IF (catkin_FOUND)
83
    #######################################
84
    ## Declare ROS messages and services ##
85
    #######################################
86
87
    add_message_files(
88
            FILES
89
            gaze.msg
90
            position_lcr.msg
91
            mouth.msg
92
    )
93
94
    ## Generate added messages and services with any dependencies listed here
95
    generate_messages(
96
            DEPENDENCIES
97
            std_msgs
98
            humotion
99
    )
100
101
102
    #
103
    ###################################
104
    ## catkin specific configuration ##
105
    ###################################
106
    ## The catkin_package macro generates cmake config files for your package
107
    ## Declare things to be passed to dependent projects
108
    ## INCLUDE_DIRS: uncomment this if you package contains header files
109
    ## LIBRARIES: libraries you create in this project that dependent projects also need
110
    ## CATKIN_DEPENDS: catkin_packages dependent projects also need
111
    ## DEPENDS: system dependencies of this project that dependent projects also need
112
    catkin_package(
113
        INCLUDE_DIRS include
114
        LIBRARIES humotion
115
        #CATKIN_DEPENDS message_runtime
116
        #DEPENDS system_lib
117
    )
118
ENDIF (catkin_FOUND)
119
120
###########
121
## Build ##
122
###########
123
124
## Specify additional locations of header files
125
## Your package locations should be listed before other locations
126
include_directories (BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS})
127 064198fb Robert Haschke
include_directories(include/humotion)
128 8c6c1163 Simon Schulz
include_directories( ${catkin_INCLUDE_DIRS})
129 fe5a9426 Simon Schulz
#link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
130 8c6c1163 Simon Schulz
131 1caa7724 Simon Schulz
132
#####################
133
# PLEASE DO NOT REMOVE THIS! This is a hack necessary for qtcreator to show cmake header files in the project view!
134
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/*)
135
136
137 8c6c1163 Simon Schulz
## Declare a cpp library
138
add_library(humotion
139
    src/mouth_state.cpp
140
    src/gaze_state.cpp
141
142
    src/client/client.cpp
143
    src/client/middleware.cpp
144
    src/client/middleware_ros.cpp
145
    src/client/middleware_rsb.cpp
146
147
    src/server/server.cpp
148
    src/server/middleware.cpp
149
    src/server/middleware_ros.cpp
150
    src/server/middleware_rsb.cpp
151
152
    src/server/controller.cpp
153
    src/server/joint_interface.cpp
154
    src/server/motion_generator.cpp
155
    src/server/gaze_motion_generator.cpp
156
    src/server/reflexxes_motion_generator.cpp
157
    src/server/mouth_motion_generator.cpp
158
    src/server/eye_motion_generator.cpp
159
    src/server/eyelid_motion_generator.cpp
160
    src/server/eyebrow_motion_generator.cpp
161
    src/server/neck_motion_generator.cpp
162 1caa7724 Simon Schulz
    ${DUMMY_HEADER_LIST} 
163 8c6c1163 Simon Schulz
    src/timestamped_list.cpp
164
)
165
166
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
167
168
169
## Add cmake target dependencies of the executable/library
170
## as an example, message headers may need to be generated before nodes
171
add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp)
172
173
## Specify libraries to link a library or executable target against
174
target_link_libraries(humotion
175 b9e86b5d Robert Haschke
			${Boost_LIBRARIES}
176 8c6c1163 Simon Schulz
			${catkin_LIBRARIES}
177 fe5a9426 Simon Schulz
			${REFLEXXES_LIBRARY}
178 b9e86b5d Robert Haschke
			${RST_LIBRARIES}
179
			${RSB_LIBRARIES}
180 8c6c1163 Simon Schulz
)
181
182
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
183
184
#############
185
## Install ##
186
#############
187
188
# all install targets should use catkin DESTINATION variables
189
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
190
191
## Mark executable scripts (Python etc.) for installation
192
## in contrast to setup.py, you can choose the destination
193
# install(PROGRAMS
194
#   scripts/my_python_script
195
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
196
# )
197
198
## Mark executables and/or libraries for installation
199
IF (catkin_FOUND)
200
    install(TARGETS humotion
201
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
202
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
203
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
204
    )
205
    ## Mark cpp header files for installation
206 8617a5ea Robert Haschke
    install(DIRECTORY include/humotion/
207 8c6c1163 Simon Schulz
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
208
    )
209
ENDIF (catkin_FOUND)
210
211
212
#############
213
## Testing ##
214
#############
215
IF (catkin_FOUND)
216
    ## Add gtest based cpp test target and link libraries
217
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
218
    if(TARGET ${PROJECT_NAME}-test-server)
219
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
220
    endif()
221
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
222
    if(TARGET ${PROJECT_NAME}-test-client)
223
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
224
    endif()
225
ENDIF (catkin_FOUND)
226
227
228
### Add folders to be run by python nosetests
229
# catkin_add_nosetests(test)