Statistics
| Branch: | Tag: | Revision:

hlrc / client / cpp / CMakeLists.txt @ 0ca8388c

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