Statistics
| Branch: | Tag: | Revision:

hlrc / client / cpp / CMakeLists.txt @ 9e834f47

History | View | Annotate | Download (6.282 KB)

1
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
#######################################
28
#allow forced disable of RSB
29
option(IGNORE_RSB "IGNORE_RSB" OFF)
30

    
31
#######################################
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
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
ENDIF(IGNORE_RSB)
65

    
66
################################################################
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

    
77
    message(STATUS "ROS Support is ON")
78
    add_definitions(-DROS_SUPPORT=1)
79
ENDIF (catkin_FOUND)
80

    
81
add_definitions ("-Wall")
82
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fstack-protector-all ")
83
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" )
84

    
85
#search for Boost
86
find_package( Boost 1.46 REQUIRED COMPONENTS thread program_options system filesystem regex)
87
LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS}  )
88
include_directories(${Boost_INCLUDE_DIRS} )
89
message("-- using ${Boost_LIBRARIES}")
90

    
91
INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
92

    
93
# SET(PREFIX ${CMAKE_INSTALL_PREFIX})
94
# SET(BINDIR "${PREFIX}/bin")
95
# SET(INCLUDEDIR "${PREFIX}/include")
96
# SET(MANDIR "${PREFIX}/man")
97
# SET(LIBDIR "${PREFIX}/lib")
98
# SET(DATADIR "${PREFIX}/share/${NAME}")
99

    
100
#this dummy list will make all header files appear if you use qtcreator to open the cmake project
101
file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h  )
102

    
103
SET(LIB_CLASSES
104
    src/RobotController.cpp
105
    src/Middleware.cpp
106
    src/MiddlewareROS.cpp
107
    src/MiddlewareRSB.cpp
108
)
109

    
110
add_library(${HLRC_CLIENT_LIBNAME} SHARED
111
    ${LIB_CLASSES}
112
    ${HEADER_LIST}
113
)
114

    
115
SET(INSTALL_HEADER_LIST
116
    include/RobotController.h
117
    include/RobotGaze.h
118
    include/RobotTimestamp.h
119
    include/RobotMouth.h
120
    include/RobotEmotion.h
121
    include/RobotHeadAnimation.h
122
)
123

    
124
SET_TARGET_PROPERTIES(${HLRC_CLIENT_LIBNAME} PROPERTIES VERSION ${HLRC_CLIENT_VERSION} SOVERSION ${HLRC_CLIENT_SOVERSION})
125
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
126
LINK_DIRECTORIES(${LIBDIR})
127
IF (ROS_FOUND)
128
    add_dependencies(${HLRC_CLIENT_LIBNAME} ${catkin_EXPORTED_TARGETS} hlrc_server_gencpp)
129
ENDIF (ROS_FOUND)
130

    
131
target_link_libraries(${HLRC_CLIENT_LIBNAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${catkin_LIBRARIES})
132

    
133
#build & install demo
134
#ADD_EXECUTABLE(testMarkerTracker example/testMarkerTracker.cc)
135
#TARGET_LINK_LIBRARIES(testMarkerTracker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart)
136
#install(TARGETS testMarkerTracker DESTINATION bin)
137
#build test
138
#ADD_EXECUTABLE(testKalmanMarker src/KalmanMarker.cc)
139
#TARGET_LINK_LIBRARIES(testKalmanMarker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart)
140

    
141
install (TARGETS ${HLRC_CLIENT_LIBNAME} DESTINATION lib )
142
INSTALL(FILES ${INSTALL_HEADER_LIST} DESTINATION ${INCLUDEDIR})
143

    
144
set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
145
set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
146

    
147
#create package config file
148
SET(PKGCONFIG_FILENAME "hlrc_client.pc")
149
configure_file("${PKGCONFIG_FILENAME}.in" "${PKGCONFIG_FILENAME}" @ONLY)
150
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILENAME}" DESTINATION "${PKGDIR}")
151

    
152
#create cmake config files
153
SET(CMAKECONFIG_FILENAME "hlrc_clientConfig.cmake")
154
configure_file("${CMAKECONFIG_FILENAME}.in" "${CMAKECONFIG_FILENAME}" @ONLY)
155
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIG_FILENAME}" DESTINATION "${DATADIR}")
156

    
157
SET(CMAKECONFIGVERSION_FILENAME "hlrc_clientConfigVersion.cmake")
158
configure_file("${CMAKECONFIGVERSION_FILENAME}.in" "${CMAKECONFIGVERSION_FILENAME}" @ONLY)
159
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIGVERSION_FILENAME}" DESTINATION "${DATADIR}")
160

    
161
#ADD_EXECUTABLE(${PROJECT_NAME} main.cpp ${SRC_FILES})
162
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} ${BART_LIBRARIES} )
163

    
164
#build & install examples
165
ADD_EXECUTABLE(${PROJECT_NAME}_example_random_gaze examples/random_gaze/main.cpp)
166
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_random_gaze ${HLRC_CLIENT_LIBNAME})
167
#install(TARGETS ${PROJECT_NAME}_calibrate_camera DESTINATION bin)
168
ADD_EXECUTABLE(${PROJECT_NAME}_example_speech_test examples/speech_test/main.cpp)
169
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_speech_test ${HLRC_CLIENT_LIBNAME})
170

    
171