Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ 6dee6447

History | View | Annotate | Download (4.718 KB)

1
cmake_minimum_required(VERSION 2.8.3)
2
project(hlrc_server)
3

    
4
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
INCLUDE(FindPkgConfig)
11

    
12
#######################################
13
#allow forced disable of RSB
14
option(IGNORE_RSB "IGNORE_RSB" OFF)
15

    
16
#######################################
17
# check if we have RSB support:
18
IF (IGNORE_RSB)
19
    MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB")
20
ELSE (IGNORE_RSB)
21
FIND_PACKAGE(RSB 0.11 QUIET)
22
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
ELSE(RSB_FOUND)
49
    message(STATUS "RSB not found.")
50
ENDIF (RSB_FOUND)
51
ENDIF(IGNORE_RSB)
52

    
53
################################################################
54
# check for ROS support:
55
find_package(catkin QUIET)
56
IF (catkin_FOUND)
57
    SET(ROS_FOUND 1)
58

    
59
    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
    find_package(PkgConfig REQUIRED)
61
    pkg_search_module(EIGEN3 REQUIRED eigen3)
62

    
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
        utterance.msg
71
    )
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
        tts.action
84
        emotionstate.action
85
        gazetarget.action
86
        lookattarget.action
87
        mouthtarget.action
88
    )
89

    
90
    generate_messages(
91
        DEPENDENCIES
92
        actionlib_msgs
93
        std_msgs
94
        geometry_msgs
95
        hlrc_server
96
    )
97

    
98
    catkin_package(
99
        # INCLUDE_DIRS include
100
        LIBRARIES
101
        CATKIN_DEPENDS actionlib_msgs
102
        #CATKIN_DEPENDS message_runtime
103
        #DEPENDS system_lib
104
    )
105
ELSE(catkin_FOUND)
106
    message(STATUS "ROS not found.")
107
ENDIF(catkin_FOUND)
108

    
109
add_definitions ("-Wall")
110

    
111
###################################
112
# humotion
113
INCLUDE(FindPkgConfig)
114
find_package(humotion 0.0.1 REQUIRED)
115
message(STATUS "using humotion includes from " ${humotion_INCLUDE_DIRS})
116

    
117
###################################
118
# libao audio
119
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
120
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

    
125
#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

    
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
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
156

    
157

    
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)