SET( PROJECT_NAME hlrc_client_cpp ) PROJECT( ${PROJECT_NAME} ) #debug? set(CMAKE_BUILD_TYPE Debug) CMAKE_MINIMUM_REQUIRED(VERSION 2.8) INCLUDE(FindPkgConfig) SET(HLRC_CLIENT_LIBNAME "${PROJECT_NAME}") SET(HLRC_CLIENT_VERSION_MAJOR "0") SET(HLRC_CLIENT_VERSION_MINOR "1") SET(HLRC_CLIENT_VERSION_REVISION "0") SET(HLRC_CLIENT_VERSION "${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}.${HLRC_CLIENT_VERSION_REVISION}") SET(HLRC_CLIENT_SOVERSION "${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}") SET(HLRC_CLIENT_PACKAGE "${HLRC_CLIENT_LIBNAME}-${HLRC_CLIENT_VERSION_MAJOR}.${HLRC_CLIENT_VERSION_MINOR}") SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(BINDIR "${PREFIX}/bin") SET(INCLUDEDIR "${PREFIX}/include/hlrc_client") SET(MANDIR "${PREFIX}/man") SET(LIBDIR "${PREFIX}/lib") SET(PKGDIR "${PREFIX}/lib/pkgconfig") SET(DATADIR "${PREFIX}/share/hlrc_client") ####################################### ####################################### #allow forced disable of RSB option(IGNORE_RSB "IGNORE_RSB" OFF) ####################################### # check if we have RSB support: IF (IGNORE_RSB) MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB") ELSE (IGNORE_RSB) FIND_PACKAGE(RSB 0.11) IF (RSB_FOUND) #RSB SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/") FIND_PACKAGE(RSC 0.11 REQUIRED) FIND_PACKAGE(RSB 0.11 REQUIRED) #RST FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox) INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS}) ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS}) INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH}) #RSB SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/") FIND_PACKAGE(RSC 0.11 REQUIRED) FIND_PACKAGE(RSB 0.11 REQUIRED) #RST FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox) INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS}) ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS}) INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH}) message(STATUS "RSB Support is ON") add_definitions(-DRSB_SUPPORT=1) ENDIF (RSB_FOUND) ENDIF(IGNORE_RSB) ################################################################ # check for ROS support: find_package(catkin) IF (catkin_FOUND) SET(ROS_FOUND 1) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg actionlib) catkin_package( INCLUDE_DIRS include ) message(STATUS "ROS Support is ON") add_definitions(-DROS_SUPPORT=1) include_directories(${catkin_INCLUDE_DIRS}) ENDIF (catkin_FOUND) add_definitions ("-Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fstack-protector-all ") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" ) #search for Boost find_package( Boost 1.46 REQUIRED COMPONENTS thread program_options system filesystem regex) LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) include_directories(${Boost_INCLUDE_DIRS} ) message("-- using ${Boost_LIBRARIES}") INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include) # SET(PREFIX ${CMAKE_INSTALL_PREFIX}) # SET(BINDIR "${PREFIX}/bin") # SET(INCLUDEDIR "${PREFIX}/include") # SET(MANDIR "${PREFIX}/man") # SET(LIBDIR "${PREFIX}/lib") # SET(DATADIR "${PREFIX}/share/${NAME}") #this dummy list will make all header files appear if you use qtcreator to open the cmake project file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h ) SET(LIB_CLASSES src/RobotController.cpp src/Middleware.cpp src/MiddlewareROS.cpp src/MiddlewareRSB.cpp ) add_library(${HLRC_CLIENT_LIBNAME} SHARED ${LIB_CLASSES} ${HEADER_LIST} ) SET(INSTALL_HEADER_LIST include/RobotController.h include/RobotGaze.h include/RobotTimestamp.h include/RobotMouth.h include/RobotEmotion.h include/RobotHeadAnimation.h ) SET_TARGET_PROPERTIES(${HLRC_CLIENT_LIBNAME} PROPERTIES VERSION ${HLRC_CLIENT_VERSION} SOVERSION ${HLRC_CLIENT_SOVERSION}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) LINK_DIRECTORIES(${LIBDIR}) IF (ROS_FOUND) add_dependencies(${HLRC_CLIENT_LIBNAME} ${catkin_EXPORTED_TARGETS}) ENDIF (ROS_FOUND) target_link_libraries(${HLRC_CLIENT_LIBNAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${catkin_LIBRARIES}) #build & install demo #ADD_EXECUTABLE(testMarkerTracker example/testMarkerTracker.cc) #TARGET_LINK_LIBRARIES(testMarkerTracker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) #install(TARGETS testMarkerTracker DESTINATION bin) #build test #ADD_EXECUTABLE(testKalmanMarker src/KalmanMarker.cc) #TARGET_LINK_LIBRARIES(testKalmanMarker ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} bart) install (TARGETS ${HLRC_CLIENT_LIBNAME} DESTINATION lib ) INSTALL(FILES ${INSTALL_HEADER_LIST} DESTINATION ${INCLUDEDIR}) set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) set_target_properties(${HLRC_CLIENT_LIBNAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) #create package config file SET(PKGCONFIG_FILENAME "hlrc_client.pc") configure_file("${PKGCONFIG_FILENAME}.in" "${PKGCONFIG_FILENAME}" @ONLY) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILENAME}" DESTINATION "${PKGDIR}") #create cmake config files SET(CMAKECONFIG_FILENAME "hlrc_clientConfig.cmake") configure_file("${CMAKECONFIG_FILENAME}.in" "${CMAKECONFIG_FILENAME}" @ONLY) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIG_FILENAME}" DESTINATION "${DATADIR}") SET(CMAKECONFIGVERSION_FILENAME "hlrc_clientConfigVersion.cmake") configure_file("${CMAKECONFIGVERSION_FILENAME}.in" "${CMAKECONFIGVERSION_FILENAME}" @ONLY) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKECONFIGVERSION_FILENAME}" DESTINATION "${DATADIR}") #ADD_EXECUTABLE(${PROJECT_NAME} main.cpp ${SRC_FILES}) #TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${RSB_LIBRARIES} ${RST_LIBRARIES} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${Boost_LIBS} ${BART_LIBRARIES} ) #build & install examples ADD_EXECUTABLE(${PROJECT_NAME}_example_random_gaze examples/random_gaze/main.cpp) TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_random_gaze ${HLRC_CLIENT_LIBNAME}) #install(TARGETS ${PROJECT_NAME}_calibrate_camera DESTINATION bin) ADD_EXECUTABLE(${PROJECT_NAME}_example_speech_test examples/speech_test/main.cpp) TARGET_LINK_LIBRARIES(${PROJECT_NAME}_example_speech_test ${HLRC_CLIENT_LIBNAME})