Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 064198fb

History | View | Annotate | Download (6.529 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
# 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
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg)
44
IF (catkin_FOUND)
45
    set(ROS_FOUND 1)
46
    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
IF (NOT catkin_FOUND AND NOT RSB_FOUND)
65
  message(FATAL_ERROR "Error: could neither find RSB or ROS middleware!")
66
ENDIF ()
67

    
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
include_directories(include/humotion)
123
include_directories( ${catkin_INCLUDE_DIRS})
124
link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
125

    
126
## Declare a cpp library
127
add_library(humotion
128
    src/mouth_state.cpp
129
    src/gaze_state.cpp
130

    
131
    src/client/client.cpp
132
    src/client/middleware.cpp
133
    src/client/middleware_ros.cpp
134
    src/client/middleware_rsb.cpp
135

    
136
    src/server/server.cpp
137
    src/server/middleware.cpp
138
    src/server/middleware_ros.cpp
139
    src/server/middleware_rsb.cpp
140

    
141
    src/server/controller.cpp
142
    src/server/joint_interface.cpp
143
    src/server/motion_generator.cpp
144
    src/server/gaze_motion_generator.cpp
145
    src/server/reflexxes_motion_generator.cpp
146
    src/server/mouth_motion_generator.cpp
147
    src/server/eye_motion_generator.cpp
148
    src/server/eyelid_motion_generator.cpp
149
    src/server/eyebrow_motion_generator.cpp
150
    src/server/neck_motion_generator.cpp
151

    
152
    src/timestamped_list.cpp
153
)
154

    
155
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
156

    
157

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

    
162
## Specify libraries to link a library or executable target against
163
target_link_libraries(humotion
164
			${Boost_LIBRARIES}
165
			${catkin_LIBRARIES}
166
			${REFLEXXES_LIBRARIES}
167
			${RST_LIBRARIES}
168
			${RSB_LIBRARIES}
169
)
170

    
171
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
172

    
173
#############
174
## Install ##
175
#############
176

    
177
# all install targets should use catkin DESTINATION variables
178
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
179

    
180
## Mark executable scripts (Python etc.) for installation
181
## in contrast to setup.py, you can choose the destination
182
# install(PROGRAMS
183
#   scripts/my_python_script
184
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
185
# )
186

    
187
## Mark executables and/or libraries for installation
188
IF (catkin_FOUND)
189
    install(TARGETS humotion
190
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
191
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
192
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
193
    )
194
    ## Mark cpp header files for installation
195
    install(DIRECTORY include
196
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
197
    )
198
ENDIF (catkin_FOUND)
199

    
200

    
201
#############
202
## Testing ##
203
#############
204
IF (catkin_FOUND)
205
    ## Add gtest based cpp test target and link libraries
206
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
207
    if(TARGET ${PROJECT_NAME}-test-server)
208
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
209
    endif()
210
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
211
    if(TARGET ${PROJECT_NAME}-test-client)
212
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
213
    endif()
214
ENDIF (catkin_FOUND)
215

    
216

    
217
### Add folders to be run by python nosetests
218
# catkin_add_nosetests(test)