Statistics
| Branch: | Tag: | Revision:

hlrc / client / cpp / CMakeLists.txt @ master

History | View | Annotate | Download (5.047 KB)

1 fc4357ee Robert Haschke
PROJECT(hlrc_client_cpp)
2
3 0c286af0 Simon Schulz
#debug?
4
set(CMAKE_BUILD_TYPE Debug)
5
6
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
7
INCLUDE(FindPkgConfig)
8
9
SET(HLRC_CLIENT_LIBNAME "${PROJECT_NAME}")
10
SET(HLRC_CLIENT_VERSION_MAJOR    "0")
11
SET(HLRC_CLIENT_VERSION_MINOR    "1")
12
SET(HLRC_CLIENT_VERSION_REVISION "0")
13
SET(HLRC_CLIENT_VERSION   "${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}.${HLRC_CLIENT_VERSION_REVISION}")
14
SET(HLRC_CLIENT_SOVERSION "${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}")
15
SET(HLRC_CLIENT_PACKAGE   "${HLRC_CLIENT_LIBNAME}-${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}")
16
17
SET(PREFIX      ${CMAKE_INSTALL_PREFIX})
18
SET(BINDIR     "${PREFIX}/bin")
19
SET(INCLUDEDIR "${PREFIX}/include/hlrc_client")
20
SET(MANDIR     "${PREFIX}/man")
21
SET(LIBDIR     "${PREFIX}/lib")
22
SET(PKGDIR     "${PREFIX}/lib/pkgconfig")
23
SET(DATADIR    "${PREFIX}/share/hlrc_client")
24
25
#######################################
26 3c77f276 Robert Haschke
FIND_PACKAGE(hlrc_server)
27
28 0c286af0 Simon Schulz
################################################################
29
# check for ROS support:
30 23fe067c Robert Haschke
find_package(catkin QUIET)
31
IF(catkin_FOUND)
32 0c286af0 Simon Schulz
    SET(ROS_FOUND 1)
33
34
    catkin_package(
35
        INCLUDE_DIRS include
36 96284eda Fabian Berthold
        LIBRARIES ${HLRC_CLIENT_LIBNAME}
37 0c286af0 Simon Schulz
    )
38 462c8a3c sschulz
39 96284eda Fabian Berthold
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg hlrc_server humotion tf2_eigen actionlib)
40
41 0c286af0 Simon Schulz
    message(STATUS "ROS Support is ON")
42
    add_definitions(-DROS_SUPPORT=1)
43 02461ac8 Robert Haschke
    include_directories(${catkin_INCLUDE_DIRS})
44 23fe067c Robert Haschke
ELSE(catkin_FOUND)
45
    message(STATUS "ROS not found.")
46
ENDIF(catkin_FOUND)
47 0c286af0 Simon Schulz
48
add_definitions ("-Wall")
49 8a80c432 Robert Haschke
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all ")
50 0c286af0 Simon Schulz
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" )
51
52 462c8a3c sschulz
#search for Boost
53 fc4357ee Robert Haschke
find_package( Boost 1.46 REQUIRED COMPONENTS program_options filesystem regex)
54 0c286af0 Simon Schulz
LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS}  )
55
include_directories(${Boost_INCLUDE_DIRS} )
56 23fe067c Robert Haschke
message(STATUS "using ${Boost_LIBRARIES}")
57 0c286af0 Simon Schulz
58 ef67692b Simon Schulz
INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
59 0c286af0 Simon Schulz
60
# SET(PREFIX ${CMAKE_INSTALL_PREFIX})
61
# SET(BINDIR "${PREFIX}/bin")
62
# SET(INCLUDEDIR "${PREFIX}/include")
63
# SET(MANDIR "${PREFIX}/man")
64
# SET(LIBDIR "${PREFIX}/lib")
65
# SET(DATADIR "${PREFIX}/share/${NAME}")
66
67
#this dummy list will make all header files appear if you use qtcreator to open the cmake project
68
file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h  )
69
70
SET(LIB_CLASSES
71
    src/RobotController.cpp
72
    src/Middleware.cpp
73
    src/MiddlewareROS.cpp
74
)
75
76
add_library(${HLRC_CLIENT_LIBNAME} SHARED
77
    ${LIB_CLASSES}
78
    ${HEADER_LIST}
79
)
80
81
SET(INSTALL_HEADER_LIST
82
    include/RobotController.h
83
    include/RobotGaze.h
84 462c8a3c sschulz
    include/RobotTimestamp.h
85 0c286af0 Simon Schulz
    include/RobotMouth.h
86
    include/RobotEmotion.h
87
    include/RobotHeadAnimation.h
88
)
89
90
SET_TARGET_PROPERTIES(${HLRC_CLIENT_LIBNAME} PROPERTIES VERSION ${HLRC_CLIENT_VERSION} SOVERSION ${HLRC_CLIENT_SOVERSION})
91
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
92
LINK_DIRECTORIES(${LIBDIR})
93
IF (ROS_FOUND)
94 02461ac8 Robert Haschke
    add_dependencies(${HLRC_CLIENT_LIBNAME} ${catkin_EXPORTED_TARGETS})
95 0c286af0 Simon Schulz
ENDIF (ROS_FOUND)
96
97 d81c4f8b Matthias Barth
target_link_libraries(${HLRC_CLIENT_LIBNAME} ${catkin_LIBRARIES})
98 0c286af0 Simon Schulz
99
#build & install demo
100
#ADD_EXECUTABLE(testMarkerTracker example/testMarkerTracker.cc)
101
#TARGET_LINK_LIBRARIES(testMarkerTracker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart)
102
#install(TARGETS testMarkerTracker DESTINATION bin)
103
#build test
104
#ADD_EXECUTABLE(testKalmanMarker src/KalmanMarker.cc)
105
#TARGET_LINK_LIBRARIES(testKalmanMarker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart)
106
107
install (TARGETS ${HLRC_CLIENT_LIBNAME} DESTINATION lib )
108
INSTALL(FILES ${INSTALL_HEADER_LIST} DESTINATION ${INCLUDEDIR})
109
110
set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
111
set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
112
113
#create package config file
114
SET(PKGCONFIG_FILENAME "hlrc_client.pc")
115
configure_file("${PKGCONFIG_FILENAME}.in" "${PKGCONFIG_FILENAME}" @ONLY)
116
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILENAME}" DESTINATION "${PKGDIR}")
117
118
#create cmake config files
119
SET(CMAKECONFIG_FILENAME "hlrc_clientConfig.cmake")
120
configure_file("${CMAKECONFIG_FILENAME}.in" "${CMAKECONFIG_FILENAME}" @ONLY)
121
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIG_FILENAME}" DESTINATION "${DATADIR}")
122
123
SET(CMAKECONFIGVERSION_FILENAME "hlrc_clientConfigVersion.cmake")
124
configure_file("${CMAKECONFIGVERSION_FILENAME}.in" "${CMAKECONFIGVERSION_FILENAME}" @ONLY)
125
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIGVERSION_FILENAME}" DESTINATION "${DATADIR}")
126
127
#ADD_EXECUTABLE(${PROJECT_NAME} main.cpp ${SRC_FILES})
128 d81c4f8b Matthias Barth
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} ${BART_LIBRARIES} )
129 0c286af0 Simon Schulz
130
#build & install examples
131
ADD_EXECUTABLE(${PROJECT_NAME}_example_random_gaze examples/random_gaze/main.cpp)
132
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_random_gaze ${HLRC_CLIENT_LIBNAME})
133
#install(TARGETS ${PROJECT_NAME}_calibrate_camera DESTINATION bin)
134
ADD_EXECUTABLE(${PROJECT_NAME}_example_speech_test examples/speech_test/main.cpp)
135
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_speech_test ${HLRC_CLIENT_LIBNAME})