Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ 7a4bc347

History | View | Annotate | Download (4.353 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
    )
60

    
61
    add_service_files(
62
        FILES
63
    )
64

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

    
76
    generate_messages(
77
        DEPENDENCIES
78
        actionlib_msgs
79
        std_msgs
80
        hlrc_server
81
    )
82

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

    
92
add_definitions ("-Wall")
93

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

    
103
endif (humotion_FOUND)
104

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

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

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

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

    
143
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
144

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

    
148
IF (catkin_FOUND)
149
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp)
150
ENDIF (catkin_FOUND)
151

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

    
158
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
159

    
160