Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ 465c7ad7

History | View | Annotate | Download (4.802 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 b47687f8 Robert Haschke
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs geometry_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib)
59 0c286af0 Simon Schulz
60
    message(STATUS "ROS Support is ON")
61
    add_definitions(-DROS_SUPPORT=1)
62
63
    add_message_files(
64
        FILES
65
        phoneme.msg
66
        soundchunk.msg
67 b47687f8 Robert Haschke
        utterance.msg
68 0c286af0 Simon Schulz
    )
69
70
    add_service_files(
71
        FILES
72
    )
73
74
    add_action_files(
75
        DIRECTORY action
76
        FILES
77
        animation.action
78
        speech.action
79
        utterance.action
80 b47687f8 Robert Haschke
        tts.action
81 0c286af0 Simon Schulz
        emotionstate.action
82
        gazetarget.action
83 b47687f8 Robert Haschke
        lookattarget.action
84 0c286af0 Simon Schulz
        mouthtarget.action
85
    )
86
87
    generate_messages(
88
        DEPENDENCIES
89
        actionlib_msgs
90
        std_msgs
91 b47687f8 Robert Haschke
        geometry_msgs
92 0c286af0 Simon Schulz
        hlrc_server
93
    )
94
95
    catkin_package(
96
        INCLUDE_DIRS include
97
        LIBRARIES hlrc_server
98
        CATKIN_DEPENDS actionlib_msgs
99
        #CATKIN_DEPENDS message_runtime
100
        #DEPENDS system_lib
101
    )
102
ENDIF (catkin_FOUND)
103
104
add_definitions ("-Wall")
105
106
###################################
107
# humotion
108
INCLUDE(FindPkgConfig)
109
find_package(humotion 0.0.1)
110
IF (humotion_FOUND)
111
        message("> using humotion includes from " ${humotion_INCLUDE_DIRS})
112
ELSE (humotion_FOUND)
113
        message(FATAL_ERROR "> error: can not find libhumotion")
114
115
endif (humotion_FOUND)
116
117
###################################
118
# libao audio
119
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
120
IF (AO_FOUND)
121
  SET(AO_LIBRARY_DIRS "${AO_PREFIX}/lib")
122
  SET(AO_INCLUDE_DIRS "${AO_PREFIX}/include")
123
  SET(AO_LIBRARIES "ao")
124
  MESSAGE("using libao version ${AO_VERSION} from ${AO_PREFIX}")
125
ELSE (AO_FOUND)
126
  message(FATAL_ERROR "Error: Cannot find libao")
127
ENDIF (AO_FOUND)
128
129
#build 
130 9af6ff03 Simon Schulz
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${AO_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS})
131
link_directories(${catkin_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${AO_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS})
132 0c286af0 Simon Schulz
133
#build dummy list of header files
134
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h include/RSB/*.h include/ROS/*.h)
135
136
# declare library
137
add_executable(${PROJECT_NAME}
138
    src/main.cpp
139
    src/MiddlewareRSB.cpp
140
    src/MiddlewareROS.cpp
141
    src/Arbiter.cpp
142
    src/Utterance.cpp
143
    src/Animation.cpp
144
    src/AudioPlayer.cpp
145
    src/AudioPlayerRSB.cpp
146
    src/AudioPlayerLibAO.cpp
147
    src/MouthConfig.cpp
148
    src/EmotionState.cpp
149
    src/EmotionConfig.cpp
150
    src/Middleware.cpp
151
    ${MIDDLEWARE_SOURCES}
152
    ${DUMMY_HEADER_LIST}
153
)
154
155
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
156
157
#create example:
158
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${RSB_LIBRARIES}  ${catkin_LIBRARIES} ${RST_LIBRARIES} ${humotion_LIBRARIES} ${AO_LIBRARIES})
159 5303d8b4 Simon Schulz
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
160
161 0c286af0 Simon Schulz
162
IF (catkin_FOUND)
163
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp)
164
ENDIF (catkin_FOUND)
165
166
#    install(TARGETS ${PROJECT_NAME}
167
#        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
168
#        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
169
#        RUNTIME DESTINATION bin
170
#    )
171
172
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
173