Commit e2dad270 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] clean: keep minimal required instructions

parent eadb9cb9
# Copyright (C) 2017-2018 LAAS-CNRS
# Copyright (C) 2017-2020 LAAS-CNRS
#
# Author: Olivier Stasse
# Author: Guilhem Saurel
#
cmake_minimum_required(VERSION 2.8.3)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
# Project properties
SET(PROJECT_ORG stack-of-tasks)
set(PROJECT_DESCRIPTION "roscontrol_sot")
set(PROJECT_NAME roscontrol_sot)
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
SET(PROJECT_DESCRIPTION roscontrol_sot)
SET(PROJECT_NAME roscontrol_sot)
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
# Project options
set(CXX_DISABLE_WERROR True)
# Project configuration
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_CXX_STANDARD 11)
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
set(CXX_DISABLE_WERROR False)
include(cmake/base.cmake)
include(cmake/ros.cmake)
include(cmake/python.cmake)
# JRL-cmakemodule setup
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/ros.cmake)
INCLUDE(cmake/python.cmake)
CMAKE_POLICY(SET CMP0048 OLD)
project(roscontrol_sot CXX)
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
# Project dependencies
FINDPYTHON()
add_required_dependency(bullet)
add_required_dependency("urdfdom")
add_required_dependency(urdfdom)
SET(CATKIN_REQUIRED_COMPONENTS
temperature_sensor_controller
......@@ -33,47 +40,18 @@ SET(CATKIN_REQUIRED_COMPONENTS
pal_common_msgs
roscpp
std_msgs
dynamic_graph_bridge
control_msgs
sensor_msgs
realtime_tools )
SET(CATKIN_DEPENDS_LIBRARIES ros_bridge sot_loader rcsot_controller)
SET(CATKIN_REQUIRED_COMPONENTS ${CATKIN_REQUIRED_COMPONENTS} rospy)
SET(CATKIN_DEPENDS_LIBRARIES ${CATKIN_DEPENDS_LIBRARIES} ros_interpreter)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
${CATKIN_REQUIRED_COMPONENTS}
)
include_directories(include tests ${catkin_INCLUDE_DIRS} ${bullet_INCLUDE_DIRS})
link_directories(${bullet_LIBRARY_DIRS})
realtime_tools
rospy
)
find_package(catkin REQUIRED COMPONENTS ${CATKIN_REQUIRED_COMPONENTS})
# Add dependency through jrl-cmakemodules to compile
# this code without catkin_make
#add_project_dependency(dynamic_graph_bridge REQUIRED)
add_project_dependency(dynamic-graph REQUIRED )
add_project_dependency(dynamic-graph-python REQUIRED )
add_project_dependency(sot-core REQUIRED )
add_required_dependency("pinocchio" REQUIRED)
# This is necessary so that the pc file generated by catking is similar
# to the on done directly by jrl-cmake-modules
catkin_package(CATKIN_DEPENDS
temperature_sensor_controller
pal_hardware_interfaces
controller_interface controller_manager
roscpp
realtime_tools
message_runtime
dynamic_graph_bridge
LIBRARIES ${CATKIN_DEPENDS_LIBRARIES} )
ADD_PROJECT_DEPENDENCY(dynamic-graph-python REQUIRED)
ADD_PROJECT_DEPENDENCY(dynamic_graph_bridge REQUIRED)
ADD_PROJECT_DEPENDENCY(sot-core REQUIRED )
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED)
# Detect the controller interface version to switch code
if(controller_interface_FOUND)
......@@ -83,66 +61,34 @@ if(controller_interface_FOUND)
endif(controller_interface_FOUND)
# Detect if temperature sensor controller package is found
# if yes then it is a PARL Robotics Forked code.
# if yes then it is a PAL Robotics Forked code.
if(temperature_sensor_controller_FOUND)
add_definitions(-DTEMPERATURE_SENSOR_CONTROLLER)
endif(temperature_sensor_controller_FOUND)
LIST(APPEND LOGGING_WATCHED_VARIABLES
TEMPERATURE_SENSOR_CONTROLLER_FOUND
CONTROLLER_INTERFACE_FOUND
CONTROLLER_INTERFACE_VERSION )
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
add_library(${PROJECT_NAME}
src/roscontrol-sot-controller.cpp
src/log.cpp
)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${catkin_LIBRARIES} ${bullet_LIBRARIES}
sot-core::sot-core dynamic_graph_bridge::sot_loader)
## Declare a C++ library
add_library(rcsot_controller
src/roscontrol-sot-controller.cpp
src/log.cpp
)
pkg_config_use_dependency(rcsot_controller pinocchio NO_INCLUDE_SYSTEM)
## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(roscontrol_sot_node ${${PROJECT_NAME}_EXPORTED_TARGETS}
# ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
target_link_libraries(rcsot_controller
${catkin_LIBRARIES}
${bullet_LIBRARIES}
)
#target_link_libraries(rcsot_controller urdfdom optional
# NO_INCLUDE_SYSTEM)
target_link_libraries(rcsot_controller dynamic-graph::dynamic-graph)
IF(SUFFIX_SO_VERSION)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
## Mark executables and/or libraries for installation
install(TARGETS rcsot_controller
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib )
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
ADD_EXECUTABLE(roscontrol-sot-parse-log
src/roscontrol-sot-parse-log.cc)
install(TARGETS roscontrol-sot-parse-log
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION bin )
ADD_EXECUTABLE(roscontrol-sot-parse-log src/roscontrol-sot-parse-log.cc)
install(TARGETS roscontrol-sot-parse-log EXPORT ${TARGETS_EXPORT_NAME} DESTINATION bin)
foreach(dir config launch)
install(DIRECTORY ${dir}
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
endforeach()
install(DIRECTORY ${dir} DESTINATION share/${PROJECT_NAME})
endforeach(dir)
ADD_SUBDIRECTORY(tests)
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
Subproject commit 17d8f9db4c512004a1d205ca93c2648d81b59e51
Subproject commit 321eb1ccf1d94570eb564f3659b13ef3ef82239e
......@@ -3,103 +3,31 @@
# Author: Olivier Stasse
#
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_INSTALL_RPATH "${LIBRARY_OUTPUT_PATH}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}")
set(PKG_CONFIG_ADDITIONAL_VARIABLES
${PKG_CONFIG_ADDITIONAL_VARIABLES}
plugindirname
plugindir
)
ADD_EXECUTABLE(roscontrol_sot_hardware roscontrol_sot_hardware.cpp)
# Create directory for local wrap.so
file(MAKE_DIRECTORY
${LIBRARY_OUTPUT_PATH}/dynamic_graph/sot/test/sot_test_device)
target_link_libraries(roscontrol_sot_hardware
${catkin_LIBRARIES}
${bullet_libraries}
)
TARGET_INCLUDE_DIRECTORIES(roscontrol_sot_hardware PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
TARGET_LINK_LIBRARIES(roscontrol_sot_hardware ${PROJECT_NAME}
${catkin_LIBRARIES} ${bullet_libraries})
# Add the library to wrap the test device.
MACRO(build_test_device)
SET(DEVICE_NAME sot-test-device)
ADD_LIBRARY(${DEVICE_NAME}
SHARED
sot-test-device.cpp
)
set_target_properties(${DEVICE_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH True)
#set_target_properties(${DEVICE_NAME} PROPERTIES PREFIX "")
# 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 ros_inter)
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})
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
SET(NEW_ENTITY_CLASS ${ENTITIES})
DYNAMIC_GRAPH_PYTHON_MODULE("sot/test/${PYTHON_LIBRARY_NAME}"
${DEVICE_NAME}
sot/test/${PYTHON_LIBRARY_NAME}/wrap
)
SET(DEVICE_NAME sot-test-device)
ADD_LIBRARY(${DEVICE_NAME} SHARED ${DEVICE_NAME}.cpp)
TARGET_LINK_LIBRARIES(${DEVICE_NAME} sot-core::sot-core)
INSTALL(TARGETS ${DEVICE_NAME} DESTINATION lib)
ENDMACRO()
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
SET(NEW_ENTITY_CLASS ${ENTITIES})
build_test_device()
DYNAMIC_GRAPH_PYTHON_MODULE("sot/test/${PYTHON_LIBRARY_NAME}"
${DEVICE_NAME} sot-test-${PYTHON_LIBRARY_NAME}-wrap)
SET_TARGET_PROPERTIES(sot-test-${PYTHON_LIBRARY_NAME}-wrap PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ../src) # FIXME: weird catkin / dg interraction
# Add the library to wrap the controller of Test.
MACRO(build_test_controller)
SET(CONTROLLER_NAME sot-test-controller)
ADD_LIBRARY(${CONTROLLER_NAME}
SHARED
sot-test-controller.cpp
)
#
set_target_properties(${CONTROLLER_NAME}
PROPERTIES BUILD_WITH_INSTALL_RPATH True)
#set_target_properties(${CONTROLLER_NAME} PROPERTIES PREFIX "")
# 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)
PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} PINOCCHIO)
#target_link_libraries(${CONTROLLER_NAME} dynamic_graph_bridge)
ADD_DEPENDENCIES(${CONTROLLER_NAME} sot-test-device)
#TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ros_bridge)
#TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ros_interpreter)
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} sot-test-device)
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})
ENDMACRO()
build_test_controller()
SET(CONTROLLER_NAME sot-test-controller)
ADD_LIBRARY(${CONTROLLER_NAME} SHARED sot-test-controller.cpp)
TARGET_INCLUDE_DIRECTORIES(${CONTROLLER_NAME} SYSTEM PUBLIC
${catkin_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ${DEVICE_NAME})
INSTALL(TARGETS ${CONTROLLER_NAME} DESTINATION lib)
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