Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ 13362ced

History | View | Annotate | Download (4.917 KB)

1 0c286af0 Simon Schulz
cmake_minimum_required(VERSION 2.8.3)
2
project(hlrc_server)
3
4 7c5d8279 Simon Schulz
set(ENV{ROS_LANG_DISABLE} "genjava")
5
6 0c286af0 Simon Schulz
## System dependencies are found with CMake's conventions
7
# find_package(Boost REQUIRED COMPONENTS system)
8
9
INCLUDE(FindPkgConfig)
10
11
find_package(Boost REQUIRED COMPONENTS system thread)
12
13
#######################################
14 aa1958c6 Simon Schulz
#allow forced disable of RSB
15
option(IGNORE_RSB "IGNORE_RSB" OFF)
16 9aa2bb7c semeyerz
17 aa1958c6 Simon Schulz
#######################################
18
# check if we have RSB support:
19
IF (IGNORE_RSB) 
20
    MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB")
21
ELSE (IGNORE_RSB)
22 0c286af0 Simon Schulz
FIND_PACKAGE(RSB 0.11)
23
IF (RSB_FOUND)
24
    #RSB
25
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
26
    FIND_PACKAGE(RSC 0.11 REQUIRED)
27
    FIND_PACKAGE(RSB 0.11 REQUIRED)
28
    #RST
29
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
30
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
31
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
32
33
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
34
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
35
    #RSB
36
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
37
    FIND_PACKAGE(RSC 0.11 REQUIRED)
38
    FIND_PACKAGE(RSB 0.11 REQUIRED)
39
    #RST
40
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
41
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
42
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
43
44
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
45
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
46
47
    message(STATUS "RSB Support is ON")
48
    add_definitions(-DRSB_SUPPORT=1)
49
ENDIF (RSB_FOUND)
50 aa1958c6 Simon Schulz
ENDIF(IGNORE_RSB)
51 0c286af0 Simon Schulz
52
################################################################
53
# check for ROS support:
54
find_package(catkin)
55
IF (catkin_FOUND)
56
    SET(ROS_FOUND 1)
57
58 2cf3c285 Robert Haschke
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs geometry_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib tf2_ros tf2_eigen angles)
59
    find_package(PkgConfig REQUIRED)
60
    pkg_search_module(EIGEN3 REQUIRED eigen3)
61 0c286af0 Simon Schulz
62
    message(STATUS "ROS Support is ON")
63
    add_definitions(-DROS_SUPPORT=1)
64
65
    add_message_files(
66
        FILES
67
        phoneme.msg
68
        soundchunk.msg
69 b47687f8 Robert Haschke
        utterance.msg
70 0c286af0 Simon Schulz
    )
71
72
    add_service_files(
73
        FILES
74
    )
75
76
    add_action_files(
77
        DIRECTORY action
78
        FILES
79
        animation.action
80
        speech.action
81
        utterance.action
82 b47687f8 Robert Haschke
        tts.action
83 0c286af0 Simon Schulz
        emotionstate.action
84
        gazetarget.action
85 b47687f8 Robert Haschke
        lookattarget.action
86 0c286af0 Simon Schulz
        mouthtarget.action
87
    )
88
89
    generate_messages(
90
        DEPENDENCIES
91
        actionlib_msgs
92
        std_msgs
93 b47687f8 Robert Haschke
        geometry_msgs
94 0c286af0 Simon Schulz
        hlrc_server
95
    )
96
97
    catkin_package(
98
        INCLUDE_DIRS include
99 f0dcf4ca Robert Haschke
        LIBRARIES
100 0c286af0 Simon Schulz
        CATKIN_DEPENDS actionlib_msgs
101
        #CATKIN_DEPENDS message_runtime
102
        #DEPENDS system_lib
103
    )
104
ENDIF (catkin_FOUND)
105
106
add_definitions ("-Wall")
107
108
###################################
109
# humotion
110
INCLUDE(FindPkgConfig)
111
find_package(humotion 0.0.1)
112
IF (humotion_FOUND)
113
        message("> using humotion includes from " ${humotion_INCLUDE_DIRS})
114
ELSE (humotion_FOUND)
115
        message(FATAL_ERROR "> error: can not find libhumotion")
116
endif (humotion_FOUND)
117
118
###################################
119
# libao audio
120
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
121
IF (AO_FOUND)
122
  SET(AO_LIBRARY_DIRS "${AO_PREFIX}/lib")
123
  SET(AO_INCLUDE_DIRS "${AO_PREFIX}/include")
124
  SET(AO_LIBRARIES "ao")
125
  MESSAGE("using libao version ${AO_VERSION} from ${AO_PREFIX}")
126
ELSE (AO_FOUND)
127
  message(FATAL_ERROR "Error: Cannot find libao")
128
ENDIF (AO_FOUND)
129
130
#build 
131 2cf3c285 Robert Haschke
include_directories(include ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${AO_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS})
132 9af6ff03 Simon Schulz
link_directories(${catkin_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${AO_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS})
133 0c286af0 Simon Schulz
134
#build dummy list of header files
135
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h include/RSB/*.h include/ROS/*.h)
136
137
# declare library
138
add_executable(${PROJECT_NAME}
139
    src/main.cpp
140
    src/MiddlewareRSB.cpp
141
    src/MiddlewareROS.cpp
142
    src/Arbiter.cpp
143
    src/Utterance.cpp
144
    src/Animation.cpp
145
    src/AudioPlayer.cpp
146
    src/AudioPlayerRSB.cpp
147
    src/AudioPlayerLibAO.cpp
148
    src/MouthConfig.cpp
149
    src/EmotionState.cpp
150
    src/EmotionConfig.cpp
151
    src/Middleware.cpp
152
    ${MIDDLEWARE_SOURCES}
153
    ${DUMMY_HEADER_LIST}
154
)
155
156
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
157
158
#create example:
159
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${RSB_LIBRARIES}  ${catkin_LIBRARIES} ${RST_LIBRARIES} ${humotion_LIBRARIES} ${AO_LIBRARIES})
160 5303d8b4 Simon Schulz
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
161
162 0c286af0 Simon Schulz
163
IF (catkin_FOUND)
164
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp)
165
ENDIF (catkin_FOUND)
166
167
#    install(TARGETS ${PROJECT_NAME}
168
#        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
169
#        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
170
#        RUNTIME DESTINATION bin
171
#    )
172
173
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
174