hlrc / client / cpp / CMakeLists.txt @ 295a3f16
History | View | Annotate | Download (5.19 KB)
1 |
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 |
|
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 |
FIND_PACKAGE(hlrc_server) |
33 |
|
34 |
################################################################ |
35 |
# check for ROS support: |
36 |
find_package(catkin QUIET) |
37 |
IF(catkin_FOUND) |
38 |
SET(ROS_FOUND 1) |
39 |
|
40 |
catkin_package( |
41 |
INCLUDE_DIRS include |
42 |
LIBRARIES ${HLRC_CLIENT_LIBNAME} |
43 |
) |
44 |
|
45 |
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg hlrc_server humotion tf2_eigen actionlib) |
46 |
|
47 |
message(STATUS "ROS Support is ON") |
48 |
add_definitions(-DROS_SUPPORT=1) |
49 |
include_directories(${catkin_INCLUDE_DIRS}) |
50 |
ELSE(catkin_FOUND) |
51 |
message(STATUS "ROS not found.") |
52 |
ENDIF(catkin_FOUND) |
53 |
|
54 |
add_definitions ("-Wall") |
55 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fstack-protector-all ") |
56 |
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" ) |
57 |
|
58 |
#search for Boost |
59 |
find_package( Boost 1.46 REQUIRED COMPONENTS program_options filesystem regex) |
60 |
LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) |
61 |
include_directories(${Boost_INCLUDE_DIRS} ) |
62 |
message(STATUS "using ${Boost_LIBRARIES}") |
63 |
|
64 |
INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include) |
65 |
|
66 |
# SET(PREFIX ${CMAKE_INSTALL_PREFIX}) |
67 |
# SET(BINDIR "${PREFIX}/bin") |
68 |
# SET(INCLUDEDIR "${PREFIX}/include") |
69 |
# SET(MANDIR "${PREFIX}/man") |
70 |
# SET(LIBDIR "${PREFIX}/lib") |
71 |
# SET(DATADIR "${PREFIX}/share/${NAME}") |
72 |
|
73 |
#this dummy list will make all header files appear if you use qtcreator to open the cmake project |
74 |
file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h ) |
75 |
|
76 |
SET(LIB_CLASSES |
77 |
src/RobotController.cpp |
78 |
src/Middleware.cpp |
79 |
src/MiddlewareROS.cpp |
80 |
) |
81 |
|
82 |
add_library(${HLRC_CLIENT_LIBNAME} SHARED |
83 |
${LIB_CLASSES} |
84 |
${HEADER_LIST} |
85 |
) |
86 |
|
87 |
SET(INSTALL_HEADER_LIST |
88 |
include/RobotController.h |
89 |
include/RobotGaze.h |
90 |
include/RobotTimestamp.h |
91 |
include/RobotMouth.h |
92 |
include/RobotEmotion.h |
93 |
include/RobotHeadAnimation.h |
94 |
) |
95 |
|
96 |
SET_TARGET_PROPERTIES(${HLRC_CLIENT_LIBNAME} PROPERTIES VERSION ${HLRC_CLIENT_VERSION} SOVERSION ${HLRC_CLIENT_SOVERSION}) |
97 |
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) |
98 |
LINK_DIRECTORIES(${LIBDIR}) |
99 |
IF (ROS_FOUND) |
100 |
add_dependencies(${HLRC_CLIENT_LIBNAME} ${catkin_EXPORTED_TARGETS}) |
101 |
ENDIF (ROS_FOUND) |
102 |
|
103 |
target_link_libraries(${HLRC_CLIENT_LIBNAME} ${catkin_LIBRARIES}) |
104 |
|
105 |
#build & install demo |
106 |
#ADD_EXECUTABLE(testMarkerTracker example/testMarkerTracker.cc) |
107 |
#TARGET_LINK_LIBRARIES(testMarkerTracker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) |
108 |
#install(TARGETS testMarkerTracker DESTINATION bin) |
109 |
#build test |
110 |
#ADD_EXECUTABLE(testKalmanMarker src/KalmanMarker.cc) |
111 |
#TARGET_LINK_LIBRARIES(testKalmanMarker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) |
112 |
|
113 |
install (TARGETS ${HLRC_CLIENT_LIBNAME} DESTINATION lib ) |
114 |
INSTALL(FILES ${INSTALL_HEADER_LIST} DESTINATION ${INCLUDEDIR}) |
115 |
|
116 |
set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) |
117 |
set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) |
118 |
|
119 |
#create package config file |
120 |
SET(PKGCONFIG_FILENAME "hlrc_client.pc") |
121 |
configure_file("${PKGCONFIG_FILENAME}.in" "${PKGCONFIG_FILENAME}" @ONLY) |
122 |
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILENAME}" DESTINATION "${PKGDIR}") |
123 |
|
124 |
#create cmake config files |
125 |
SET(CMAKECONFIG_FILENAME "hlrc_clientConfig.cmake") |
126 |
configure_file("${CMAKECONFIG_FILENAME}.in" "${CMAKECONFIG_FILENAME}" @ONLY) |
127 |
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIG_FILENAME}" DESTINATION "${DATADIR}") |
128 |
|
129 |
SET(CMAKECONFIGVERSION_FILENAME "hlrc_clientConfigVersion.cmake") |
130 |
configure_file("${CMAKECONFIGVERSION_FILENAME}.in" "${CMAKECONFIGVERSION_FILENAME}" @ONLY) |
131 |
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIGVERSION_FILENAME}" DESTINATION "${DATADIR}") |
132 |
|
133 |
#ADD_EXECUTABLE(${PROJECT_NAME} main.cpp ${SRC_FILES}) |
134 |
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} ${BART_LIBRARIES} ) |
135 |
|
136 |
#build & install examples |
137 |
ADD_EXECUTABLE(${PROJECT_NAME}_example_random_gaze examples/random_gaze/main.cpp) |
138 |
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_random_gaze ${HLRC_CLIENT_LIBNAME}) |
139 |
#install(TARGETS ${PROJECT_NAME}_calibrate_camera DESTINATION bin) |
140 |
ADD_EXECUTABLE(${PROJECT_NAME}_example_speech_test examples/speech_test/main.cpp) |
141 |
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_speech_test ${HLRC_CLIENT_LIBNAME}) |