Statistics
| Branch: | Tag: | Revision:

hlrc / server / CMakeLists.txt @ fc4357ee

History | View | Annotate | Download (4.86 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
set(ENV{ROS_LANG_DISABLE} "genjava")
11

    
12
## System dependencies are found with CMake's conventions
13
# find_package(Boost REQUIRED COMPONENTS system)
14

    
15
INCLUDE(FindPkgConfig)
16

    
17
#######################################
18
#allow forced disable of RSB
19
option(IGNORE_RSB "IGNORE_RSB" OFF)
20

    
21
#######################################
22
# check if we have RSB support:
23
IF (IGNORE_RSB)
24
    MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB")
25
ELSE (IGNORE_RSB)
26
FIND_PACKAGE(RSB 0.11 QUIET)
27
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
ELSE(RSB_FOUND)
54
    message(STATUS "RSB not found.")
55
ENDIF (RSB_FOUND)
56
ENDIF(IGNORE_RSB)
57

    
58
################################################################
59
# check for ROS support:
60
find_package(catkin QUIET)
61
IF (catkin_FOUND)
62
    SET(ROS_FOUND 1)
63

    
64
    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
    find_package(PkgConfig REQUIRED)
66
    pkg_search_module(EIGEN3 REQUIRED eigen3)
67

    
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
        utterance.msg
76
    )
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
        tts.action
89
        emotionstate.action
90
        gazetarget.action
91
        lookattarget.action
92
        mouthtarget.action
93
    )
94

    
95
    generate_messages(
96
        DEPENDENCIES
97
        actionlib_msgs
98
        std_msgs
99
        geometry_msgs
100
        hlrc_server
101
    )
102

    
103
    catkin_package(
104
        # INCLUDE_DIRS include
105
        LIBRARIES
106
        CATKIN_DEPENDS actionlib_msgs
107
        #CATKIN_DEPENDS message_runtime
108
        #DEPENDS system_lib
109
    )
110
ELSE(catkin_FOUND)
111
    message(STATUS "ROS not found.")
112
ENDIF(catkin_FOUND)
113

    
114
add_definitions ("-Wall")
115

    
116
###################################
117
# humotion
118
INCLUDE(FindPkgConfig)
119
find_package(humotion 0.0.1 REQUIRED)
120
message(STATUS "using humotion includes from " ${humotion_INCLUDE_DIRS})
121

    
122
###################################
123
# libao audio
124
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0)
125
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

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

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

    
162

    
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)