Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 60dfadc5

History | View | Annotate | Download (7.354 KB)

1
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
#allow forced disable of RSB
12
option(IGNORE_RSB "IGNORE_RSB" OFF)
13

    
14
#######################################
15
# check if we have RSB support:
16
IF (IGNORE_RSB)
17
    MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB")
18
ELSE (IGNORE_RSB)
19
FIND_PACKAGE(RSB 0.11)
20
IF (RSB_FOUND)
21
    #RSB
22
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
23
    FIND_PACKAGE(RSC 0.11 REQUIRED)
24
    FIND_PACKAGE(RSB 0.11 REQUIRED)
25
    #RST
26
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
27
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
28
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
29

    
30
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
31
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
32
    #RSB
33
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
34
    FIND_PACKAGE(RSC 0.11 REQUIRED)
35
    FIND_PACKAGE(RSB 0.11 REQUIRED)
36
    #RST
37
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
38
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
39
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
40

    
41
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
42
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
43

    
44
    message(STATUS "RSB Support is ON")
45
    add_definitions(-DRSB_SUPPORT=1)
46
ENDIF (RSB_FOUND)
47
ENDIF(IGNORE_RSB)
48

    
49
################################################################
50
# check for ROS support:
51
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg)
52
IF (catkin_FOUND)
53
    set(ROS_FOUND 1)
54
    message(STATUS "ROS Support is ON")
55
    add_definitions(-DROS_SUPPORT=1)
56
ENDIF (catkin_FOUND)
57

    
58

    
59
INCLUDE(FindPkgConfig)
60

    
61
##libreflexxes
62
IF (libreflexxes_DIR)
63
  MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')")
64
  SET(REFLEXXES_PREFIX ${libreflexxes_DIR})
65
ELSE ()  
66
  PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3)
67
  IF (NOT REFLEXXES_FOUND)
68
    message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII")
69
  ENDIF ()
70
ENDIF ()
71

    
72
IF (NOT catkin_FOUND AND NOT RSB_FOUND)
73
  message(FATAL_ERROR "Error: could neither find RSB or ROS middleware!")
74
ENDIF ()
75

    
76

    
77
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
78
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
79
#resolve to absolute library filename
80
#or is there an easier way to get the absolute lib filename from pkg config files?!
81
find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS})
82

    
83
MESSAGE("-- using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
84
MESSAGE("-- will ink against ${REFLEXXES_LIBRARY}")
85

    
86
set(CMAKE_CXX_FLAGS "-g -Wall")
87
add_definitions ("-Wall")
88

    
89

    
90
IF (catkin_FOUND)
91
    #######################################
92
    ## Declare ROS messages and services ##
93
    #######################################
94

    
95
    add_message_files(
96
            FILES
97
            gaze.msg
98
            position_lcr.msg
99
            mouth.msg
100
    )
101

    
102
    ## Generate added messages and services with any dependencies listed here
103
    generate_messages(
104
            DEPENDENCIES
105
            std_msgs
106
            humotion
107
    )
108

    
109

    
110
    #
111
    ###################################
112
    ## catkin specific configuration ##
113
    ###################################
114
    ## The catkin_package macro generates cmake config files for your package
115
    ## Declare things to be passed to dependent projects
116
    ## INCLUDE_DIRS: uncomment this if you package contains header files
117
    ## LIBRARIES: libraries you create in this project that dependent projects also need
118
    ## CATKIN_DEPENDS: catkin_packages dependent projects also need
119
    ## DEPENDS: system dependencies of this project that dependent projects also need
120
    catkin_package(
121
        INCLUDE_DIRS include
122
        LIBRARIES humotion
123
        #CATKIN_DEPENDS message_runtime
124
        #DEPENDS system_lib
125
    )
126
ENDIF (catkin_FOUND)
127

    
128
###########
129
## Build ##
130
###########
131

    
132
## Specify additional locations of header files
133
## Your package locations should be listed before other locations
134
include_directories (BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS})
135
include_directories(include/humotion)
136
include_directories( ${catkin_INCLUDE_DIRS})
137
#link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
138

    
139

    
140
#####################
141
# PLEASE DO NOT REMOVE THIS! This is a hack necessary for qtcreator to show cmake header files in the project view!
142
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/*)
143

    
144

    
145
## Declare a cpp library
146
add_library(humotion
147
    src/mouth_state.cpp
148
    src/gaze_state.cpp
149

    
150
    src/client/client.cpp
151
    src/client/middleware.cpp
152
    src/client/middleware_ros.cpp
153
    src/client/middleware_rsb.cpp
154

    
155
    src/server/server.cpp
156
    src/server/middleware.cpp
157
    src/server/middleware_ros.cpp
158
    src/server/middleware_rsb.cpp
159

    
160
    src/server/controller.cpp
161
    src/server/joint_interface.cpp
162
    src/server/motion_generator.cpp
163
    src/server/gaze_motion_generator.cpp
164
    src/server/reflexxes_motion_generator.cpp
165
    src/server/mouth_motion_generator.cpp
166
    src/server/eye_motion_generator.cpp
167
    src/server/eyelid_motion_generator.cpp
168
    src/server/eyebrow_motion_generator.cpp
169
    src/server/neck_motion_generator.cpp
170
    ${DUMMY_HEADER_LIST} 
171
    src/timestamped_list.cpp
172
)
173

    
174
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
175

    
176

    
177
## Add cmake target dependencies of the executable/library
178
## as an example, message headers may need to be generated before nodes
179
add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp)
180

    
181
## Specify libraries to link a library or executable target against
182
target_link_libraries(humotion
183
			${Boost_LIBRARIES}
184
			${catkin_LIBRARIES}
185
			${REFLEXXES_LIBRARY}
186
			${RST_LIBRARIES}
187
			${RSB_LIBRARIES}
188
)
189

    
190
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
191

    
192
#############
193
## Install ##
194
#############
195

    
196
# all install targets should use catkin DESTINATION variables
197
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
198

    
199
## Mark executable scripts (Python etc.) for installation
200
## in contrast to setup.py, you can choose the destination
201
# install(PROGRAMS
202
#   scripts/my_python_script
203
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
204
# )
205

    
206
## Mark executables and/or libraries for installation
207
IF (catkin_FOUND)
208
    install(TARGETS humotion
209
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
210
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
211
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
212
    )
213
    ## Mark cpp header files for installation
214
    install(DIRECTORY include/humotion/
215
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
216
    )
217
ENDIF (catkin_FOUND)
218

    
219

    
220
#############
221
## Testing ##
222
#############
223
IF (catkin_FOUND)
224
    ## Add gtest based cpp test target and link libraries
225
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
226
    if(TARGET ${PROJECT_NAME}-test-server)
227
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
228
    endif()
229
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
230
    if(TARGET ${PROJECT_NAME}-test-client)
231
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
232
    endif()
233
ENDIF (catkin_FOUND)
234

    
235

    
236
### Add folders to be run by python nosetests
237
# catkin_add_nosetests(test)