PROJECT(hlrc_client_cpp) if(NOT "${CMAKE_CXX_STANDARD}") set(CMAKE_CXX_STANDARD 11) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) #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") ####################################### FIND_PACKAGE(hlrc_server) ################################################################ # check for ROS support: find_package(catkin QUIET) IF(catkin_FOUND) SET(ROS_FOUND 1) catkin_package( INCLUDE_DIRS include LIBRARIES ${HLRC_CLIENT_LIBNAME} ) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg hlrc_server humotion tf2_eigen actionlib) message(STATUS "ROS Support is ON") add_definitions(-DROS_SUPPORT=1) include_directories(${catkin_INCLUDE_DIRS}) ELSE(catkin_FOUND) message(STATUS "ROS not found.") 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 program_options filesystem regex) LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) include_directories(${Boost_INCLUDE_DIRS} ) message(STATUS "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 ) 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} ${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} ${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})