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

[CMake] clean

parent d9422656
......@@ -4,18 +4,6 @@
# Florent Forget, LAAS/CNRS
# Paul Dandignac, LAAS/CNRS
#
# This file is part of sot-torque-control.
# sot-torque-control is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# sot-torque-control is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# sot-torque-control. If not, see <http://www.gnu.org/licenses/>.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
......@@ -30,14 +18,12 @@ SET(PROJECT_NAME sot-torque-control)
SET(PROJECT_DESCRIPTION "Collection of dynamic-graph entities aimed at implementing torque control on different robots.")
SET(PROJECT_URL "https://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
SET(CUSTOM_HEADER_DIR "sot/torque-control")
SET(CUSTOM_HEADER_DIR "sot/torque_control")
SET(DOXYGEN_USE_MATHJAX YES)
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
#add_compile_options(-std=c++11) # CMake 2.8.12 or newer
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(PKG_CONFIG_ADDITIONAL_VARIABLES
${PKG_CONFIG_ADDITIONAL_VARIABLES}
......@@ -67,9 +53,9 @@ IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python >= 3.0.0")
SET(${LIBRARY_NAME}_PYTHON_FILES python/*.py)
SET(PYTHON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/dynamic_graph/sot/torque_control)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})
SET(PYTHON_LIBRARY_DIR dynamic_graph/sot/torque_control)
SET(PYTHON_INSTALL_DIR ${PYTHON_SITELIB}/${PYTHON_LIBRARY_DIR})
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIR})
ENDIF(BUILD_PYTHON_INTERFACE)
SEARCH_FOR_BOOST()
......@@ -87,134 +73,15 @@ ADD_OPTIONAL_DEPENDENCY("ddp-actuator-solver")
SET(SOTTORQUECONTROL_LIB_NAME ${PROJECT_NAME})
SET(LIBRARY_NAME ${SOTTORQUECONTROL_LIB_NAME})
SET(${LIBRARY_NAME}_HEADERS
include/sot/torque_control/joint-torque-controller.hh
include/sot/torque_control/base-estimator.hh
include/sot/torque_control/numerical-difference.hh
include/sot/torque_control/motor-model.hh
include/sot/torque_control/joint-trajectory-generator.hh
include/sot/torque_control/se3-trajectory-generator.hh
include/sot/torque_control/free-flyer-locator.hh
include/sot/torque_control/inverse-dynamics-balance-controller.hh
include/sot/torque_control/position-controller.hh
include/sot/torque_control/control-manager.hh
include/sot/torque_control/current-controller.hh
include/sot/torque_control/commands-helper.hh
include/sot/torque_control/device-torque-ctrl.hh
include/sot/torque_control/trace-player.hh
include/sot/torque_control/torque-offset-estimator.hh
include/sot/torque_control/imu_offset_compensation.hh
include/sot/torque_control/admittance-controller.hh
include/sot/torque_control/utils/trajectory-generators.hh
include/sot/torque_control/utils/lin-estimator.hh
include/sot/torque_control/utils/poly-estimator.hh
include/sot/torque_control/utils/quad-estimator.hh
include/sot/torque_control/utils/Stdafx.hh
include/sot/torque_control/utils/vector-conversions.hh
)
#INSTALL(FILES ${${LIBRARY_NAME}_HEADERS}
# DESTINATION include/sot/torque-control
# PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
SET(${LIBRARY_NAME}_SOURCES ${${LIBRARY_NAME}_HEADERS}
src/trajectory-generators.cpp
src/lin-estimator.cpp
src/poly-estimator.cpp
src/quad-estimator.cpp
src/motor-model.cpp
)
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${${LIBRARY_NAME}_SOURCES})
SET_TARGET_PROPERTIES(${LIBRARY_NAME}
PROPERTIES
SOVERSION ${PROJECT_VERSION}
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} tsid)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} parametric-curves)
IF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph-python)
ADD_SUBDIRECTORY(python/${PYTHON_LIBRARY_DIR})
ENDIF(BUILD_PYTHON_INTERFACE)
IF(UNIX)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CMAKE_DL_LIBS})
ENDIF(UNIX)
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} pthread)
ENDIF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
IF (NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
IF(BUILD_PYTHON_INTERFACE)
INSTALL(FILES python/dynamic_graph/sot/torque_control/__init__.py
python/dynamic_graph/sot/torque_control/main.py
python/dynamic_graph/sot/torque_control/create_entities_utils.py
python/dynamic_graph/sot/torque_control/main_sim.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control)
INSTALL(FILES python/dynamic_graph/sot/torque_control/identification/__init__.py
python/dynamic_graph/sot/torque_control/identification/identification_utils.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control/identification)
INSTALL(FILES python/dynamic_graph/sot/torque_control/utils/__init__.py
python/dynamic_graph/sot/torque_control/utils/plot_utils.py
python/dynamic_graph/sot/torque_control/utils/sot_utils.py
python/dynamic_graph/sot/torque_control/utils/filter_utils.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control/utils)
INSTALL(FILES python/dynamic_graph/sot/torque_control/tests/__init__.py
python/dynamic_graph/sot/torque_control/tests/test_control_manager.py
python/dynamic_graph/sot/torque_control/tests/test_balance_ctrl_openhrp.py
python/dynamic_graph/sot/torque_control/tests/test_velocity_filters.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control/tests)
ENDIF(BUILD_PYTHON_INTERFACE)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(unitTesting)
# *****************************
# PYTHON interface *
# *****************************
IF(BUILD_PYTHON_INTERFACE)
IF(TALOS_DATA_FOUND)
FOREACH(py_filename test_torque_offset_estimator)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/python/dynamic_graph/sot/torque_control/tests/${py_filename}.py.in
${PROJECT_BINARY_DIR}/python/dynamic_graph/sot/torque_control/tests/${py_filename}.py
)
INSTALL(FILES ${PROJECT_BINARY_DIR}/python/dynamic_graph/sot/torque_control/tests/${py_filename}.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control/tests)
ENDFOREACH(py_filename)
ENDIF(TALOS_DATA_FOUND)
IF(SIMPLE_HUMANOID_DESCRIPTION_FOUND)
FOREACH(py_filename robot_data_test)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/python/dynamic_graph/sot/torque_control/tests/${py_filename}.py.in
${PROJECT_BINARY_DIR}/python/dynamic_graph/sot/torque_control/tests/${py_filename}.py
)
INSTALL(FILES ${PROJECT_BINARY_DIR}/python/dynamic_graph/sot/torque_control/tests/${py_filename}.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control/tests)
ENDFOREACH(py_filename)
ENDIF(SIMPLE_HUMANOID_DESCRIPTION_FOUND)
ENDIF(BUILD_PYTHON_INTERFACE)
SETUP_PROJECT_FINALIZE()
SET(${LIBRARY_NAME}_HEADERS
joint-torque-controller.hh
base-estimator.hh
numerical-difference.hh
motor-model.hh
joint-trajectory-generator.hh
se3-trajectory-generator.hh
free-flyer-locator.hh
inverse-dynamics-balance-controller.hh
position-controller.hh
control-manager.hh
current-controller.hh
commands-helper.hh
device-torque-ctrl.hh
trace-player.hh
torque-offset-estimator.hh
imu_offset_compensation.hh
admittance-controller.hh
utils/trajectory-generators.hh
utils/lin-estimator.hh
utils/poly-estimator.hh
utils/quad-estimator.hh
utils/Stdafx.hh
utils/vector-conversions.hh
)
INSTALL(FILES ${${LIBRARY_NAME}_HEADERS} DESTINATION include/${CUSTOM_HEADER_DIR})
INSTALL(FILES
__init__.py
main.py
create_entities_utils.py
main_sim.py
DESTINATION ${PYTHON_INSTALL_DIR})
INSTALL(FILES
identification/__init__.py
identification/identification_utils.py
DESTINATION ${PYTHON_INSTALL_DIR}/identification)
INSTALL(FILES
utils/__init__.py
utils/plot_utils.py
utils/sot_utils.py
utils/filter_utils.py
DESTINATION ${PYTHON_INSTALL_DIR}/utils)
INSTALL(FILES
tests/__init__.py
tests/test_control_manager.py
tests/test_balance_ctrl_openhrp.py
tests/test_velocity_filters.py
DESTINATION ${PYTHON_INSTALL_DIR}/tests)
SET(${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES)
IF(TALOS_DATA_FOUND)
SET(${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES
${${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES}
test_torque_offset_estimator
)
ENDIF(TALOS_DATA_FOUND)
IF(SIMPLE_HUMANOID_DESCRIPTION_FOUND)
SET(${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES
${${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES}
robot_data_test
)
ENDIF(SIMPLE_HUMANOID_DESCRIPTION_FOUND)
FOREACH(py_filename ${${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES})
CONFIGURE_FILE(
tests/${py_filename}.py.in
tests/${py_filename}.py
)
INSTALL(FILES tests/${py_filename}.py DESTINATION ${PYTHON_INSTALL_DIR}/tests)
ENDFOREACH(py_filename ${${PROJECT_NAME}_PYTHON_CONFIGURABLE_FILES})
# Copyright 2014, Andrea Del Prete, LAAS/CNRS
#
# This file is part of sot-torque-control.
# sot-torque-control is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# sot-torque-control is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# sot-torque-control. If not, see <http://www.gnu.org/licenses/>.
# Verbosity level
IF (NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
ENDIF (NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
# The main include dir
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
IF(UNIX)
ADD_DEFINITIONS(-pthread)
ENDIF(UNIX)
SET(${LIBRARY_NAME}_SOURCES
trajectory-generators.cpp
lin-estimator.cpp
poly-estimator.cpp
quad-estimator.cpp
motor-model.cpp
)
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${${LIBRARY_NAME}_SOURCES})
SET_TARGET_PROPERTIES(${LIBRARY_NAME}
PROPERTIES
SOVERSION ${PROJECT_VERSION}
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} tsid)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} parametric-curves)
IF(BUILD_PYTHON_INTERFACE)
LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph-python)
ENDIF(BUILD_PYTHON_INTERFACE)
#define DEBUG=2 if we're building in debug mode (what for?)
IF("${CMAKE_BUILD_TYPE}" STREQUAL DEBUG)
ADD_DEFINITIONS(-DDEBUG=2)
ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL DEBUG)
IF(UNIX)
ADD_DEFINITIONS(-pthread)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CMAKE_DL_LIBS})
IF(NOT APPLE)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} pthread)
ENDIF(NOT APPLE)
ENDIF(UNIX)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
#This project will create many plugins as shared libraries, listed here
SET(plugins
admittance-controller
admittance-controller
base-estimator
control-manager
current-controller
device-torque-ctrl
device-torque-ctrl
free-flyer-locator
imu_offset_compensation
imu_offset_compensation
inverse-dynamics-balance-controller
joint-torque-controller
joint-trajectory-generator
numerical-difference
position-controller
numerical-difference
position-controller
se3-trajectory-generator
torque-offset-estimator
trace-player
......@@ -61,7 +77,7 @@ ENDIF(DDP_ACTUATOR_SOLVER_FOUND)
FOREACH(plugin ${plugins})
message( " Build plugin ${plugin}")
#retrieve plugin name
GET_FILENAME_COMPONENT(LIBRARY_NAME ${plugin} NAME)
......@@ -136,5 +152,5 @@ IF(BUILD_PYTHON_INTERFACE)
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/torque_control/__init__.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/torque_control
)
)
ENDIF(BUILD_PYTHON_INTERFACE)
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