hlrc / client / cpp / CMakeLists.txt @ 246c4439
History | View | Annotate | Download (6.311 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 | 462c8a3c | sschulz | |
77 | 0c286af0 | Simon Schulz | message(STATUS "ROS Support is ON") |
78 | add_definitions(-DROS_SUPPORT=1) |
||
79 | 02461ac8 | Robert Haschke | include_directories(${catkin_INCLUDE_DIRS}) |
80 | 0c286af0 | Simon Schulz | ENDIF (catkin_FOUND) |
81 | |||
82 | add_definitions ("-Wall") |
||
83 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fstack-protector-all ") |
||
84 | set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" ) |
||
85 | |||
86 | 462c8a3c | sschulz | #search for Boost |
87 | 0c286af0 | Simon Schulz | find_package( Boost 1.46 REQUIRED COMPONENTS thread program_options system filesystem regex) |
88 | LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) |
||
89 | include_directories(${Boost_INCLUDE_DIRS} ) |
||
90 | message("-- using ${Boost_LIBRARIES}") |
||
91 | |||
92 | ef67692b | Simon Schulz | INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include) |
93 | 0c286af0 | Simon Schulz | |
94 | # SET(PREFIX ${CMAKE_INSTALL_PREFIX}) |
||
95 | # SET(BINDIR "${PREFIX}/bin") |
||
96 | # SET(INCLUDEDIR "${PREFIX}/include") |
||
97 | # SET(MANDIR "${PREFIX}/man") |
||
98 | # SET(LIBDIR "${PREFIX}/lib") |
||
99 | # SET(DATADIR "${PREFIX}/share/${NAME}") |
||
100 | |||
101 | #this dummy list will make all header files appear if you use qtcreator to open the cmake project |
||
102 | file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h ) |
||
103 | |||
104 | SET(LIB_CLASSES |
||
105 | src/RobotController.cpp |
||
106 | src/Middleware.cpp |
||
107 | src/MiddlewareROS.cpp |
||
108 | src/MiddlewareRSB.cpp |
||
109 | ) |
||
110 | |||
111 | add_library(${HLRC_CLIENT_LIBNAME} SHARED |
||
112 | ${LIB_CLASSES} |
||
113 | ${HEADER_LIST} |
||
114 | ) |
||
115 | |||
116 | SET(INSTALL_HEADER_LIST |
||
117 | include/RobotController.h |
||
118 | include/RobotGaze.h |
||
119 | 462c8a3c | sschulz | include/RobotTimestamp.h |
120 | 0c286af0 | Simon Schulz | include/RobotMouth.h |
121 | include/RobotEmotion.h |
||
122 | include/RobotHeadAnimation.h |
||
123 | ) |
||
124 | |||
125 | SET_TARGET_PROPERTIES(${HLRC_CLIENT_LIBNAME} PROPERTIES VERSION ${HLRC_CLIENT_VERSION} SOVERSION ${HLRC_CLIENT_SOVERSION}) |
||
126 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) |
||
127 | LINK_DIRECTORIES(${LIBDIR}) |
||
128 | IF (ROS_FOUND) |
||
129 | 02461ac8 | Robert Haschke | add_dependencies(${HLRC_CLIENT_LIBNAME} ${catkin_EXPORTED_TARGETS}) |
130 | 0c286af0 | Simon Schulz | ENDIF (ROS_FOUND) |
131 | |||
132 | target_link_libraries(${HLRC_CLIENT_LIBNAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${catkin_LIBRARIES}) |
||
133 | |||
134 | #build & install demo |
||
135 | #ADD_EXECUTABLE(testMarkerTracker example/testMarkerTracker.cc) |
||
136 | #TARGET_LINK_LIBRARIES(testMarkerTracker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) |
||
137 | #install(TARGETS testMarkerTracker DESTINATION bin) |
||
138 | #build test |
||
139 | #ADD_EXECUTABLE(testKalmanMarker src/KalmanMarker.cc) |
||
140 | #TARGET_LINK_LIBRARIES(testKalmanMarker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) |
||
141 | |||
142 | install (TARGETS ${HLRC_CLIENT_LIBNAME} DESTINATION lib ) |
||
143 | INSTALL(FILES ${INSTALL_HEADER_LIST} DESTINATION ${INCLUDEDIR}) |
||
144 | |||
145 | set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) |
||
146 | set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) |
||
147 | |||
148 | #create package config file |
||
149 | SET(PKGCONFIG_FILENAME "hlrc_client.pc") |
||
150 | configure_file("${PKGCONFIG_FILENAME}.in" "${PKGCONFIG_FILENAME}" @ONLY) |
||
151 | INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILENAME}" DESTINATION "${PKGDIR}") |
||
152 | |||
153 | #create cmake config files |
||
154 | SET(CMAKECONFIG_FILENAME "hlrc_clientConfig.cmake") |
||
155 | configure_file("${CMAKECONFIG_FILENAME}.in" "${CMAKECONFIG_FILENAME}" @ONLY) |
||
156 | INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIG_FILENAME}" DESTINATION "${DATADIR}") |
||
157 | |||
158 | SET(CMAKECONFIGVERSION_FILENAME "hlrc_clientConfigVersion.cmake") |
||
159 | configure_file("${CMAKECONFIGVERSION_FILENAME}.in" "${CMAKECONFIGVERSION_FILENAME}" @ONLY) |
||
160 | INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIGVERSION_FILENAME}" DESTINATION "${DATADIR}") |
||
161 | |||
162 | #ADD_EXECUTABLE(${PROJECT_NAME} main.cpp ${SRC_FILES}) |
||
163 | 462c8a3c | sschulz | #TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} ${BART_LIBRARIES} ) |
164 | 0c286af0 | Simon Schulz | |
165 | #build & install examples |
||
166 | ADD_EXECUTABLE(${PROJECT_NAME}_example_random_gaze examples/random_gaze/main.cpp) |
||
167 | TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_random_gaze ${HLRC_CLIENT_LIBNAME}) |
||
168 | #install(TARGETS ${PROJECT_NAME}_calibrate_camera DESTINATION bin) |
||
169 | ADD_EXECUTABLE(${PROJECT_NAME}_example_speech_test examples/speech_test/main.cpp) |
||
170 | TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_speech_test ${HLRC_CLIENT_LIBNAME}) |
||
171 |