hlrc / client / cpp / CMakeLists.txt @ 1e1da985
History | View | Annotate | Download (6.607 KB)
1 | f1d65328 | Robert Haschke | PROJECT(hlrc_client_cpp) |
---|---|---|---|
2 | |||
3 | if(NOT "${CMAKE_CXX_STANDARD}") |
||
4 | set(CMAKE_CXX_STANDARD 11) |
||
5 | endif() |
||
6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
||
7 | set(CMAKE_CXX_EXTENSIONS OFF) |
||
8 | 0c286af0 | Simon Schulz | |
9 | #debug? |
||
10 | set(CMAKE_BUILD_TYPE Debug) |
||
11 | |||
12 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) |
||
13 | INCLUDE(FindPkgConfig) |
||
14 | |||
15 | SET(HLRC_CLIENT_LIBNAME "${PROJECT_NAME}") |
||
16 | SET(HLRC_CLIENT_VERSION_MAJOR "0") |
||
17 | SET(HLRC_CLIENT_VERSION_MINOR "1") |
||
18 | SET(HLRC_CLIENT_VERSION_REVISION "0") |
||
19 | SET(HLRC_CLIENT_VERSION "${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}.${HLRC_CLIENT_VERSION_REVISION}") |
||
20 | SET(HLRC_CLIENT_SOVERSION "${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}") |
||
21 | SET(HLRC_CLIENT_PACKAGE "${HLRC_CLIENT_LIBNAME}-${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}") |
||
22 | |||
23 | SET(PREFIX ${CMAKE_INSTALL_PREFIX}) |
||
24 | SET(BINDIR "${PREFIX}/bin") |
||
25 | SET(INCLUDEDIR "${PREFIX}/include/hlrc_client") |
||
26 | SET(MANDIR "${PREFIX}/man") |
||
27 | SET(LIBDIR "${PREFIX}/lib") |
||
28 | SET(PKGDIR "${PREFIX}/lib/pkgconfig") |
||
29 | SET(DATADIR "${PREFIX}/share/hlrc_client") |
||
30 | |||
31 | ####################################### |
||
32 | 3c77f276 | Robert Haschke | FIND_PACKAGE(hlrc_server) |
33 | |||
34 | c5a47e56 | Simon Schulz | ####################################### |
35 | #allow forced disable of RSB |
||
36 | option(IGNORE_RSB "IGNORE_RSB" OFF) |
||
37 | 9aa2bb7c | semeyerz | |
38 | c5a47e56 | Simon Schulz | ####################################### |
39 | # check if we have RSB support: |
||
40 | IF (IGNORE_RSB) |
||
41 | MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB") |
||
42 | ELSE (IGNORE_RSB) |
||
43 | b3694223 | Robert Haschke | FIND_PACKAGE(RSB 0.11 QUIET) |
44 | 0c286af0 | Simon Schulz | IF (RSB_FOUND) |
45 | #RSB |
||
46 | SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/") |
||
47 | FIND_PACKAGE(RSC 0.11 REQUIRED) |
||
48 | FIND_PACKAGE(RSB 0.11 REQUIRED) |
||
49 | #RST |
||
50 | FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox) |
||
51 | INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS}) |
||
52 | ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS}) |
||
53 | |||
54 | INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) |
||
55 | LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH}) |
||
56 | #RSB |
||
57 | SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/") |
||
58 | FIND_PACKAGE(RSC 0.11 REQUIRED) |
||
59 | FIND_PACKAGE(RSB 0.11 REQUIRED) |
||
60 | #RST |
||
61 | FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox) |
||
62 | INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS}) |
||
63 | ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS}) |
||
64 | |||
65 | INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) |
||
66 | LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH}) |
||
67 | |||
68 | message(STATUS "RSB Support is ON") |
||
69 | add_definitions(-DRSB_SUPPORT=1) |
||
70 | b3694223 | Robert Haschke | ELSE(RSB_FOUND) |
71 | message(STATUS "RSB not found.") |
||
72 | ENDIF(RSB_FOUND) |
||
73 | c5a47e56 | Simon Schulz | ENDIF(IGNORE_RSB) |
74 | |||
75 | 0c286af0 | Simon Schulz | ################################################################ |
76 | # check for ROS support: |
||
77 | b3694223 | Robert Haschke | find_package(catkin QUIET) |
78 | IF(catkin_FOUND) |
||
79 | 0c286af0 | Simon Schulz | SET(ROS_FOUND 1) |
80 | |||
81 | catkin_package( |
||
82 | INCLUDE_DIRS include |
||
83 | 96284eda | Fabian Berthold | LIBRARIES ${HLRC_CLIENT_LIBNAME} |
84 | 0c286af0 | Simon Schulz | ) |
85 | 462c8a3c | sschulz | |
86 | 96284eda | Fabian Berthold | find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg hlrc_server humotion tf2_eigen actionlib) |
87 | |||
88 | 0c286af0 | Simon Schulz | message(STATUS "ROS Support is ON") |
89 | add_definitions(-DROS_SUPPORT=1) |
||
90 | 02461ac8 | Robert Haschke | include_directories(${catkin_INCLUDE_DIRS}) |
91 | b3694223 | Robert Haschke | ELSE(catkin_FOUND) |
92 | message(STATUS "ROS not found.") |
||
93 | ENDIF(catkin_FOUND) |
||
94 | 0c286af0 | Simon Schulz | |
95 | add_definitions ("-Wall") |
||
96 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fstack-protector-all ") |
||
97 | set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" ) |
||
98 | |||
99 | 462c8a3c | sschulz | #search for Boost |
100 | f1d65328 | Robert Haschke | find_package( Boost 1.46 REQUIRED COMPONENTS program_options filesystem regex) |
101 | 0c286af0 | Simon Schulz | LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) |
102 | include_directories(${Boost_INCLUDE_DIRS} ) |
||
103 | b3694223 | Robert Haschke | message(STATUS "using ${Boost_LIBRARIES}") |
104 | 0c286af0 | Simon Schulz | |
105 | ef67692b | Simon Schulz | INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include) |
106 | 0c286af0 | Simon Schulz | |
107 | # SET(PREFIX ${CMAKE_INSTALL_PREFIX}) |
||
108 | # SET(BINDIR "${PREFIX}/bin") |
||
109 | # SET(INCLUDEDIR "${PREFIX}/include") |
||
110 | # SET(MANDIR "${PREFIX}/man") |
||
111 | # SET(LIBDIR "${PREFIX}/lib") |
||
112 | # SET(DATADIR "${PREFIX}/share/${NAME}") |
||
113 | |||
114 | #this dummy list will make all header files appear if you use qtcreator to open the cmake project |
||
115 | file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h ) |
||
116 | |||
117 | SET(LIB_CLASSES |
||
118 | src/RobotController.cpp |
||
119 | src/Middleware.cpp |
||
120 | src/MiddlewareROS.cpp |
||
121 | src/MiddlewareRSB.cpp |
||
122 | ) |
||
123 | |||
124 | add_library(${HLRC_CLIENT_LIBNAME} SHARED |
||
125 | ${LIB_CLASSES} |
||
126 | ${HEADER_LIST} |
||
127 | ) |
||
128 | |||
129 | SET(INSTALL_HEADER_LIST |
||
130 | include/RobotController.h |
||
131 | include/RobotGaze.h |
||
132 | 462c8a3c | sschulz | include/RobotTimestamp.h |
133 | 0c286af0 | Simon Schulz | include/RobotMouth.h |
134 | include/RobotEmotion.h |
||
135 | include/RobotHeadAnimation.h |
||
136 | ) |
||
137 | |||
138 | SET_TARGET_PROPERTIES(${HLRC_CLIENT_LIBNAME} PROPERTIES VERSION ${HLRC_CLIENT_VERSION} SOVERSION ${HLRC_CLIENT_SOVERSION}) |
||
139 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) |
||
140 | LINK_DIRECTORIES(${LIBDIR}) |
||
141 | IF (ROS_FOUND) |
||
142 | 02461ac8 | Robert Haschke | add_dependencies(${HLRC_CLIENT_LIBNAME} ${catkin_EXPORTED_TARGETS}) |
143 | 0c286af0 | Simon Schulz | ENDIF (ROS_FOUND) |
144 | |||
145 | target_link_libraries(${HLRC_CLIENT_LIBNAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${catkin_LIBRARIES}) |
||
146 | |||
147 | #build & install demo |
||
148 | #ADD_EXECUTABLE(testMarkerTracker example/testMarkerTracker.cc) |
||
149 | #TARGET_LINK_LIBRARIES(testMarkerTracker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) |
||
150 | #install(TARGETS testMarkerTracker DESTINATION bin) |
||
151 | #build test |
||
152 | #ADD_EXECUTABLE(testKalmanMarker src/KalmanMarker.cc) |
||
153 | #TARGET_LINK_LIBRARIES(testKalmanMarker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) |
||
154 | |||
155 | install (TARGETS ${HLRC_CLIENT_LIBNAME} DESTINATION lib ) |
||
156 | INSTALL(FILES ${INSTALL_HEADER_LIST} DESTINATION ${INCLUDEDIR}) |
||
157 | |||
158 | set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) |
||
159 | set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) |
||
160 | |||
161 | #create package config file |
||
162 | SET(PKGCONFIG_FILENAME "hlrc_client.pc") |
||
163 | configure_file("${PKGCONFIG_FILENAME}.in" "${PKGCONFIG_FILENAME}" @ONLY) |
||
164 | INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILENAME}" DESTINATION "${PKGDIR}") |
||
165 | |||
166 | #create cmake config files |
||
167 | SET(CMAKECONFIG_FILENAME "hlrc_clientConfig.cmake") |
||
168 | configure_file("${CMAKECONFIG_FILENAME}.in" "${CMAKECONFIG_FILENAME}" @ONLY) |
||
169 | INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIG_FILENAME}" DESTINATION "${DATADIR}") |
||
170 | |||
171 | SET(CMAKECONFIGVERSION_FILENAME "hlrc_clientConfigVersion.cmake") |
||
172 | configure_file("${CMAKECONFIGVERSION_FILENAME}.in" "${CMAKECONFIGVERSION_FILENAME}" @ONLY) |
||
173 | INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIGVERSION_FILENAME}" DESTINATION "${DATADIR}") |
||
174 | |||
175 | #ADD_EXECUTABLE(${PROJECT_NAME} main.cpp ${SRC_FILES}) |
||
176 | 462c8a3c | sschulz | #TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} ${BART_LIBRARIES} ) |
177 | 0c286af0 | Simon Schulz | |
178 | #build & install examples |
||
179 | ADD_EXECUTABLE(${PROJECT_NAME}_example_random_gaze examples/random_gaze/main.cpp) |
||
180 | TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_random_gaze ${HLRC_CLIENT_LIBNAME}) |
||
181 | #install(TARGETS ${PROJECT_NAME}_calibrate_camera DESTINATION bin) |
||
182 | ADD_EXECUTABLE(${PROJECT_NAME}_example_speech_test examples/speech_test/main.cpp) |
||
183 | TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_speech_test ${HLRC_CLIENT_LIBNAME}) |