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

Merge pull request #1218 from francois-keith/dev_clang_win32

Allows compiling with clang + Visual Studio 2019
parents 36d3aebc 6b8a3239
name: pinocchio
channels:
- conda-forge
- nodefaults
dependencies:
- eigen
- numpy
- boost
- eigenpy
- urdfdom
- python
name: C/C++ CI of Pinocchio
name: Test Pinocchio on Linux
on: [push,pull_request]
......
name: Build Pinocchio for Windows via Conda
on:
pull_request:
push:
branches:
- master
- devel
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [windows-latest-clang-cl]
include:
- name: windows-latest-clang-cl
os: windows-2019
compiler: clang-cl
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: pinocchio
environment-file: .github/workflows/conda-env.yml
python-version: 3.7
- name: Install cmake and update conda
run: |
conda install cmake -c main
- name: Build Pinocchio
shell: cmd /C CALL {0}
run: |
:: unset extra Boost envs
set Boost_ROOT=
set BOOST_ROOT_1_69_0=
set BOOST_ROOT_1_72_0=
set PATH=%PATH:C:\hostedtoolcache\windows\Boost\1.72.0;=%
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
:: start building
mkdir build
pushd build
set PKG_CONFIG_PATH=%CONDA_PREFIX%\Library\share\pkgconfig:%CONDA_PREFIX%\Library\share\pkgconfig
cmake ^
-G "Visual Studio 16 2019" -T "ClangCl" -DCMAKE_GENERATOR_PLATFORM=x64 ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DPINOCCHIO_SITELIB_ROOT=%CONDA_PREFIX% ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
-DBUILD_WITH_URDF_SUPPORT=ON -DBUILD_PYTHON_INTERFACE=ON ^
..
cmake --build . --config Release --target install
set PATH=%PATH%;%CONDA_PREFIX%\Library\lib;%CONDA_PREFIX%\Lib\site-packages\pinocchio
ctest --output-on-failure -C Release
......@@ -52,11 +52,8 @@ install:
- pip install --user numpy
script:
- export CMAKE_ADDITIONAL_OPTIONS="-DCMAKE_BUILD_TYPE=${BUILDTYPE} -DBUILD_WITH_COLLISION_SUPPORT=${BUILD_WITH_COLLISION_SUPPORT} -DBUILD_ADVANCED_TESTING=ON"
- sudo free -m -t
- export CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH
- travis_wait 60 ./.travis/run ../travis_custom/custom_build
after_failure: ./.travis/run after_failure
after_success:
- ./.travis/run after_success
#- export PYTHONPATH=$install_dir/lib/python2.7/site-packages
#- coveralls-lcov -v -n $build_dir/coverage.info > coverage.json
- export PYTHONPATH=$PYHTONPATH:/tmp/_ci/install/lib/python2.7/site-packages:/usr/lib/python2.7/dist-packages
......@@ -90,34 +90,36 @@ SET(PINOCCHIO_MODEL_DIR "${PROJECT_SOURCE_DIR}/models")
# ----------------------------------------------------
# --- DEPENDENCIES -----------------------------------
# ----------------------------------------------------
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.5")
# Variable containing all the cflags definition relative to optional dependencies
SET(CFLAGS_DEPENDENCIES)
IF(BUILD_WITH_URDF_SUPPORT)
ADD_REQUIRED_DEPENDENCY("urdfdom >= 0.2.0")
ADD_PROJECT_DEPENDENCY(urdfdom_headers)
ADD_PROJECT_DEPENDENCY(urdfdom PKG_CONFIG_REQUIRES "urdfdom >= 0.2.0")
SET(urdfdom_VERSION ${urdfdom_headers_VERSION})
ADD_DEFINITIONS(-DPINOCCHIO_WITH_URDFDOM)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_URDFDOM")
IF(${URDFDOM_VERSION} VERSION_GREATER "0.4.2")
IF(${urdfdom_VERSION} VERSION_GREATER "0.4.2")
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
MESSAGE(STATUS "Since urdfdom >= 1.0.0, the default C++ standard is C++11. The project is then compiled with C++11 standard.")
ENDIF(${URDFDOM_VERSION} VERSION_GREATER "0.4.2")
ENDIF(${urdfdom_VERSION} VERSION_GREATER "0.4.2")
ENDIF(BUILD_WITH_URDF_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
# Check first CppADCodeGen
IF(BUILD_WITH_CODEGEN_SUPPORT)
ADD_REQUIRED_DEPENDENCY("cppadcg >= 2.4.1") # CppADCodeGen 2.4.1 is the first version to check the minimal version of CppAD
ADD_PROJECT_DEPENDENCY(cppadcg 2.4.1 REQUIRED PKG_CONFIG_REQUIRES "cppadcg >= 2.4.1") # CppADCodeGen 2.4.1 is the first version to check the minimal version of CppAD
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(BUILD_WITH_CODEGEN_SUPPORT)
ADD_REQUIRED_DEPENDENCY("cppad >= 20180000.0")
ADD_PROJECT_DEPENDENCY(cppad 20180000.0 REQUIRED PKG_CONFIG_REQUIRES "cppad >= 20180000.0")
ADD_DEFINITIONS(-DPINOCCHIO_WITH_CPPAD_SUPPORT)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_WITH_CPPAD_SUPPORT")
IF(NOT ${EIGEN3_VERSION} VERSION_GREATER "3.3.0")
......@@ -127,13 +129,10 @@ IF(BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_CASADI_SUPPORT)
ADD_REQUIRED_DEPENDENCY("casadi >= 3.4.5")
ENDIF(BUILD_WITH_CASADI_SUPPORT)
IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ADD_PROJECT_DEPENDENCY(casadi 3.4.5 REQUIRED PKG_CONFIG_REQUIRES "casadi >= 3.4.5")
ADD_DEFINITIONS(-DPINOCCHIO_WITH_CASADI_SUPPORT)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_WITH_CASADI_SUPPORT")
ENDIF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ENDIF(BUILD_WITH_CASADI_SUPPORT)
SET(BOOST_REQUIRED_COMPONENTS filesystem serialization system)
SET(BOOST_BUILD_COMPONENTS unit_test_framework)
......@@ -142,12 +141,13 @@ SET(BOOST_OPTIONAL_COMPONENTS "")
IF(BUILD_PYTHON_INTERFACE)
SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
FINDPYTHON()
ADD_PROJECT_DEPENDENCY(eigenpy 2.2.0 REQUIRED)
ENDIF(BUILD_PYTHON_INTERFACE)
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.4.0")
ADD_PROJECT_DEPENDENCY(hpp-fcl 1.4.0 REQUIRED PKG_CONFIG_REQUIRES "hpp-fcl >= 1.4.0")
# Check whether hpp-fcl python bindings are available.
SET(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS FALSE)
IF(BUILD_PYTHON_INTERFACE)
......
#
# Copyright (c) 2015-2019 CNRS INRIA
# Copyright (c) 2015-2020 CNRS INRIA
#
# ----------------------------------------------------
# --- BENCHMARK --------------------------------------
# ----------------------------------------------------
IF(WIN32)
ADD_DEFINITIONS("-DNOMINMAX")
ENDIF()
ADD_CUSTOM_TARGET(bench)
MACRO(ADD_BENCH bench_name)
......@@ -20,16 +24,6 @@ MACRO(ADD_BENCH bench_name)
IF(link_to_main_lib)
SET_TARGET_PROPERTIES(${bench_name} PROPERTIES COMPILE_DEFINITIONS PINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")
TARGET_LINK_LIBRARIES(${bench_name} PUBLIC ${PROJECT_NAME})
PKG_CONFIG_USE_DEPENDENCY(${bench_name} eigen3)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${bench_name} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${bench_name} urdfdom)
ENDIF(URDFDOM_FOUND)
ENDIF(link_to_main_lib)
ENDIF()
......@@ -46,7 +40,7 @@ ADD_BENCH(timings TRUE)
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 PUBLIC cppadcg::cppadcg)
TARGET_LINK_LIBRARIES(timings-cg PUBLIC ${CMAKE_DL_LIBS})
ENDIF(CPPADCG_FOUND)
......@@ -58,17 +52,17 @@ ADD_BENCH(timings-cholesky TRUE)
ADD_BENCH(timings-derivatives TRUE)
IF(CPPAD_FOUND)
PKG_CONFIG_USE_DEPENDENCY(timings-derivatives "cppad")
TARGET_LINK_LIBRARIES(timings-derivatives PUBLIC cppad::cppad)
ENDIF(CPPAD_FOUND)
IF(CPPADCG_FOUND)
SET_PROPERTY(TARGET timings-derivatives PROPERTY CXX_STANDARD 11)
PKG_CONFIG_USE_DEPENDENCY(timings-derivatives "cppadcg")
TARGET_LINK_LIBRARIES(timings-derivatives PUBLIC cppadcg::cppadcg)
ENDIF(CPPADCG_FOUND)
# timings-eigen
#
ADD_BENCH(timings-eigen)
PKG_CONFIG_USE_DEPENDENCY(timings-eigen "eigen3")
TARGET_INCLUDE_DIRECTORIES(timings-eigen PUBLIC ${EIGEN3_INCLUDE_DIRS})
# timings-geometry
#
......
......@@ -27,31 +27,9 @@ FUNCTION(REMOVE_PATH_FROM_LIST list_name path_name dest_list)
SET(${dest_list} ${list_name_} PARENT_SCOPE)
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)
SET(PYWRAP ${PROJECT_NAME}_pywrap)
SET(PYWRAP ${PYWRAP} PARENT_SCOPE)
# --- DEPENDENCIES --- #
# The following quiet finding of Eigen is necessary to retrive
# the include directory when packaging Pinocchio in ROS
find_package(Eigen3 QUIET)
if (EIGEN3_FOUND)
include_directories(${EIGEN3_INCLUDE_DIR})
endif()
SET(PKG_CONFIG_PYWRAP_REQUIRES "eigenpy >= 2.2.0")
FOREACH(dep ${PKG_CONFIG_PYWRAP_REQUIRES})
ADD_COMPILE_DEPENDENCY(${dep})
ENDFOREACH(dep ${PKG_CONFIG_PYWRAP_REQUIRES})
# --- LIBRARY --- #
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
ENDIF(BUILD_PYTHON_INTERFACE)
SET(PYWRAP ${PROJECT_NAME}_pywrap)
SET(PYWRAP ${PYWRAP} PARENT_SCOPE)
FILE(GLOB_RECURSE ${PROJECT_NAME}_PYTHON_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
......@@ -112,6 +90,11 @@ SET(${PYWRAP}_SOURCES ${${PROJECT_NAME}_PYTHON_SOURCES})
SET(${PYWRAP}_HEADERS ${${PROJECT_NAME}_PYTHON_HEADERS})
IF(BUILD_PYTHON_INTERFACE)
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
ADD_CUSTOM_TARGET(python)
SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
SET(PKG_CONFIG_PYWRAP_REQUIRES "eigenpy >= 2.2.0")
ADD_LIBRARY(${PYWRAP} SHARED ${${PYWRAP}_SOURCES} ${${PYWRAP}_HEADERS})
ADD_DEPENDENCIES(python ${PYWRAP})
......@@ -128,33 +111,30 @@ IF(BUILD_PYTHON_INTERFACE)
ENDIF(BUILD_WITH_COMMIT_VERSION)
ADD_HEADER_GROUP(${PYWRAP}_HEADERS)
ADD_SOURCE_GROUP(${PYWRAP}_SOURCES)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} eigenpy)
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PROJECT_NAME} eigenpy::eigenpy)
TARGET_LINK_BOOST_PYTHON(${PYWRAP} PUBLIC)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
IF(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
TARGET_COMPILE_DEFINITIONS(${PYWRAP} PRIVATE -DPINOCCHIO_WITH_HPP_FCL_PYTHON_BINDINGS)
ENDIF(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
IF(CPPAD_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} "cppad")
ENDIF(CPPAD_FOUND)
IF(CPPADCG_FOUND)
SET_PROPERTY(TARGET ${PYWRAP} PROPERTY CXX_STANDARD 11)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} "cppadcg")
ENDIF(CPPADCG_FOUND)
IF(APPLE)
# We need to change the extension for Python bindings
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES SUFFIX ".so")
ENDIF(APPLE)
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bindings/python/${PROJECT_NAME}")
IF(WIN32)
TARGET_COMPILE_DEFINITIONS(${PYWRAP} PRIVATE -DNOMINMAX)
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PYTHON_LIBRARY})
ENDIF(WIN32)
IF(PINOCCHIO_SITELIB_ROOT)
SET(${PYWRAP}_INSTALL_DIR ${PINOCCHIO_SITELIB_ROOT}/${PYTHON_SITELIB}/${PROJECT_NAME})
ELSE()
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
ENDIF()
SET_TARGET_PROPERTIES(${PYWRAP}
PROPERTIES
PREFIX ""
SUFFIX ${PYTHON_EXT_SUFFIX}
OUTPUT_NAME "${PYWRAP}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bindings/python/${PROJECT_NAME}"
)
INSTALL(
TARGETS ${PYWRAP}
......
......@@ -9,6 +9,16 @@
#include <boost/python.hpp>
#if defined _WIN32
# ifdef pinocchio_pywrap_EXPORTS
# define PINOCCHIO_PYWRAP_DLLAPI __declspec(dllexport)
# else
# define PINOCCHIO_PYWRAP_DLLAPI __declspec(dllimport)
# endif // pinocchio_pywrap_EXPORTS
#else
# define PINOCCHIO_PYWRAP_DLLAPI
#endif // _WIN32
namespace pinocchio
{
namespace python
......@@ -24,6 +34,7 @@ namespace pinocchio
/// \returns The model constructed by the Python script.
///
// TODO: look inside the context of Python and find an occurence of object Model
PINOCCHIO_PYWRAP_DLLAPI
Model buildModel(const std::string & filename,
const std::string & var_name = "model",
bool verbose = false);
......
Subproject commit e715bf761e97dbcd704adecd03c28d8e195e7811
Subproject commit 9e21ae2222fdb51dccd1320bb7208f73259b0c73
......@@ -7,16 +7,6 @@ FUNCTION(ADD_PINOCCHIO_CPP_EXAMPLE EXAMPLE)
SET(EXAMPLE_NAME "example-cpp-${EXAMPLE_NAME}")
ADD_UNIT_TEST(${EXAMPLE_NAME} ${EXAMPLE})
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)
ENDIF(URDFDOM_FOUND)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
IF(CPPAD_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} "cppad")
ENDIF(CPPAD_FOUND)
ENDFUNCTION()
SET(${PROJECT_NAME}_EXAMPLES
......@@ -56,6 +46,10 @@ ENDIF(HPP_FCL_FOUND)
ADD_DEFINITIONS(-DPINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")
IF(WIN32)
ADD_DEFINITIONS("-DNOMINMAX -D_USE_MATH_DEFINES")
ENDIF(WIN32)
FOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
ADD_PINOCCHIO_CPP_EXAMPLE(${EXAMPLE})
ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
......
......@@ -5,6 +5,6 @@
IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT AND BUILD_WITH_URDF_SUPPORT)
ADD_PINOCCHIO_CPP_EXAMPLE(codegen-crba)
SET_PROPERTY(TARGET example-cpp-codegen-crba PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(example-cpp-codegen-crba ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES(example-cpp-codegen-crba PUBLIC ${CMAKE_DL_LIBS} cppadcg::cppadcg)
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT AND BUILD_WITH_URDF_SUPPORT)
......@@ -3,10 +3,6 @@
# Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
#
# ----------------------------------------------------
# --- C++ --------------------------------------------
# ----------------------------------------------------
IF(BUILD_WITH_URDF_SUPPORT)
SET(${PROJECT_NAME}_SOURCES
parsers/urdf/model.cpp
......@@ -17,49 +13,51 @@ ENDIF()
# 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})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
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} PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
# Special care of urdfdom version
IF(URDFDOM_FOUND)
IF(${URDFDOM_VERSION} VERSION_LESS "0.3.0")
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME)
ENDIF(${URDFDOM_VERSION} VERSION_LESS "0.3.0")
# defines types from version 0.4.0
IF(NOT ${URDFDOM_VERSION} VERSION_LESS "0.4.0")
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_TYPEDEF_SHARED_PTR)
ENDIF(NOT ${URDFDOM_VERSION} VERSION_LESS "0.4.0")
# std::shared_ptr appears from version 1.0.0
IF(${URDFDOM_VERSION} VERSION_GREATER "0.4.2")
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR)
ENDIF(${URDFDOM_VERSION} VERSION_GREATER "0.4.2")
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} urdfdom)
ENDIF(URDFDOM_FOUND)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
ADD_HEADER_GROUP(HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
INSTALL(TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
ENDIF(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})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
IF(BUILD_WITH_COMMIT_VERSION)
TAG_LIBRARY_VERSION(${PROJECT_NAME})
ENDIF(BUILD_WITH_COMMIT_VERSION)
IF(WIN32)
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DNOMINMAX)
ENDIF(WIN32)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
# Special care of urdfdom version
IF(urdfdom_FOUND)
IF(${urdfdom_VERSION} VERSION_LESS "0.3.0")
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME)
ENDIF(${urdfdom_VERSION} VERSION_LESS "0.3.0")
# defines types from version 0.4.0
IF(NOT ${urdfdom_VERSION} VERSION_LESS "0.4.0")
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_TYPEDEF_SHARED_PTR)
ENDIF(NOT ${urdfdom_VERSION} VERSION_LESS "0.4.0")
# std::shared_ptr appears from version 1.0.0
IF(${urdfdom_VERSION} VERSION_GREATER "0.4.2")
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR)
ENDIF(${urdfdom_VERSION} VERSION_GREATER "0.4.2")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${urdfdom_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${urdfdom_INCLUDE_DIRS})
ENDIF(urdfdom_FOUND)
IF(hpp-fcl_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC hpp-fcl::hpp-fcl)
ENDIF(hpp-fcl_FOUND)
ADD_HEADER_GROUP(HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
INSTALL(TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
......@@ -312,9 +312,9 @@ namespace pinocchio
PINOCCHIO_CHECK_INPUT_ARGUMENT(model.gravity.angular().isZero(), "The gravity must be a pure force vector, no angular part");
for(Eigen::DenseIndex k =0; k < jmodel.nv(); ++k)
{
MotionRef<typename ColsBlock::ColXpr> min(J_cols.col(k));
MotionRef<typename ColsBlock::ColXpr> mout(dAdq_cols.col(k));
mout.linear() += model.gravity.linear().cross(min.angular());
MotionRef<typename ColsBlock::ColXpr> m_in(J_cols.col(k));
MotionRef<typename ColsBlock::ColXpr> m_out(dAdq_cols.col(k));
m_out.linear() += model.gravity.linear().cross(m_in.angular());
}
}
......
......@@ -465,12 +465,12 @@ namespace pinocchio
const std::vector<int> & nvt = data.nvSubtree_fromRow;
Mat & v_ = PINOCCHIO_EIGEN_CONST_CAST(Mat,v);
const int last_col = std::min(col-1,model.nv-2); // You can start from nv-2 (no child in nv-1)
const int last_col = std::min<int>(col-1,model.nv-2); // You can start from nv-2 (no child in nv-1)
v_.tail(model.nv - col - 1).setZero();
v_[col] = 1.;
for( int k=last_col;k>=0;--k )
{
int nvt_max = std::min(col,nvt[(size_t)k]-1);
int nvt_max = std::min<int>(col,nvt[(size_t)k]-1);
v_[k] = -U.row(k).segment(k+1,nvt_max).dot(v_.segment(k+1,nvt_max));
}
......
......@@ -391,9 +391,9 @@ namespace pinocchio
PINOCCHIO_CHECK_INPUT_ARGUMENT(model.gravity.angular().isZero(), "The gravity must be a pure force vector, no angular part");
for(Eigen::DenseIndex k =0; k < jmodel.nv(); ++k)
{
MotionRef<typename ColsBlock::ColXpr> min(J_cols.col(k));
MotionRef<typename ColsBlock::ColXpr> mout(dAdq_cols.col(k));
mout.linear() += model.gravity.linear().cross(min.angular());
MotionRef<typename ColsBlock::ColXpr> m_in(J_cols.col(k));
MotionRef<typename ColsBlock::ColXpr> m_out(dAdq_cols.col(k));
m_out.linear() += model.gravity.linear().cross(m_in.angular());
}
}
......
......@@ -8,6 +8,12 @@
// Forward declaration of the main pinocchio namespace
namespace pinocchio {}
#ifdef _WIN32
#include <windows.h>
#undef far
#undef near
#endif
#include "pinocchio/macros.hpp"
#include "pinocchio/deprecation.hpp"
#include "pinocchio/warning.hpp"
......@@ -18,9 +24,12 @@ namespace pinocchio {}
#include "pinocchio/container/boost-container-limits.hpp"
// Import Eigen and all the required modules
#include <Eigen/Core>
#include "pinocchio/eigen-macros.hpp"
#ifdef PINOCCHIO_WITH_EIGEN_TENSOR_MODULE
#include <unsupported/Eigen/CXX11/Tensor>
#endif
#include "pinocchio/core/binary-op.hpp"
#include "pinocchio/core/unary-op.hpp"
......
......@@ -11,9 +11,7 @@
#define EIGEN_DEVICE_FUNC
#endif
#ifdef PINOCCHIO_WITH_EIGEN_TENSOR_MODULE
#include <unsupported/Eigen/CXX11/Tensor>
#else
#ifndef PINOCCHIO_WITH_EIGEN_TENSOR_MODULE
#if (__cplusplus <= 199711L && EIGEN_COMP_MSVC < 1900) || defined(__CUDACC__) || defined(EIGEN_AVOID_STL_ARRAY)
namespace Eigen {
template <typename T, std::size_t n>
......
......@@ -144,7 +144,7 @@ namespace pinocchio
{
if(lastChild[(Index)i] == -1) lastChild[(Index)i] = i;
const Index & parent = model.parents[(Index)i];
lastChild[parent] = std::max(lastChild[(Index)i],lastChild[parent]);
lastChild[parent] = std::max<int>(lastChild[(Index)i],lastChild[parent]);
nvSubtree[(Index)i]
= idx_v(model.joints[(Index)lastChild[(Index)i]]) + nv(model.joints[(Index)lastChild[(Index)i]])
......
......@@ -167,7 +167,7 @@ namespace pinocchio
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline void ModelTpl<Scalar,Options,JointCollectionTpl>::
appendBodyToJoint(const ModelTpl::JointIndex joint_index,
appendBodyToJoint(const typename ModelTpl::JointIndex joint_index,
const Inertia & Y,
const SE3 & body_placement)
{
......
......@@ -63,7 +63,7 @@ namespace pinocchio
* @param[in] type The type of objects that must be loaded ( can be VISUAL or COLLISION)
*
*/
void parseTreeForGeom(UrdfGeomVisitorBase& visitor,