Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ fc4357ee

History | View | Annotate | Download (4.86 KB)

1 0c286af0 Simon Schulz
cmake_minimum_required(VERSION 2.8.3)
2
project(hlrc_server)
3
4 fc4357ee 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 7c5d8279 Simon Schulz
set(ENV{ROS_LANG_DISABLE} "genjava")
11
12 0c286af0 Simon Schulz
## System dependencies are found with CMake's conventions
13
# find_package(Boost REQUIRED COMPONENTS system)
14
15
INCLUDE(FindPkgConfig)
16
17
#######################################
18 aa1958c6 Simon Schulz
#allow forced disable of RSB
19
option(IGNORE_RSB "IGNORE_RSB" OFF)
20 9aa2bb7c semeyerz
21 aa1958c6 Simon Schulz
#######################################
22
# check if we have RSB support:
23 fc4357ee Robert Haschke
IF (IGNORE_RSB)
24 aa1958c6 Simon Schulz
    MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB")
25
ELSE (IGNORE_RSB)
26 23fe067c Robert Haschke
FIND_PACKAGE(RSB 0.11 QUIET)
27 0c286af0 Simon Schulz
IF (RSB_FOUND)
28
    #RSB
29
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
30
    FIND_PACKAGE(RSC 0.11 REQUIRED)
31
    FIND_PACKAGE(RSB 0.11 REQUIRED)
32
    #RST
33
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
34
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
35
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
36
37
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
38
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
39
    #RSB
40
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
41
    FIND_PACKAGE(RSC 0.11 REQUIRED)
42
    FIND_PACKAGE(RSB 0.11 REQUIRED)
43
    #RST
44
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
45
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
46
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
47
48
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
49
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
50
51
    message(STATUS "RSB Support is ON")
52
    add_definitions(-DRSB_SUPPORT=1)
53 23fe067c Robert Haschke
ELSE(RSB_FOUND)
54
    message(STATUS "RSB not found.")
55 0c286af0 Simon Schulz
ENDIF (RSB_FOUND)
56 aa1958c6 Simon Schulz
ENDIF(IGNORE_RSB)
57 0c286af0 Simon Schulz
58
################################################################
59
# check for ROS support:
60 23fe067c Robert Haschke
find_package(catkin QUIET)
61 0c286af0 Simon Schulz
IF (catkin_FOUND)
62
    SET(ROS_FOUND 1)
63
64 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)
65 2cf3c285 Robert Haschke
    find_package(PkgConfig REQUIRED)
66
    pkg_search_module(EIGEN3 REQUIRED eigen3)
67 0c286af0 Simon Schulz
68
    message(STATUS "ROS Support is ON")
69
    add_definitions(-DROS_SUPPORT=1)
70
71
    add_message_files(
72
        FILES
73
        phoneme.msg
74
        soundchunk.msg
75 b47687f8 Robert Haschke
        utterance.msg
76 0c286af0 Simon Schulz
    )
77
78
    add_service_files(
79
        FILES
80
    )
81
82
    add_action_files(
83
        DIRECTORY action
84
        FILES
85
        animation.action
86
        speech.action
87
        utterance.action
88 b47687f8 Robert Haschke
        tts.action
89 0c286af0 Simon Schulz
        emotionstate.action
90
        gazetarget.action
91 b47687f8 Robert Haschke
        lookattarget.action
92 0c286af0 Simon Schulz
        mouthtarget.action
93
    )
94
95
    generate_messages(
96
        DEPENDENCIES
97
        actionlib_msgs
98
        std_msgs
99 b47687f8 Robert Haschke
        geometry_msgs
100 0c286af0 Simon Schulz
        hlrc_server
101
    )
102
103
    catkin_package(
104 96284eda Fabian Berthold
        # INCLUDE_DIRS include
105 f0dcf4ca Robert Haschke
        LIBRARIES
106 0c286af0 Simon Schulz
        CATKIN_DEPENDS actionlib_msgs
107
        #CATKIN_DEPENDS message_runtime
108
        #DEPENDS system_lib
109
    )
110 23fe067c Robert Haschke
ELSE(catkin_FOUND)
111
    message(STATUS "ROS not found.")
112
ENDIF(catkin_FOUND)
113 0c286af0 Simon Schulz
114
add_definitions ("-Wall")
115
116
###################################
117
# humotion
118
INCLUDE(FindPkgConfig)
119 23fe067c Robert Haschke
find_package(humotion 0.0.1 REQUIRED)
120
message(STATUS "using humotion includes from " ${humotion_INCLUDE_DIRS})
121 0c286af0 Simon Schulz
122
###################################
123
# libao audio
124
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
125 23fe067c Robert Haschke
SET(AO_LIBRARY_DIRS "${AO_PREFIX}/lib")
126
SET(AO_INCLUDE_DIRS "${AO_PREFIX}/include")
127
SET(AO_LIBRARIES "ao")
128
MESSAGE(STATUS "using libao version ${AO_VERSION} from ${AO_PREFIX}")
129 0c286af0 Simon Schulz
130 fc4357ee Robert Haschke
#build
131
include_directories(include ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${AO_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS})
132
link_directories(${catkin_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)