2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, boost
|
|
|
|
, eigen
|
2023-08-22 20:05:09 +00:00
|
|
|
, collisionSupport ? !stdenv.isDarwin
|
|
|
|
, hpp-fcl
|
2022-12-17 10:02:37 +00:00
|
|
|
, urdfdom
|
|
|
|
, pythonSupport ? false
|
|
|
|
, python3Packages
|
|
|
|
}:
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-12-17 10:02:37 +00:00
|
|
|
pname = "pinocchio";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "2.6.20";
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stack-of-tasks";
|
2023-08-22 20:05:09 +00:00
|
|
|
repo = finalAttrs.pname;
|
|
|
|
rev = "v${finalAttrs.version}";
|
2022-12-17 10:02:37 +00:00
|
|
|
fetchSubmodules = true;
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-Pu/trCpqdue7sQKDbLhyxTfgj/+xRiVcG7Luz6ZQXtM=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# error: use of undeclared identifier '__sincos'
|
|
|
|
postPatch = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
|
|
|
substituteInPlace src/math/sincos.hpp \
|
|
|
|
--replace "__APPLE__" "0"
|
|
|
|
'';
|
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
urdfdom
|
|
|
|
] ++ lib.optionals (!pythonSupport) [
|
|
|
|
boost
|
|
|
|
eigen
|
2023-08-22 20:05:09 +00:00
|
|
|
] ++ lib.optionals (!pythonSupport && collisionSupport) [
|
|
|
|
hpp-fcl
|
2022-12-17 10:02:37 +00:00
|
|
|
] ++ lib.optionals pythonSupport [
|
|
|
|
python3Packages.boost
|
|
|
|
python3Packages.eigenpy
|
2023-08-22 20:05:09 +00:00
|
|
|
] ++ lib.optionals (pythonSupport && collisionSupport) [
|
|
|
|
python3Packages.hpp-fcl
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
cmakeFlags = lib.optionals collisionSupport [
|
|
|
|
"-DBUILD_WITH_COLLISION_SUPPORT=ON"
|
|
|
|
] ++ lib.optionals pythonSupport [
|
|
|
|
"-DBUILD_WITH_LIBPYTHON=ON"
|
|
|
|
] ++ lib.optionals (pythonSupport && stdenv.isDarwin) [
|
|
|
|
# AssertionError: '.' != '/tmp/nix-build-pinocchio-2.6.20.drv/sou[84 chars].dae'
|
|
|
|
"-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;test-py-bindings_geometry_model_urdf'"
|
|
|
|
] ++ lib.optionals (!pythonSupport) [
|
2022-12-17 10:02:37 +00:00
|
|
|
"-DBUILD_PYTHON_INTERFACE=OFF"
|
|
|
|
];
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
pythonImportsCheck = lib.optionals (!pythonSupport) [
|
|
|
|
"pinocchio"
|
|
|
|
];
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives";
|
|
|
|
homepage = "https://github.com/stack-of-tasks/pinocchio";
|
|
|
|
license = licenses.bsd2;
|
2023-08-22 20:05:09 +00:00
|
|
|
maintainers = with maintainers; [ nim65s wegank ];
|
2022-12-17 10:02:37 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
})
|