Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ e21d7f2c

History | View | Annotate | Download (4.379 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
# check if we have RSB support:
15
FIND_PACKAGE(RSB 0.11)
16
IF (RSB_FOUND)
17
    #RSB
18
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
19
    FIND_PACKAGE(RSC 0.11 REQUIRED)
20
    FIND_PACKAGE(RSB 0.11 REQUIRED)
21
    #RST
22
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
23
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
24
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
25

    
26
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
27
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
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

    
40
    message(STATUS "RSB Support is ON")
41
    add_definitions(-DRSB_SUPPORT=1)
42
ENDIF (RSB_FOUND)
43

    
44
################################################################
45
# check for ROS support:
46
find_package(catkin)
47
IF (catkin_FOUND)
48
    SET(ROS_FOUND 1)
49

    
50
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib)
51

    
52
    message(STATUS "ROS Support is ON")
53
    add_definitions(-DROS_SUPPORT=1)
54

    
55
    add_message_files(
56
        FILES
57
        phoneme.msg
58
        soundchunk.msg
59
	utterance.msg
60
    )
61

    
62
    add_service_files(
63
        FILES
64
    )
65

    
66
    add_action_files(
67
        DIRECTORY action
68
        FILES
69
        animation.action
70
        speech.action
71
        utterance.action
72
	tts.action
73
        emotionstate.action
74
        gazetarget.action
75
        mouthtarget.action
76
    )
77

    
78
    generate_messages(
79
        DEPENDENCIES
80
        actionlib_msgs
81
        std_msgs
82
        hlrc_server
83
    )
84

    
85
    catkin_package(
86
        INCLUDE_DIRS include
87
        LIBRARIES hlrc_server
88
        CATKIN_DEPENDS actionlib_msgs
89
        #CATKIN_DEPENDS message_runtime
90
        #DEPENDS system_lib
91
    )
92
ENDIF (catkin_FOUND)
93

    
94
add_definitions ("-Wall")
95

    
96
###################################
97
# humotion
98
INCLUDE(FindPkgConfig)
99
find_package(humotion 0.0.1)
100
IF (humotion_FOUND)
101
        message("> using humotion includes from " ${humotion_INCLUDE_DIRS})
102
ELSE (humotion_FOUND)
103
        message(FATAL_ERROR "> error: can not find libhumotion")
104

    
105
endif (humotion_FOUND)
106

    
107
###################################
108
# libao audio
109
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
110
IF (AO_FOUND)
111
  SET(AO_LIBRARY_DIRS "${AO_PREFIX}/lib")
112
  SET(AO_INCLUDE_DIRS "${AO_PREFIX}/include")
113
  SET(AO_LIBRARIES "ao")
114
  MESSAGE("using libao version ${AO_VERSION} from ${AO_PREFIX}")
115
ELSE (AO_FOUND)
116
  message(FATAL_ERROR "Error: Cannot find libao")
117
ENDIF (AO_FOUND)
118

    
119
#build 
120
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${AO_INCLUDE_DIRS})
121
link_directories(${catkin_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${AO_LIBRARY_DIRS})
122

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

    
126
# declare library
127
add_executable(${PROJECT_NAME}
128
    src/main.cpp
129
    src/MiddlewareRSB.cpp
130
    src/MiddlewareROS.cpp
131
    src/Arbiter.cpp
132
    src/Utterance.cpp
133
    src/Animation.cpp
134
    src/AudioPlayer.cpp
135
    src/AudioPlayerRSB.cpp
136
    src/AudioPlayerLibAO.cpp
137
    src/MouthConfig.cpp
138
    src/EmotionState.cpp
139
    src/EmotionConfig.cpp
140
    src/Middleware.cpp
141
    ${MIDDLEWARE_SOURCES}
142
    ${DUMMY_HEADER_LIST}
143
)
144

    
145
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
146

    
147
#create example:
148
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${RSB_LIBRARIES}  ${catkin_LIBRARIES} ${RST_LIBRARIES} ${humotion_LIBRARIES} ${AO_LIBRARIES})
149

    
150
IF (catkin_FOUND)
151
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp)
152
ENDIF (catkin_FOUND)
153

    
154
#    install(TARGETS ${PROJECT_NAME}
155
#        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
156
#        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
157
#        RUNTIME DESTINATION bin
158
#    )
159

    
160
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
161

    
162