Statistics
| Branch: | Tag: | Revision:

humotion / CMakeLists.txt @ 13a5e223

History | View | Annotate | Download (6.859 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
find_package(catkin)
44
IF (catkin_FOUND)
45
    SET(ROS_FOUND 1)
46
47
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg)
48
49
    message(STATUS "ROS Support is ON")
50
    add_definitions(-DROS_SUPPORT=1)
51
ENDIF (catkin_FOUND)
52
53
54
INCLUDE(FindPkgConfig)
55
56
##libreflexxes
57
IF (libreflexxes_DIR)
58
  MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')")
59
  SET(REFLEXXES_PREFIX ${libreflexxes_DIR})
60
ELSE ()
61
  PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3)
62
  IF (NOT REFLEXXES_FOUND)
63
    message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII")
64
  ENDIF ()
65
ENDIF()
66
67
IF (NOT catkin_FOUND)
68
    IF (NOT RSB_FOUND)
69
        message(FATAL_ERROR "Error: could neither find RSB or ROS middleware!")
70
    ENDIF (NOT RSB_FOUND)
71
ENDIF (NOT catkin_FOUND)
72
73
74
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
75
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
76
MESSAGE("using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
77
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
include_directories(include)
128
include_directories( ${catkin_INCLUDE_DIRS})
129
link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
130
131
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h  include/client/*.h  include/server/*.h srv/*.srv msg/*.msg etc/*)
132
133
## Declare a cpp library
134
add_library(humotion
135
    src/mouth_state.cpp
136
    src/gaze_state.cpp
137
138
    src/client/client.cpp
139
    src/client/middleware.cpp
140
    src/client/middleware_ros.cpp
141
    src/client/middleware_rsb.cpp
142
143
    src/server/server.cpp
144
    src/server/middleware.cpp
145
    src/server/middleware_ros.cpp
146
    src/server/middleware_rsb.cpp
147
148
    src/server/controller.cpp
149
    src/server/joint_interface.cpp
150
    src/server/motion_generator.cpp
151
    src/server/gaze_motion_generator.cpp
152
    src/server/reflexxes_motion_generator.cpp
153
    src/server/mouth_motion_generator.cpp
154
    src/server/eye_motion_generator.cpp
155
    src/server/eyelid_motion_generator.cpp
156
    src/server/eyebrow_motion_generator.cpp
157
    src/server/neck_motion_generator.cpp
158
159
    src/timestamped_list.cpp
160
161
    ${DUMMY_HEADER_LIST}
162
)
163
164
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
165
166
167
## Add cmake target dependencies of the executable/library
168
## as an example, message headers may need to be generated before nodes
169
add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp)
170
171
## Specify libraries to link a library or executable target against
172
target_link_libraries(humotion
173
			${Boost_LIBRARIES} 
174
			${catkin_LIBRARIES}
175
                        ${REFLEXXES_LIBRARIES}
176
                        ${RST_LIBRARIES}
177
                        ${RSB_LIBRARIES}
178
)
179
180
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
181
182
#############
183
## Install ##
184
#############
185
186
# all install targets should use catkin DESTINATION variables
187
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
188
189
## Mark executable scripts (Python etc.) for installation
190
## in contrast to setup.py, you can choose the destination
191
# install(PROGRAMS
192
#   scripts/my_python_script
193
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
194
# )
195
196
## Mark executables and/or libraries for installation
197
IF (catkin_FOUND)
198
    install(TARGETS humotion
199
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
200
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
201
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
202
    )
203
    ## Mark cpp header files for installation
204
    install(DIRECTORY include/
205
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
206
        PATTERN ".svn" EXCLUDE
207
    )
208
ENDIF (catkin_FOUND)
209
210
211
#############
212
## Testing ##
213
#############
214
IF (catkin_FOUND)
215
    ## Add gtest based cpp test target and link libraries
216
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
217
    if(TARGET ${PROJECT_NAME}-test-server)
218
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
219
    endif()
220
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
221
    if(TARGET ${PROJECT_NAME}-test-client)
222
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
223
    endif()
224
ENDIF (catkin_FOUND)
225
226
227
### Add folders to be run by python nosetests
228
# catkin_add_nosetests(test)