Commit a866113a authored by Guilhem Saurel's avatar Guilhem Saurel

[CMake] clean: keep minimal required instructions

parent ff47d843
# Copyright 2016, Thomas Moulard, Olivier Stasse, JRL, CNRS/AIST
# Copyright 2016-2020, Thomas Moulard, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
SET(PROJECT_NAMESPACE stack-of-tasks)
# Project properties
SET(PROJECT_ORG stack-of-tasks)
SET(PROJECT_NAME sot-talos)
SET(PROJECT_DESCRIPTION "dynamic-graph package for Talos robot")
SET(PROJECT_URL "http://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/lapack.cmake)
INCLUDE(cmake/ros.cmake)
INCLUDE(cmake/python.cmake)
OPTION(SUFFIX_SO_VERSION
"Suffix shared library name by a string depending on git status of project"
ON)
# Project options
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
# Export CMake Target
# Project configuration
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CUSTOM_HEADER_DIR "sot/talos")
SET(CXX_DISABLE_WERROR TRUE)
INCLUDE(cmake/base.cmake)
# Specify the project.
cmake_policy(SET CMP0048 NEW)
PROJECT(${PROJECT_NAME}
LANGUAGES
CXX
VERSION
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
)
find_package (Boost REQUIRED
python filesystem system thread program_options unit_test_framework)
find_package (Eigen3 REQUIRED NO_MODULE)
INCLUDE(cmake/lapack.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/ros.cmake)
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX C)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
SET(CUSTOM_HEADER_DIR "${PROJECT_NAME}")
SET(CXX_DISABLE_WERROR True)
SET(PKG_CONFIG_ADDITIONAL_VARIABLES
${PKG_CONFIG_ADDITIONAL_VARIABLES}
plugindirname
plugindir
)
CMAKE_POLICY(SET CMP0048 OLD)
PROJECT(${PROJECT_NAME} CXX)
# Search for dependencies.
ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.0.0")
# Project dependencies
SET(BOOST_COMPONENTS filesystem system thread program_options
unit_test_framework python)
SET(CATKIN_REQUIRED_COMPONENTS
roscpp std_msgs dynamic_graph_bridge_msgs dynamic_graph_bridge)
SET(CATKIN_DEPENDS_LIBRARIES ros_bridge sot_loader)
ADD_PROJECT_DEPENDENCY(dynamic-graph 3.0.0 REQUIRED)
ADD_PROJECT_DEPENDENCY(sot-core REQUIRED)
ADD_PROJECT_DEPENDENCY(sot-dynamic-pinocchio REQUIRED)
ADD_PROJECT_DEPENDENCY(dynamic-graph-python REQUIRED)
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")
# Search for dependencies.
# Boost
ADD_PROJECT_DEPENDENCY(talos_data REQUIRED)
ADD_PROJECT_DEPENDENCY(pyrene-motions REQUIRED)
ADD_REQUIRED_DEPENDENCY(dynamic_graph_bridge_msgs)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_PATH})
# Handle rpath necessary to handle ROS multiplace packages
# libraries inclusion
SET(CMAKE_INSTALL_LIBDIR lib)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
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})
SEARCH_FOR_BOOST()
FIND_PACKAGE(catkin REQUIRED COMPONENTS ${CATKIN_REQUIRED_COMPONENTS})
# Add subdirectories.
ADD_SUBDIRECTORY(src)
IF(TALOS_DATA_FOUND)
FOREACH(py_filename kinetalos katana_holding )
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/tests/${py_filename}.py.cmake
${PROJECT_BINARY_DIR}/tests/${py_filename}.py
)
INSTALL(FILES
${PROJECT_BINARY_DIR}/tests/${py_filename}.py
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/tests
)
ENDFOREACH(py_filename)
IF(PYRENE_MOTIONS_FOUND)
# Configure files using motions from pyrene-motions package
FOREACH(py_filename appli-test-simple-seq-play )
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/tests/${py_filename}.py.cmake
${PROJECT_BINARY_DIR}/tests/${py_filename}.py
)
INSTALL(FILES
${PROJECT_BINARY_DIR}/tests/${py_filename}.py
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/tests
)
ENDFOREACH(py_filename)
# Install python files starting the application
FOREACH(py_filename test-simple-seq-play )
INSTALL(FILES
${PROJECT_SOURCE_DIR}/tests/${py_filename}.py
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/tests
)
ENDFOREACH(py_filename)
ENDIF(PYRENE_MOTIONS_FOUND)
FOREACH(py_filename kinetalos katana_holding)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/tests/${py_filename}.py.cmake
${PROJECT_BINARY_DIR}/tests/${py_filename}.py)
INSTALL(FILES
${PROJECT_SOURCE_DIR}/tests/test.py
${PROJECT_SOURCE_DIR}/tests/appli.py
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/tests
)
ENDIF(TALOS_DATA_FOUND)
${PROJECT_BINARY_DIR}/tests/${py_filename}.py
DESTINATION share/${PROJECT_NAME}/tests)
ENDFOREACH(py_filename)
# Configure files using motions from pyrene-motions package
FOREACH(py_filename appli-test-simple-seq-play)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/tests/${py_filename}.py.cmake
${PROJECT_BINARY_DIR}/tests/${py_filename}.py)
INSTALL(FILES
${PROJECT_BINARY_DIR}/tests/${py_filename}.py
DESTINATION share/${PROJECT_NAME}/tests)
ENDFOREACH(py_filename)
# Install python files starting the application
FOREACH(py_filename test-simple-seq-play)
INSTALL(FILES
${PROJECT_SOURCE_DIR}/tests/${py_filename}.py
DESTINATION share/${PROJECT_NAME}/tests)
ENDFOREACH(py_filename)
INSTALL(FILES
${PROJECT_SOURCE_DIR}/tests/test.py
${PROJECT_SOURCE_DIR}/tests/appli.py
DESTINATION share/${PROJECT_NAME}/tests)
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
# Copyright 2016, R. Budhiraja, Olivier Stasse, CNRS
FUNCTION(COMPILE_PLUGIN NAME SOURCES ENTITIES)
ADD_LIBRARY(${NAME} SHARED ${SOURCES})
SET_TARGET_PROPERTIES(${lib} PROPERTIES
PREFIX ""
)
IF (SUFFIX_SO_VERSION)
SET_TARGET_PROPERTIES(${lib} PROPERTIES
SOVERSION ${PROJECT_VERSION}
)
ENDIF()
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}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/plugin)
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${NAME})
SET(NEW_ENTITY_CLASS ${ENTITIES})
DYNAMIC_GRAPH_PYTHON_MODULE("sot/talos/${PYTHON_LIBRARY_NAME}"
${NAME}
sot-talos-${PYTHON_LIBRARY_NAME}-wrap
)
ENDFUNCTION()
# Copyright 2016, 2020, R. Budhiraja, Olivier Stasse, Guilhem SaurelCNRS
# Install Python files.
SET(PYTHON_MODULE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/talos)
SET(PYTHON_MODULE_BUILD_DIR
${CMAKE_CURRENT_BINARY_DIR}/dynamic_graph/sot/talos)
SET(PYTHON_MODULE dynamic_graph/sot/talos)
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py" )
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "talos.py" )
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py")
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "talos.py")
SET(FILES __init__.py robot.py)
# Install dynamic_graph.sot.pyrene
SET(PYTHON_MODULE dynamic_graph/sot/pyrene)
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py" )
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "robot.py" "${PYTHON_SITELIB}")
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py")
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "prologue.py")
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "robot.py")
# Add the library to wrap the device of Talos.
MACRO(build_talos_device)
SET(DEVICE_NAME sot-talos-device)
ADD_LIBRARY(${DEVICE_NAME}
SHARED
sot-talos-device.cpp
)
# Link the dynamic library containing the SoT with its dependencies.
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")
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}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
SET(DEVICE_NAME sot-talos-device)
ADD_LIBRARY(${DEVICE_NAME} SHARED sot-talos-device.cpp)
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
SET(NEW_ENTITY_CLASS ${ENTITIES})
DYNAMIC_GRAPH_PYTHON_MODULE("sot/talos/${PYTHON_LIBRARY_NAME}"
${DEVICE_NAME}
sot-talos-${PYTHON_LIBRARY_NAME}-wrap
)
# Link the dynamic library containing the SoT with its dependencies.
TARGET_LINK_LIBRARIES(${DEVICE_NAME}
sot-core::sot-core
dynamic-graph-python::dynamic-graph-python
dynamic_graph_bridge::ros_bridge)
ENDMACRO()
INSTALL(TARGETS ${DEVICE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
build_talos_device()
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
SET(NEW_ENTITY_CLASS ${ENTITIES})
DYNAMIC_GRAPH_PYTHON_MODULE("sot/talos/${PYTHON_LIBRARY_NAME}"
${DEVICE_NAME} sot-talos-${PYTHON_LIBRARY_NAME}-wrap)
# Add the library to wrap the controller of Pyrene.
MACRO(build_talos_controller)
SET(CONTROLLER_NAME sot-pyrene-controller)
ADD_LIBRARY(${CONTROLLER_NAME}
SHARED
sot-talos-controller.cpp
sot-pyrene-controller.cpp
)
# Link the dynamic library containing the SoT with its dependencies.
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)
PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} "dynamic_graph_bridge")
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} "ros_bridge")
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ${Boost_LIBRARIES})
ENDIF(UNIX AND NOT APPLE)
INSTALL(TARGETS ${CONTROLLER_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
SET(CONTROLLER_NAME sot-pyrene-controller)
ADD_LIBRARY(${CONTROLLER_NAME} SHARED ${CONTROLLER_NAME}.cpp
sot-talos-controller.cpp)
ENDMACRO()
# Link the dynamic library containing the SoT with its dependencies.
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ${DEVICE_NAME}
dynamic_graph_bridge::ros_interpreter
dynamic_graph_bridge::ros_bridge)
build_talos_controller()
INSTALL(TARGETS ${CONTROLLER_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
#!/usr/bin/python
# flake8: noqa
import rospy
from dynamic_graph_bridge.srv import *
from dynamic_graph_bridge_msgs.srv import *
from std_srvs.srv import *
......
......@@ -3,7 +3,6 @@
import sys
import rospy
from dynamic_graph_bridge.srv import *
from dynamic_graph_bridge_msgs.srv import *
from std_srvs.srv import *
......
#!/usr/bin/python
# flake8: noqa
import rospy
from dynamic_graph_bridge.srv import *
from dynamic_graph_bridge_msgs.srv import *
from std_srvs.srv import *
......
#!/usr/bin/python
# flake8: noqa
import rospy
from dynamic_graph_bridge.srv import *
from dynamic_graph_bridge_msgs.srv import *
from std_srvs.srv import *
......
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