Statistics
| Branch: | Tag: | Revision:

hlrc / client / cpp / CMakeLists.txt @ e95c8376

History | View | Annotate | Download (5.19 KB)

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