hlrc / server / CMakeLists.txt @ 4b94fa20
History | View | Annotate | Download (4.565 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 |
option(WITH_RSB "WITH_RSB" ON) |
16 |
|
17 |
IF(WITH_RSB) |
18 |
FIND_PACKAGE(RSB 0.11) |
19 |
IF (RSB_FOUND) |
20 |
#RSB |
21 |
SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/") |
22 |
FIND_PACKAGE(RSC 0.11 REQUIRED) |
23 |
FIND_PACKAGE(RSB 0.11 REQUIRED) |
24 |
#RST |
25 |
FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox) |
26 |
INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS}) |
27 |
ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS}) |
28 |
|
29 |
INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) |
30 |
LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH}) |
31 |
#RSB |
32 |
SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/") |
33 |
FIND_PACKAGE(RSC 0.11 REQUIRED) |
34 |
FIND_PACKAGE(RSB 0.11 REQUIRED) |
35 |
#RST |
36 |
FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox) |
37 |
INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS}) |
38 |
ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS}) |
39 |
|
40 |
INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) |
41 |
LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH}) |
42 |
|
43 |
message(STATUS "RSB Support is ON") |
44 |
add_definitions(-DRSB_SUPPORT=1) |
45 |
ENDIF (RSB_FOUND) |
46 |
ENDIF(WITH_RSB) |
47 |
|
48 |
################################################################ |
49 |
# check for ROS support: |
50 |
find_package(catkin) |
51 |
IF (catkin_FOUND) |
52 |
SET(ROS_FOUND 1) |
53 |
|
54 |
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib) |
55 |
|
56 |
message(STATUS "ROS Support is ON") |
57 |
add_definitions(-DROS_SUPPORT=1) |
58 |
|
59 |
add_message_files( |
60 |
FILES |
61 |
phoneme.msg |
62 |
soundchunk.msg |
63 |
utterance.msg |
64 |
) |
65 |
|
66 |
add_service_files( |
67 |
FILES |
68 |
) |
69 |
|
70 |
add_action_files( |
71 |
DIRECTORY action |
72 |
FILES |
73 |
animation.action |
74 |
speech.action |
75 |
utterance.action |
76 |
tts.action |
77 |
emotionstate.action |
78 |
gazetarget.action |
79 |
mouthtarget.action |
80 |
) |
81 |
|
82 |
generate_messages( |
83 |
DEPENDENCIES |
84 |
actionlib_msgs |
85 |
std_msgs |
86 |
hlrc_server |
87 |
) |
88 |
|
89 |
catkin_package( |
90 |
INCLUDE_DIRS include |
91 |
LIBRARIES hlrc_server |
92 |
CATKIN_DEPENDS actionlib_msgs |
93 |
#CATKIN_DEPENDS message_runtime |
94 |
#DEPENDS system_lib |
95 |
) |
96 |
ENDIF (catkin_FOUND) |
97 |
|
98 |
add_definitions ("-Wall") |
99 |
|
100 |
################################### |
101 |
# humotion |
102 |
INCLUDE(FindPkgConfig) |
103 |
find_package(humotion 0.0.1) |
104 |
IF (humotion_FOUND) |
105 |
message("> using humotion includes from " ${humotion_INCLUDE_DIRS}) |
106 |
ELSE (humotion_FOUND) |
107 |
message(FATAL_ERROR "> error: can not find libhumotion") |
108 |
|
109 |
endif (humotion_FOUND) |
110 |
|
111 |
################################### |
112 |
# libao audio |
113 |
PKG_CHECK_MODULES(AO REQUIRED ao>=1.1.0) |
114 |
IF (AO_FOUND) |
115 |
SET(AO_LIBRARY_DIRS "${AO_PREFIX}/lib") |
116 |
SET(AO_INCLUDE_DIRS "${AO_PREFIX}/include") |
117 |
SET(AO_LIBRARIES "ao") |
118 |
MESSAGE("using libao version ${AO_VERSION} from ${AO_PREFIX}") |
119 |
ELSE (AO_FOUND) |
120 |
message(FATAL_ERROR "Error: Cannot find libao") |
121 |
ENDIF (AO_FOUND) |
122 |
|
123 |
#build |
124 |
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${AO_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS}) |
125 |
link_directories(${catkin_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${AO_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS}) |
126 |
|
127 |
#build dummy list of header files |
128 |
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h include/RSB/*.h include/ROS/*.h) |
129 |
|
130 |
# declare library |
131 |
add_executable(${PROJECT_NAME} |
132 |
src/main.cpp |
133 |
src/MiddlewareRSB.cpp |
134 |
src/MiddlewareROS.cpp |
135 |
src/Arbiter.cpp |
136 |
src/Utterance.cpp |
137 |
src/Animation.cpp |
138 |
src/AudioPlayer.cpp |
139 |
src/AudioPlayerRSB.cpp |
140 |
src/AudioPlayerLibAO.cpp |
141 |
src/MouthConfig.cpp |
142 |
src/EmotionState.cpp |
143 |
src/EmotionConfig.cpp |
144 |
src/Middleware.cpp |
145 |
${MIDDLEWARE_SOURCES} |
146 |
${DUMMY_HEADER_LIST} |
147 |
) |
148 |
|
149 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") |
150 |
|
151 |
#create example: |
152 |
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${RSB_LIBRARIES} ${catkin_LIBRARIES} ${RST_LIBRARIES} ${humotion_LIBRARIES} ${AO_LIBRARIES}) |
153 |
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) |
154 |
|
155 |
|
156 |
IF (catkin_FOUND) |
157 |
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp) |
158 |
ENDIF (catkin_FOUND) |
159 |
|
160 |
# install(TARGETS ${PROJECT_NAME} |
161 |
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
162 |
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
163 |
# RUNTIME DESTINATION bin |
164 |
# ) |
165 |
|
166 |
install(TARGETS ${PROJECT_NAME} DESTINATION bin) |
167 |
|
168 |
|