Commit 0b86a9f8 authored by Olivier Stasse's avatar Olivier Stasse

[cmake] Export cmake

Fix add_project_dependency
Add catkin search.
parent 2af04da0
......@@ -49,12 +49,13 @@ SET(PKG_CONFIG_ADDITIONAL_VARIABLES
ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.0.0")
ADD_PROJECT_DEPENDENCY(dynamic-graph 3.0.0 REQUIRED)
ADD_REQUIRED_DEPENDENCY("sot-core >= 4.0.0")
ADD_REQUIRED_DEPENDENCY("sot-dynamic-pinocchio >= 3.1")
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python >= 3.0.0")
ADD_PROJECT_DEPENDENCY(sot-core REQUIRED)
ADD_PROJECT_DEPENDENCY(sot-dynamic-pinocchio REQUIRED)
ADD_PROJECT_DEPENDENCY(dynamic-graph-python REQUIRED)
ADD_REQUIRED_DEPENDENCY("dynamic_graph_bridge_msgs")
ADD_REQUIRED_DEPENDENCY("dynamic_graph_bridge >= 3.0")
ADD_PROJECT_DEPENDENCY(dynamic_graph_bridge_msgs REQUIRED)
ADD_PROJECT_DEPENDENCY(dynamic_graph_bridge REQUIRED)
ADD_PROJECT_DEPENDENCY(roscpp REQUIRED)
ADD_OPTIONAL_DEPENDENCY("talos_data")
ADD_OPTIONAL_DEPENDENCY("pyrene-motions")
......@@ -70,6 +71,16 @@ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# catkin part
SET(CATKIN_REQUIRED_COMPONENTS
roscpp std_msgs dynamic_graph_bridge_msgs dynamic_graph_bridge)
SET(CATKIN_DEPENDS_LIBRARIES ros_bridge sot_loader)
find_package(catkin REQUIRED
COMPONENTS ${CATKIN_REQUIRED_COMPONENTS})
include_directories(${catkin_INCLUDE_DIRS})
# Add subdirectories.
ADD_SUBDIRECTORY(src)
......@@ -119,4 +130,13 @@ IF(TALOS_DATA_FOUND)
ENDIF(TALOS_DATA_FOUND)
SETUP_PROJECT_FINALIZE()
SETUP_PROJECT_PACKAGE_FINALIZE()
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
LOGGING_FINALIZE()
......@@ -26,9 +26,13 @@ FUNCTION(COMPILE_PLUGIN NAME SOURCES ENTITIES)
TARGET_LINK_LIBRARIES(${NAME} dynamic-graph::dynamic-graph)
TARGET_LINK_LIBRARIES(${NAME} sot-core::sot-core)
TARGET_LINK_LIBRARIES(${NAME} eigen3)
TARGET_LINK_LIBRARIES(${NAME} roscpp)
TARGET_LINK_LIBRARIES(${NAME} roscpp)
PKG_CONFIG_USE_DEPENDENCY(${NAME} pinocchio)
INSTALL(TARGETS ${NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/plugin)
INSTALL(TARGETS ${NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/plugin)
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${NAME})
......@@ -67,17 +71,21 @@ MACRO(build_talos_device)
)
# Link the dynamic library containing the SoT with its dependencies.
PKG_PROJECT_DEPENDENCY(${DEVICE_NAME} "dynamic-graph")
PKG_CONFIG_USE_DEPENDENCY(${DEVICE_NAME} "dynamic-graph-python")
PKG_CONFIG_USE_DEPENDENCY(${DEVICE_NAME} "sot-core")
TARGET_LINK_LIBRARIES(${DEVICE_NAME} dynamic-graph::dynamic-graph)
TARGET_LINK_LIBRARIES(${DEVICE_NAME}
dynamic-graph-python::dynamic-graph-python )
TARGET_LINK_LIBRARIES(${DEVICE_NAME} sot-core::sot-core)
PKG_CONFIG_USE_DEPENDENCY(${DEVICE_NAME} "pinocchio")
PKG_CONFIG_USE_DEPENDENCY(${DEVICE_NAME} "dynamic_graph_bridge")
TARGET_LINK_LIBRARIES(${DEVICE_NAME}
dynamic_graph_bridge::ros_bridge)
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${DEVICE_NAME} ${Boost_LIBRARIES})
ENDIF(UNIX AND NOT APPLE)
INSTALL(TARGETS ${DEVICE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
INSTALL(TARGETS ${DEVICE_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
......@@ -102,22 +110,28 @@ MACRO(build_talos_controller)
)
# Link the dynamic library containing the SoT with its dependencies.
PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} "dynamic-graph")
PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} "dynamic-graph-python")
PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} "sot-core")
PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} "dynamic_graph_bridge")
ADD_DEPENDENCIES(${CONTROLLER_NAME} "sot-talos-device")
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} "sot-talos-device")
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} "ros_bridge")
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} "ros_interpreter")
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME}
dynamic-graph::dynamic-graph)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME}
dynamic-graph-python::dynamic-graph-python)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME}
sot-core::sot-core)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME}
dynamic_graph_bridge::ros_bridge)
ADD_DEPENDENCIES(${CONTROLLER_NAME} sot-talos-device)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} sot-talos-device)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME}
dynamic_graph_bridge::ros_interpreter)
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ${Boost_LIBRARIES})
ENDIF(UNIX AND NOT APPLE)
INSTALL(TARGETS ${CONTROLLER_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
INSTALL(TARGETS ${CONTROLLER_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDMACRO()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment