Unverified Commit f3a9ee0b authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #1067 from jcarpent/devel

Full CMake export of Pinocchio
parents b8c1ae04 5f91ccb7
......@@ -40,4 +40,11 @@ jobs:
export CTEST_OUTPUT_ON_FAILURE=1
make test
sudo make install
cd ../unittest/packaging
mkdir build
cd build
export CMAKE_PREFIX_PATH=/usr/local
cmake ..
make
cd ../../../build
sudo make uninstall
language: generic
sudo: required
os: linux
git:
depth: false
compiler:
......@@ -19,9 +19,6 @@ env:
- BUILD_WITH_CATKIN_SUPPORT=false
- CTEST_OUTPUT_ON_FAILURE=1
notifications:
email:
- pinocchio-dev@laas.fr
branches:
only:
- master
......@@ -51,8 +48,6 @@ jobs:
- TRAVIS_PYTHON_VERSION=35
python: 3.5
allow_failures:
- compiler:
before_install: ./travis_custom/custom_before_install
install:
- pip install --user pyopenssl
......
......@@ -9,6 +9,8 @@ SET(PROJECT_NAME pinocchio)
SET(PROJECT_DESCRIPTION "A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives")
SET(PROJECT_URL "http://github.com/stack-of-tasks/pinocchio")
SET(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
SET(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
......@@ -59,12 +61,22 @@ OPTION(BUILD_WITH_AUTODIFF_SUPPORT "Build the library with the Automatic Differe
OPTION(BUILD_WITH_CASADI_SUPPORT "Build the library with the CASADI support" OFF)
OPTION(BUILD_WITH_CODEGEN_SUPPORT "Build the library with the Code Generation support" OFF)
OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
OPTION(INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
IF (INITIALIZE_WITH_NAN)
IF(BUILD_WITH_COLLISION_SUPPORT)
SET(BUILD_WITH_HPP_FCL_SUPPORT TRUE)
ENDIF()
IF(BUILD_WITH_AUTODIFF_SUPPORT)
SET(BUILD_WITH_CPPAD_SUPPORT TRUE)
ENDIF()
IF(BUILD_WITH_CODEGEN_SUPPORT)
SET(BUILD_WITH_CPPAD_CODEGEN_SUPPORT TRUE)
ENDIF()
IF(INITIALIZE_WITH_NAN)
MESSAGE (STATUS "Initialize with NaN all the Eigen entries.")
ADD_DEFINITIONS(-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
ENDIF (INITIALIZE_WITH_NAN)
ENDIF(INITIALIZE_WITH_NAN)
MACRO(TAG_LIBRARY_VERSION target)
SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${PROJECT_VERSION})
......@@ -79,17 +91,21 @@ ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
IF(BUILD_WITH_URDF_SUPPORT)
ADD_REQUIRED_DEPENDENCY("urdfdom >= 0.2.0")
ADD_DEFINITIONS(-DPINOCCHIO_WITH_URDFDOM)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_URDFDOM")
ENDIF(BUILD_WITH_URDF_SUPPORT)
IF(BUILD_WITH_COLLISION_SUPPORT)
IF(BUILD_WITH_HPP_FCL_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_HPP_FCL)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_HPP_FCL")
ADD_REQUIRED_DEPENDENCY("hpp-fcl >= 1.0.0")
ENDIF(BUILD_WITH_COLLISION_SUPPORT)
ENDIF(BUILD_WITH_HPP_FCL_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
ADD_REQUIRED_DEPENDENCY("cppad >= 20180000.0")
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_CPPAD_SUPPORT)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_WITH_CPPAD_SUPPORT")
IF(NOT ${CPPAD_VERSION} VERSION_GREATER "3.3.0")
......@@ -98,13 +114,13 @@ IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(NOT ${CPPAD_VERSION} VERSION_GREATER "3.3.0")
IF(BUILD_WITH_CODEGEN_SUPPORT)
ADD_OPTIONAL_DEPENDENCY("cppadcg")
ADD_REQUIRED_DEPENDENCY("cppadcg")
ENDIF(BUILD_WITH_CODEGEN_SUPPORT)
IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_CPPADCG_SUPPORT)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_WITH_CPPADCG_SUPPORT")
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_CASADI_SUPPORT)
ADD_REQUIRED_DEPENDENCY("casadi >= 3.4.5")
......@@ -116,7 +132,7 @@ IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ENDIF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
# Special care of urdfdom version
IF(URDFDOM_FOUND AND BUILD_WITH_URDF_SUPPORT)
IF(BUILD_WITH_URDF_SUPPORT)
IF(${URDFDOM_VERSION} VERSION_LESS "0.3.0")
ADD_DEFINITIONS(-DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME")
......@@ -133,7 +149,7 @@ IF(URDFDOM_FOUND AND BUILD_WITH_URDF_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR")
ENDIF(${URDFDOM_VERSION} VERSION_GREATER "0.4.2")
ENDIF(URDFDOM_FOUND AND BUILD_WITH_URDF_SUPPORT)
ENDIF(BUILD_WITH_URDF_SUPPORT)
SET(BOOST_REQUIRED_COMPONENTS filesystem serialization system)
SET(BOOST_BUILD_COMPONENTS unit_test_framework)
......@@ -142,7 +158,6 @@ SET(BOOST_OPTIONAL_COMPONENTS "")
IF(BUILD_PYTHON_INTERFACE)
SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
ENDIF(BUILD_PYTHON_INTERFACE)
SET(BOOST_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} ${BOOST_OPTIONAL_COMPONENTS} ${BOOST_BUILD_COMPONENTS})
......@@ -168,10 +183,7 @@ FILE(GLOB_RECURSE HEADERS
${PROJECT_SOURCE_DIR}/src/*.hxx
)
IF(URDFDOM_FOUND)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_URDFDOM)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_URDFDOM")
ELSE(URDFDOM_FOUND)
IF(NOT BUILD_WITH_URDF_SUPPORT)
LIST(REMOVE_ITEM HEADERS
${PROJECT_SOURCE_DIR}/src/parsers/urdf.hpp
${PROJECT_SOURCE_DIR}/src/parsers/urdf/model.hxx
......@@ -179,17 +191,13 @@ ELSE(URDFDOM_FOUND)
${PROJECT_SOURCE_DIR}/src/parsers/urdf/utils.hpp
${PROJECT_SOURCE_DIR}/src/parsers/urdf/types.hpp
)
ENDIF(URDFDOM_FOUND)
ENDIF(NOT BUILD_WITH_URDF_SUPPORT)
IF(HPP_FCL_FOUND)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_HPP_FCL)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_HPP_FCL")
ELSE(HPP_FCL_FOUND)
IF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(REMOVE_ITEM HEADERS
${PROJECT_SOURCE_DIR}/src/spatial/fcl-pinocchio-conversions.hpp
)
ENDIF(HPP_FCL_FOUND)
ENDIF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(APPEND HEADERS macros.hpp)
......@@ -249,7 +257,26 @@ ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(benchmark)
# --- PACKAGING ----------------------------------------------------------------
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})
IF(BUILD_WITH_URDF_SUPPORT)
SET(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}\nset(PINOCCHIO_USE_URDFDOM \"\")")
ENDIF()
IF(BUILD_WITH_HPP_FCL_SUPPORT)
SET(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}\nset(PINOCCHIO_USE_HPP_FCL \"\")")
ENDIF()
IF(BUILD_WITH_CPPAD_SUPPORT)
SET(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}\nset(PINOCCHIO_USE_CPPAD \"\")")
ENDIF()
IF(BUILD_WITH_CPPAD_CODEGEN_SUPPORT)
SET(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}\nset(PINOCCHIO_USE_CPPAD_CODEGEN \"\")")
ENDIF()
IF(BUILD_WITH_CASADI_SUPPORT)
SET(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}\nset(PINOCCHIO_USE_CASADI \"\")")
ENDIF()
IF(BUILD_PYTHON_INTERFACE)
SET(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}\nset(PINOCCHIO_WITH_PYTHON_INTERFACE \"\")")
ENDIF()
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_REQUIRED_COMPONENTS})
FOREACH(cflags ${CFLAGS_DEPENDENCIES})
......
......@@ -19,7 +19,7 @@ MACRO(ADD_BENCH bench_name)
SET(link_to_main_lib ${ARGV1})
IF(link_to_main_lib)
SET_TARGET_PROPERTIES(${bench_name} PROPERTIES COMPILE_DEFINITIONS PINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")
TARGET_LINK_LIBRARIES(${bench_name} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${bench_name} PUBLIC ${PROJECT_NAME})
PKG_CONFIG_USE_DEPENDENCY(${bench_name} eigen3)
IF(HPP_FCL_FOUND)
......@@ -47,7 +47,7 @@ IF(CPPADCG_FOUND)
ADD_BENCH(timings-cg TRUE)
SET_PROPERTY(TARGET timings-cg PROPERTY CXX_STANDARD 11)
PKG_CONFIG_USE_DEPENDENCY(timings-cg "cppadcg")
TARGET_LINK_LIBRARIES(timings-cg ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES(timings-cg PUBLIC ${CMAKE_DL_LIBS})
ENDIF(CPPADCG_FOUND)
# timings
......
#
# Copyright (c) 2015-2019 CNRS INRIA
# Copyright (c) 2015-2020 CNRS INRIA
# Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
#
......@@ -30,6 +30,7 @@ ENDFUNCTION(REMOVE_PATH_FROM_LIST)
# --- PYTHON TARGET --- #
IF(BUILD_PYTHON_INTERFACE)
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
ADD_CUSTOM_TARGET(python)
SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
......@@ -76,7 +77,7 @@ REMOVE_PATH_FROM_LIST("${${PROJECT_NAME}_PYTHON_HEADERS}" "${CMAKE_CURRENT_SOURC
REMOVE_PATH_FROM_LIST("${${PROJECT_NAME}_PYTHON_SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/" ${PROJECT_NAME}_PYTHON_SOURCES)
# Python exposition of FCL
IF(NOT HPP_FCL_FOUND)
IF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(REMOVE_ITEM ${PROJECT_NAME}_PYTHON_HEADERS
multibody/fcl/contact.hpp
multibody/fcl/collision-result.hpp
......@@ -89,7 +90,7 @@ IF(NOT HPP_FCL_FOUND)
LIST(REMOVE_ITEM ${PROJECT_NAME}_PYTHON_SOURCES
multibody/fcl/expose-fcl.cpp
)
ENDIF(NOT HPP_FCL_FOUND)
ENDIF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(APPEND HEADERS ${${PROJECT_NAME}_PYTHON_HEADERS})
......@@ -98,9 +99,9 @@ MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python"
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/spatial")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/multibody")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/multibody/joint")
IF(HPP_FCL_FOUND)
IF(BUILD_WITH_HPP_FCL_SUPPORT)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/multibody/fcl")
ENDIF(HPP_FCL_FOUND)
ENDIF(BUILD_WITH_HPP_FCL_SUPPORT)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/parsers")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/serialization")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/algorithm")
......@@ -127,8 +128,8 @@ IF(BUILD_PYTHON_INTERFACE)
ADD_SOURCE_GROUP(${PYWRAP}_SOURCES)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} eigenpy)
TARGET_LINK_LIBRARIES(${PYWRAP} ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${PYWRAP})
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${PYWRAP} PUBLIC)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} hpp-fcl)
......@@ -150,7 +151,11 @@ IF(BUILD_PYTHON_INTERFACE)
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bindings/python/${PROJECT_NAME}")
INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})
INSTALL(
TARGETS ${PYWRAP}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${${PYWRAP}_INSTALL_DIR}
)
# --- INSTALL SCRIPTS
SET(PYTHON_FILES
......
......@@ -6,7 +6,7 @@ FUNCTION(ADD_PINOCCHIO_CPP_EXAMPLE EXAMPLE)
GET_FILENAME_COMPONENT(EXAMPLE_NAME ${EXAMPLE} NAME)
SET(EXAMPLE_NAME "example-cpp-${EXAMPLE_NAME}")
ADD_UNIT_TEST(${EXAMPLE_NAME} ${EXAMPLE})
TARGET_LINK_LIBRARIES(${EXAMPLE_NAME} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${EXAMPLE_NAME} PUBLIC ${PROJECT_NAME})
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} eigen3)
IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} urdfdom)
......
......@@ -11,15 +11,19 @@ SET(${PROJECT_NAME}_SOURCES
${${PROJECT_NAME}_PARSERS_SOURCES}
)
# Extract the compile definitions of the project for export
GET_DIRECTORY_PROPERTY(CURRENT_COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
IF(UNIX)
# Create target libpinocchio.so
ADD_LIBRARY(${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${CURRENT_COMPILE_DEFINITIONS})
IF(BUILD_WITH_COMMIT_VERSION)
TAG_LIBRARY_VERSION(${PROJECT_NAME})
ENDIF(BUILD_WITH_COMMIT_VERSION)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} urdfdom)
......
......@@ -34,8 +34,8 @@ MACRO(ADD_PINOCCHIO_UNIT_TEST NAME)
PKG_CONFIG_USE_DEPENDENCY(${TEST_NAME} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
TARGET_LINK_LIBRARIES(${TEST_NAME} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
TARGET_LINK_LIBRARIES(${TEST_NAME} PUBLIC ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${TEST_NAME} PRIVATE ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
ENDMACRO(ADD_PINOCCHIO_UNIT_TEST)
# --- RULES -------------------------------------------------------------------
......@@ -76,9 +76,10 @@ ENDIF(URDFDOM_FOUND)
IF(BUILD_PYTHON_INTERFACE)
ADD_PINOCCHIO_UNIT_TEST(python_parser eigenpy)
TARGET_INCLUDE_DIRECTORIES(test-cpp-python_parser SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(test-cpp-python_parser ${PYWRAP})
TARGET_LINK_LIBRARIES(test-cpp-python_parser ${PYTHON_LIBRARIES})
TARGET_LINK_LIBRARIES(test-cpp-python_parser PUBLIC ${PYWRAP})
TARGET_LINK_LIBRARIES(test-cpp-python_parser PUBLIC ${PYTHON_LIBRARIES})
SET(ENV_VARIABLES "PYTHONPATH=${CMAKE_BINARY_DIR}/bindings/python:$ENV{PYTHONPATH}")
IF(APPLE)
LIST(APPEND ENV_VARIABLES "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}")
......@@ -124,25 +125,25 @@ ADD_PINOCCHIO_UNIT_TEST(contact-dynamics-derivatives)
ADD_PINOCCHIO_UNIT_TEST(multiprecision)
# Automatic differentiation
IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(cppad-basic cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-spatial cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-joints cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-algo cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-algo-derivatives cppad)
IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
IF(BUILD_WITH_CODEGEN_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(cppadcg-basic cppadcg)
SET_PROPERTY(TARGET test-cpp-cppadcg-basic PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(test-cpp-cppadcg-basic ${CMAKE_DL_LIBS})
ADD_PINOCCHIO_UNIT_TEST(cppadcg-algo cppadcg)
SET_PROPERTY(TARGET test-cpp-cppadcg-algo PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(test-cpp-cppadcg-algo ${CMAKE_DL_LIBS})
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
IF(BUILD_WITH_CASADI_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(casadi-basic casadi)
SET_PROPERTY(TARGET test-cpp-casadi-basic PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-spatial casadi)
......@@ -153,5 +154,5 @@ IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
SET_PROPERTY(TARGET test-cpp-casadi-algo PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-algo-derivatives casadi)
SET_PROPERTY(TARGET test-cpp-casadi-algo-derivatives PROPERTY CXX_STANDARD 11)
ENDIF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ENDIF(BUILD_WITH_CASADI_SUPPORT)
cmake_minimum_required(VERSION 2.6)
project(ExtraLib CXX)
find_package(pinocchio REQUIRED)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
set(PINOCCHIO_MODEL_DIR "${PROJECT_SOURCE_DIR}/../../models")
add_definitions('-DPINOCCHIO_MODEL_DIR=\"${PINOCCHIO_MODEL_DIR}\"')
add_executable(run_rnea run_rnea.cpp)
target_link_libraries(run_rnea PUBLIC pinocchio::pinocchio)
if(DEFINED PINOCCHIO_WITH_URDF_SUPPORT)
add_executable(load_urdf load_urdf.cpp)
target_link_libraries(load_urdf PUBLIC pinocchio::pinocchio)
endif(DEFINED PINOCCHIO_WITH_URDF_SUPPORT)
#include <pinocchio/parsers/urdf.hpp>
#include <iostream>
#include <string>
int main(int /*argc*/, char ** /*argv*/)
{
using namespace pinocchio;
const std::string filename = PINOCCHIO_MODEL_DIR + std::string("/simple_humanoid.urdf");
Model model;
pinocchio::urdf::buildModel(filename, JointModelFreeFlyer(), model);
std::cout << "model.nq: " << model.nq << std::endl;
std::cout << "model.nv: " << model.nv << std::endl;
return 0;
}
#include <pinocchio/parsers/sample-models.hpp>
#include <pinocchio/algorithm/rnea.hpp>
#include <pinocchio/algorithm/joint-configuration.hpp>
#include <iostream>
int main(int /*argc*/, char ** /*argv*/)
{
using namespace pinocchio;
Model model;
pinocchio::buildModels::humanoid(model);
Model::VectorXs q = randomConfiguration(model);
Model::VectorXs v = Model::VectorXs::Random(model.nv);
Model::VectorXs a = Model::VectorXs::Random(model.nv);
Data data(model);
rnea(model,data,q,v,a);
return 0;
}
#
# Copyright (c) 2015-2018 CNRS
# Copyright (c) 2015-2020 CNRS INRIA
#
# --- MACROS ------------------------------------------------------------------
......@@ -16,10 +16,11 @@ MACRO(ADD_UTIL NAME UTIL_SRC PKGS)
FOREACH(PKG ${PKGS})
PKG_CONFIG_USE_DEPENDENCY(${NAME} ${PKG})
ENDFOREACH(PKG)
TARGET_LINK_LIBRARIES (${NAME} ${Boost_LIBRARIES} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES (${NAME} PUBLIC ${PROJECT_NAME})
IF(BUILD_PYTHON_INTERFACE)
TARGET_LINK_BOOST_PYTHON(${NAME})
TARGET_LINK_LIBRARIES(${NAME} ${PYTHON_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(${NAME} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_BOOST_PYTHON(${NAME} PUBLIC)
TARGET_LINK_LIBRARIES(${NAME} PUBLIC ${PYTHON_LIBRARIES})
ENDIF(BUILD_PYTHON_INTERFACE)
IF(HPP_FCL_FOUND)
......
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