Statistics
| Branch: | Tag: | Revision:

hlrc / client / cpp / CMakeLists.txt @ eb08b7c8

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