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