Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ 78cc756c

History | View | Annotate | Download (4.726 KB)

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

    
4
set(ENV{ROS_LANG_DISABLE} "genjava")
5

    
6
## 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
#allow forced disable of RSB
15
option(IGNORE_RSB "IGNORE_RSB" OFF)
16

    
17
#######################################
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
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
ENDIF(IGNORE_RSB)
51

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

    
58
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib)
59

    
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
	utterance.msg
68
    )
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
	tts.action
81
        emotionstate.action
82
        gazetarget.action
83
        mouthtarget.action
84
    )
85

    
86
    generate_messages(
87
        DEPENDENCIES
88
        actionlib_msgs
89
        std_msgs
90
        hlrc_server
91
    )
92

    
93
    catkin_package(
94
        INCLUDE_DIRS include
95
        LIBRARIES hlrc_server
96
        CATKIN_DEPENDS actionlib_msgs
97
        #CATKIN_DEPENDS message_runtime
98
        #DEPENDS system_lib
99
    )
100
ENDIF (catkin_FOUND)
101

    
102
add_definitions ("-Wall")
103

    
104
###################################
105
# humotion
106
INCLUDE(FindPkgConfig)
107
find_package(humotion 0.0.1)
108
IF (humotion_FOUND)
109
        message("> using humotion includes from " ${humotion_INCLUDE_DIRS})
110
ELSE (humotion_FOUND)
111
        message(FATAL_ERROR "> error: can not find libhumotion")
112

    
113
endif (humotion_FOUND)
114

    
115
###################################
116
# libao audio
117
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
118
IF (AO_FOUND)
119
  SET(AO_LIBRARY_DIRS "${AO_PREFIX}/lib")
120
  SET(AO_INCLUDE_DIRS "${AO_PREFIX}/include")
121
  SET(AO_LIBRARIES "ao")
122
  MESSAGE("using libao version ${AO_VERSION} from ${AO_PREFIX}")
123
ELSE (AO_FOUND)
124
  message(FATAL_ERROR "Error: Cannot find libao")
125
ENDIF (AO_FOUND)
126

    
127
#build 
128
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${AO_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS})
129
link_directories(${catkin_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${AO_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS})
130

    
131
#build dummy list of header files
132
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h include/RSB/*.h include/ROS/*.h)
133

    
134
# declare library
135
add_executable(${PROJECT_NAME}
136
    src/main.cpp
137
    src/MiddlewareRSB.cpp
138
    src/MiddlewareROS.cpp
139
    src/Arbiter.cpp
140
    src/Utterance.cpp
141
    src/Animation.cpp
142
    src/AudioPlayer.cpp
143
    src/AudioPlayerRSB.cpp
144
    src/AudioPlayerLibAO.cpp
145
    src/MouthConfig.cpp
146
    src/EmotionState.cpp
147
    src/EmotionConfig.cpp
148
    src/Middleware.cpp
149
    ${MIDDLEWARE_SOURCES}
150
    ${DUMMY_HEADER_LIST}
151
)
152

    
153
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
154

    
155
#create example:
156
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${RSB_LIBRARIES}  ${catkin_LIBRARIES} ${RST_LIBRARIES} ${humotion_LIBRARIES} ${AO_LIBRARIES})
157
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
158

    
159

    
160
IF (catkin_FOUND)
161
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp)
162
ENDIF (catkin_FOUND)
163

    
164
#    install(TARGETS ${PROJECT_NAME}
165
#        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
166
#        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
167
#        RUNTIME DESTINATION bin
168
#    )
169

    
170
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
171

    
172