Statistics
| Branch: | Tag: | Revision:

hlrc / client / cpp / CMakeLists.txt @ 2e526a15

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