Commit a031efe5 authored by Guilhem Saurel's avatar Guilhem Saurel

[CMake] add INSTALL_PYTHON_INTERFACE_ONLY option

parent 6ff39326
......@@ -6,6 +6,7 @@ INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/test.cmake)
SET(PROJECT_NAMESPACE stack-of-tasks)
SET(PROJECT_NAME sot-dynamic-pinocchio)
......@@ -35,6 +36,8 @@ ADD_REQUIRED_DEPENDENCY("sot-tools >= 2.0.0")
SET(BOOST_COMPONENTS filesystem system unit_test_framework)
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
OPTION (INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF)
IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python >= 3.0.0")
......@@ -43,31 +46,16 @@ IF(BUILD_PYTHON_INTERFACE)
ADD_REQUIRED_DEPENDENCY("eigenpy")
ENDIF(BUILD_PYTHON_INTERFACE)
# List plug-ins that will be compiled.
SET(plugins
zmpreffromcom
force-compensation
integrator-force-exact
mass-apparent
integrator-force-rk4
integrator-force
angle-estimator
waist-attitude-from-sensor
zmp-from-forces
)
SET(LIBRARY_NAME ${PROJECT_NAME})
LIST(APPEND plugins dynamic)
# Add dependency toward sot-dynamic-pinocchio library in pkg-config file.
PKG_CONFIG_APPEND_LIBS(${LIBRARY_NAME})
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
SEARCH_FOR_BOOST()
SEARCH_FOR_EIGEN()
# Add subdirectories.
ADD_SUBDIRECTORY(include)
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(python)
......
# Copyright 2010, François Bleibel, Olivier Stasse, JRL, CNRS/AIST
SET(${PROJECT_NAME}_HEADERS
dynamic-pinocchio.h
integrator-force-exact.h
zmpreffromcom.h
integrator-force.h
force-compensation.h
mass-apparent.h
waist-attitude-from-sensor.h
matrix-inertia.h
integrator-force-rk4.h
angle-estimator.h
)
# Recreate correct path for the headers
#--------------------------------------
SET(fullpath_${PROJECT_NAME}_HEADERS)
FOREACH(lHeader ${${PROJECT_NAME}_HEADERS})
SET(fullpath_${PROJECT_NAME}_HEADERS
${fullpath_${PROJECT_NAME}_HEADERS}
./${PROJECT_NAME}/${lHeader}
)
ENDFOREACH(lHeader)
#----------------------------------------------------
# Install procedure for the header files
#----------------------------------------------------
INSTALL(FILES ${fullpath_${PROJECT_NAME}_HEADERS}
DESTINATION include/${PROJECT_NAME}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE
)
# Copyright 2010, François Bleibel, Olivier Stasse, JRL, CNRS/AIST
SET(${PROJECT_NAME}_HEADERS
dynamic-pinocchio.h
integrator-force-exact.h
zmpreffromcom.h
integrator-force.h
force-compensation.h
mass-apparent.h
waist-attitude-from-sensor.h
matrix-inertia.h
integrator-force-rk4.h
angle-estimator.h
)
INSTALL(FILES ${${PROJECT_NAME}_HEADERS} DESTINATION include/${CUSTOM_HEADER_DIR})
# Copyright 2010, François Bleibel, Olivier Stasse, JRL, CNRS/AIST,
# Florent Lamiraux (CNRS/LAAS)
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
# Verbosity level
IF (NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
ENDIF (NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
ADD_DEFINITIONS(-DDEBUG=2)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
# Main Library
ADD_LIBRARY(${PROJECT_NAME} SHARED sot-dynamic-pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} dynamic-graph)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
# List plug-ins that will be compiled.
SET(plugins
zmpreffromcom
force-compensation
integrator-force-exact
mass-apparent
integrator-force-rk4
integrator-force
angle-estimator
waist-attitude-from-sensor
zmp-from-forces
dynamic
)
SET(integrator-force-rk4_plugins_dependencies integrator-force)
SET(integrator-force-exact_plugins_dependencies integrator-force)
FOREACH(lib ${plugins})
SET(libname dp-${lib})
ADD_LIBRARY(${libname} SHARED ${lib}.cpp)
ADD_LIBRARY(${libname} SHARED ${lib})
SET_TARGET_PROPERTIES(${libname} PROPERTIES
PREFIX ""
SOVERSION ${PROJECT_VERSION})
......@@ -27,17 +41,16 @@ FOREACH(lib ${plugins})
TARGET_LINK_LIBRARIES(${libname} "dp-${${lib}_plugins_dependencies}")
ENDIF(${lib}_plugins_dependencies)
TARGET_LINK_LIBRARIES(${libname} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${libname} ${Boost_LIBRARIES})
PKG_CONFIG_USE_DEPENDENCY(${libname} pinocchio)
IF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${libname} eigenpy)
ENDIF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${libname} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${libname} dynamic-graph)
INSTALL(TARGETS ${libname} DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR})
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(TARGETS ${libname} DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
# build python submodule
IF(BUILD_PYTHON_INTERFACE)
......@@ -52,23 +65,8 @@ FOREACH(lib ${plugins})
)
PKG_CONFIG_USE_DEPENDENCY(sot-dynamic-pinocchio-${PYTHON_LIBRARY_NAME}-wrap pinocchio)
ENDIF(BUILD_PYTHON_INTERFACE)
UNSET({libname})
ENDFOREACH(lib)
# Main Library
ADD_LIBRARY(${LIBRARY_NAME} SHARED sot-dynamic-pinocchio.cpp)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} pinocchio)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} sot-core)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} dynamic-graph)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
TARGET_LINK_LIBRARIES(dp-dynamic ${LIBRARY_NAME})
# Install empty __init__.py files in intermediate directories.
IF(BUILD_PYTHON_INTERFACE)
INSTALL(FILES
......
# Copyright 2010, François Bleibel, Olivier Stasse, JRL, CNRS/AIST
ADD_DEFINITIONS(-DDEBUG=2)
SET(tests
test_constructor
#test_config
......@@ -11,17 +9,11 @@ test_constructor
# test_results
)
#----------------------------------------------------
# Install procedure for the urdf files
#----------------------------------------------------
SET(test_dyn_plugins_dependencies dynamic)
# Make Boost.Test generates the main function in test cases.
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
# getting the information for the robot.
#SET(samplemodelpath ${JRL_DYNAMICS_PKGDATAROOTDIR}/jrl-dynamics/examples/data/)
#SET(samplespec
......@@ -36,11 +28,9 @@ ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
LIST(APPEND LOGGING_WATCHED_VARIABLES samplespec sampleljr)
FOREACH(test ${tests})
SET(EXECUTABLE_NAME "${test}_exe")
ADD_EXECUTABLE(${EXECUTABLE_NAME}
${test}.cpp)
ADD_UNIT_TEST(${test} ${test})
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME}
TARGET_LINK_LIBRARIES(${test}
dp-zmpreffromcom
dp-force-compensation
#integrator-force-exact
......@@ -52,26 +42,14 @@ FOREACH(test ${tests})
${LIBRARY_NAME}
)
PKG_CONFIG_USE_DEPENDENCY(${EXECUTABLE_NAME} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${EXECUTABLE_NAME} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${EXECUTABLE_NAME} dynamic-graph)
IF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${EXECUTABLE_NAME} dynamic-graph-python)
ENDIF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${test} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${test} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${test} dynamic-graph)
IF(${test}_plugins_dependencies)
ADD_DEPENDENCIES(${EXECUTABLE_NAME} "${${test}_plugins_dependencies}")
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} "${${test}_plugins_dependencies}")
ENDIF(${test}_plugins_dependencies)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY})
ADD_TEST(${test} ${EXECUTABLE_NAME}
${samplemodelpath} ${samplespec} ${sampleljr} )
IF (UNIX)
SET(EXTRA_LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH})
SET_PROPERTY(TEST ${test} PROPERTY
ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_BINARY_DIR}/src:${BOOST_ROOT}/lib:${EXTRA_LD_LIBRARY_PATH}")
ENDIF(UNIX)
TARGET_LINK_LIBRARIES(${test} ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY})
ENDFOREACH(test)
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