Revision 414a3516 CMakeLists.txt

View differences:

CMakeLists.txt
3 3

  
4 4
set(ENV{ROS_LANG_DISABLE} "genjava")
5 5

  
6

  
7 6
set(ROS_BUILD_TYPE Debug)
8 7

  
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 8
################################################################
50 9
# check for ROS support:
51 10
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)
11
IF (NOT catkin_FOUND)
12
  MESSAGE(FATAL_ERROR "Error: could not find ROS middleware!")
56 13
ENDIF (catkin_FOUND)
57 14

  
58

  
59 15
INCLUDE(FindPkgConfig)
60 16

  
61 17
##libreflexxes
......
69 25
  ENDIF ()
70 26
ENDIF ()
71 27

  
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 28

  
77 29
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
78 30
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
......
81 33
find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS})
82 34

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

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

  
41
#######################################
42
## Declare ROS messages and services ##
43
#######################################
89 44

  
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)
45
add_message_files(
46
        FILES
47
        gaze.msg
48
        position_lcr.msg
49
        mouth.msg
50
)
51

  
52
## Generate added messages and services with any dependencies listed here
53
generate_messages(
54
        DEPENDENCIES
55
        std_msgs
56
        humotion
57
)
58

  
59

  
60
#
61
###################################
62
## catkin specific configuration ##
63
###################################
64
## The catkin_package macro generates cmake config files for your package
65
## Declare things to be passed to dependent projects
66
## INCLUDE_DIRS: uncomment this if you package contains header files
67
## LIBRARIES: libraries you create in this project that dependent projects also need
68
## CATKIN_DEPENDS: catkin_packages dependent projects also need
69
## DEPENDS: system dependencies of this project that dependent projects also need
70
catkin_package(
71
    INCLUDE_DIRS include
72
    LIBRARIES humotion
73
    #CATKIN_DEPENDS message_runtime
74
    #DEPENDS system_lib
75
)
127 76

  
128 77
###########
129 78
## Build ##
......
153 102
    src/client/client.cpp
154 103
    src/client/middleware.cpp
155 104
    src/client/middleware_ros.cpp
156
    src/client/middleware_rsb.cpp
157 105

  
158 106
    src/server/server.cpp
159 107
    src/server/middleware.cpp
160 108
    src/server/middleware_ros.cpp
161
    src/server/middleware_rsb.cpp
162 109

  
163 110
    src/server/controller.cpp
164 111
    src/server/joint_interface.cpp
......
177 124

  
178 125
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
179 126

  
180

  
181 127
## Add cmake target dependencies of the executable/library
182 128
## as an example, message headers may need to be generated before nodes
183 129
add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp)
184 130

  
185 131
## Specify libraries to link a library or executable target against
186 132
target_link_libraries(humotion
187
			${Boost_LIBRARIES}
188
			${catkin_LIBRARIES}
189
			${REFLEXXES_LIBRARY}
190
			${RST_LIBRARIES}
191
			${RSB_LIBRARIES}
133
    ${Boost_LIBRARIES}
134
    ${catkin_LIBRARIES}
135
    ${REFLEXXES_LIBRARY}
192 136
)
193 137

  
194 138
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
......
208 152
# )
209 153

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

  
155
install(TARGETS humotion
156
    ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
157
    LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
158
    RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
159
)
160
## Mark cpp header files for installation
161
install(DIRECTORY include/humotion/
162
    DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
163
)
223 164

  
224 165
#############
225 166
## Testing ##
226 167
#############
227
IF (catkin_FOUND)
228
    ## Add gtest based cpp test target and link libraries
229
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
230
    if(TARGET ${PROJECT_NAME}-test-server)
231
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
232
    endif()
233
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
234
    if(TARGET ${PROJECT_NAME}-test-client)
235
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
236
    endif()
237
    catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp)
238
    if(TARGET ${PROJECT_NAME}-test-timestamp)
239
    target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME})
240
    endif()
241
ENDIF (catkin_FOUND)
242

  
168
## Add gtest based cpp test target and link libraries
169
catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
170
if(TARGET ${PROJECT_NAME}-test-server)
171
target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
172
endif()
173
catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
174
if(TARGET ${PROJECT_NAME}-test-client)
175
target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
176
endif()
177
catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp)
178
if(TARGET ${PROJECT_NAME}-test-timestamp)
179
target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME})
180
endif()
243 181

  
244 182
### Add folders to be run by python nosetests
245 183
# catkin_add_nosetests(test)

Also available in: Unified diff