cmake_minimum_required(VERSION 2.8.3) project(humotion) set(ENV{ROS_LANG_DISABLE} "genjava") set(ROS_BUILD_TYPE Debug) ####################################### # check if we have RSB support: 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) ################################################################ # check for ROS support: find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg) IF (catkin_FOUND) set(ROS_FOUND 1) message(STATUS "ROS Support is ON") add_definitions(-DROS_SUPPORT=1) ENDIF (catkin_FOUND) INCLUDE(FindPkgConfig) ##libreflexxes IF (libreflexxes_DIR) MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')") SET(REFLEXXES_PREFIX ${libreflexxes_DIR}) ELSE () PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3) IF (NOT REFLEXXES_FOUND) message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII") ENDIF () ENDIF() IF (NOT catkin_FOUND AND NOT RSB_FOUND) message(FATAL_ERROR "Error: could neither find RSB or ROS middleware!") ENDIF () SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib") SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include") MESSAGE("using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}") set(CMAKE_CXX_FLAGS "-g -Wall") add_definitions ("-Wall") IF (catkin_FOUND) ####################################### ## Declare ROS messages and services ## ####################################### add_message_files( FILES gaze.msg position_lcr.msg mouth.msg ) ## Generate added messages and services with any dependencies listed here generate_messages( DEPENDENCIES std_msgs humotion ) # ################################### ## catkin specific configuration ## ################################### ## The catkin_package macro generates cmake config files for your package ## Declare things to be passed to dependent projects ## INCLUDE_DIRS: uncomment this if you package contains header files ## LIBRARIES: libraries you create in this project that dependent projects also need ## CATKIN_DEPENDS: catkin_packages dependent projects also need ## DEPENDS: system dependencies of this project that dependent projects also need catkin_package( INCLUDE_DIRS include LIBRARIES humotion #CATKIN_DEPENDS message_runtime #DEPENDS system_lib ) ENDIF (catkin_FOUND) ########### ## Build ## ########### ## Specify additional locations of header files ## Your package locations should be listed before other locations include_directories (BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS}) include_directories(include/humotion) include_directories( ${catkin_INCLUDE_DIRS}) link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS}) ##################### # PLEASE DO NOT REMOVE THIS! This is a hack necessary for qtcreator to show cmake header files in the project view! file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/humotion/*.h include/humotion/client/*.h include/humotion/server/*.h srv/*.srv msg/*.msg etc/*) ## Declare a cpp library add_library(humotion src/mouth_state.cpp src/gaze_state.cpp src/client/client.cpp src/client/middleware.cpp src/client/middleware_ros.cpp src/client/middleware_rsb.cpp src/server/server.cpp src/server/middleware.cpp src/server/middleware_ros.cpp src/server/middleware_rsb.cpp src/server/controller.cpp src/server/joint_interface.cpp src/server/motion_generator.cpp src/server/gaze_motion_generator.cpp src/server/reflexxes_motion_generator.cpp src/server/mouth_motion_generator.cpp src/server/eye_motion_generator.cpp src/server/eyelid_motion_generator.cpp src/server/eyebrow_motion_generator.cpp src/server/neck_motion_generator.cpp ${DUMMY_HEADER_LIST} src/timestamped_list.cpp ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") ## Add cmake target dependencies of the executable/library ## as an example, message headers may need to be generated before nodes add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp) ## Specify libraries to link a library or executable target against target_link_libraries(humotion ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${REFLEXXES_LIBRARIES} ${RST_LIBRARIES} ${RSB_LIBRARIES} ) set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) ############# ## Install ## ############# # all install targets should use catkin DESTINATION variables # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html ## Mark executable scripts (Python etc.) for installation ## in contrast to setup.py, you can choose the destination # install(PROGRAMS # scripts/my_python_script # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} # ) ## Mark executables and/or libraries for installation IF (catkin_FOUND) install(TARGETS humotion ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) ## Mark cpp header files for installation install(DIRECTORY include/humotion/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} ) ENDIF (catkin_FOUND) ############# ## Testing ## ############# IF (catkin_FOUND) ## Add gtest based cpp test target and link libraries catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp) if(TARGET ${PROJECT_NAME}-test-server) target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME}) endif() catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp) if(TARGET ${PROJECT_NAME}-test-client) target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME}) endif() ENDIF (catkin_FOUND) ### Add folders to be run by python nosetests # catkin_add_nosetests(test)