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