Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ 38936fe1

History | View | Annotate | Download (4.718 KB)

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