Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support of recent versions of Boost for CppAD and CppADCodeGen #2000

Merged
merged 7 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
shell: bash -l {0}
run: |
conda activate pinocchio
mamba install cmake ccache llvm-openmp compilers=1.4.2 -c conda-forge
conda install cmake ccache llvm-openmp compilers=1.4.2 -c conda-forge
conda list

- name: Build Pinocchio
Expand All @@ -54,10 +54,6 @@ jobs:
mkdir build
cd build

export LINK_PYTHON_INTERFACE_TO_OPENMP=ON
if [ "$(uname)" == "Darwin" ]; then
export LINK_PYTHON_INTERFACE_TO_OPENMP=OFF
fi
cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_WITH_COLLISION_SUPPORT=ON -DBUILD_ADVANCED_TESTING=ON -DBUILD_WITH_CASADI_SUPPORT=OFF -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_WITH_OPENMP_SUPPORT=ON -DINSTALL_DOCUMENTATION=ON -DOpenMP_ROOT=$CONDA_PREFIX
make
make build_tests
Expand Down
6 changes: 3 additions & 3 deletions examples/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# Copyright (c) 2020 INRIA
# Copyright (c) 2020-2023 INRIA
#

IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT AND BUILD_WITH_URDF_SUPPORT)
INCLUDE_DIRECTORIES(SYSTEM ${cppadcg_INCLUDE_DIR})
ADD_PINOCCHIO_CPP_EXAMPLE(codegen-crba)
SET_PROPERTY(TARGET example-cpp-codegen-crba PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(example-cpp-codegen-crba PUBLIC ${CMAKE_DL_LIBS})
SET_PROPERTY(TARGET example-cpp-codegen-crba PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(example-cpp-codegen-crba PUBLIC ${CMAKE_DL_LIBS} ${cppad_LIBRARY})
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT AND BUILD_WITH_URDF_SUPPORT)

7 changes: 6 additions & 1 deletion src/autodiff/cppad.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2018-2020 CNRS INRIA
// Copyright (c) 2018-2023 CNRS INRIA
//

#ifndef __pinocchio_autodiff_cppad_hpp__
Expand Down Expand Up @@ -37,6 +37,11 @@ namespace boost
return ADScalar(constant_pi<Scalar>::get(n));
}

template <class T, T value>
static inline ADScalar get(const std::integral_constant<T, value> &n)
{
return ADScalar(constant_pi<Scalar>::get(n));
}
};
}
}
Expand Down
17 changes: 13 additions & 4 deletions src/codegen/cppadcg.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2018-2020 CNRS INRIA
// Copyright (c) 2018-2023 CNRS INRIA
//

#ifndef __pinocchio_codegen_ccpadcg_hpp__
Expand Down Expand Up @@ -36,6 +36,12 @@ namespace boost
{
return CGScalar(constant_pi<Scalar>::get(n));
}

template <class T, T value>
static inline CGScalar get(const std::integral_constant<T, value> &n)
{
return CGScalar(constant_pi<Scalar>::get(n));
}
};
}
}
Expand Down Expand Up @@ -63,11 +69,14 @@ namespace Eigen

namespace CppAD
{
template <class Scalar>
bool isfinite(const cg::CG<Scalar> & x) { return std::isfinite(x.getValue()); }

template <class Scalar>
bool isfinite(const AD<Scalar> & x) { return isfinite(Value(x)); }

namespace cg
{
template <class Scalar>
bool isfinite(const CG<Scalar> &x) { return std::isfinite(x.getValue()); }
}
}

namespace pinocchio
Expand Down