2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, boost
|
|
|
|
, eigen
|
2024-05-15 15:35:15 +00:00
|
|
|
, example-robot-data
|
2023-08-22 20:05:09 +00:00
|
|
|
, collisionSupport ? !stdenv.isDarwin
|
2024-06-20 14:57:18 +00:00
|
|
|
, console-bridge
|
2024-05-15 15:35:15 +00:00
|
|
|
, jrl-cmakemodules
|
2023-08-22 20:05:09 +00:00
|
|
|
, 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";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "3.0.0";
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stack-of-tasks";
|
2024-07-27 06:49:29 +00:00
|
|
|
repo = "pinocchio";
|
2023-08-22 20:05:09 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-h4NzfS27+jWyHbegxF+pgN6JzJdVAoM16J6G/9uNJc4=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
prePatch = ''
|
|
|
|
# test failure, ref https://github.com/stack-of-tasks/pinocchio/issues/2304
|
|
|
|
substituteInPlace unittest/CMakeLists.txt \
|
|
|
|
--replace-fail "add_pinocchio_unit_test(contact-cholesky)" ""
|
|
|
|
'' + lib.optionalString (stdenv.isLinux && stdenv.isAarch64) ''
|
|
|
|
# test failure, ref https://github.com/stack-of-tasks/pinocchio/issues/2304
|
|
|
|
substituteInPlace unittest/CMakeLists.txt \
|
|
|
|
--replace-fail "add_pinocchio_unit_test(contact-models)" ""
|
|
|
|
# test failure, ref https://github.com/stack-of-tasks/pinocchio/issues/2277
|
2024-06-20 14:57:18 +00:00
|
|
|
substituteInPlace unittest/algorithm/utils/CMakeLists.txt \
|
|
|
|
--replace-fail "add_pinocchio_unit_test(force)" ""
|
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# example-robot-data models are used in checks.
|
|
|
|
# Upstream provide them as git submodule, but we can use our own version instead.
|
|
|
|
postPatch = ''
|
|
|
|
rmdir models/example-robot-data
|
|
|
|
ln -s ${example-robot-data.src} models/example-robot-data
|
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2024-06-20 14:57:18 +00:00
|
|
|
console-bridge
|
2024-05-15 15:35:15 +00:00
|
|
|
jrl-cmakemodules
|
2022-12-17 10:02:37 +00:00
|
|
|
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
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
(lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
|
|
|
|
(lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport)
|
|
|
|
(lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport)
|
2023-08-22 20:05:09 +00:00
|
|
|
] ++ lib.optionals (pythonSupport && stdenv.isDarwin) [
|
2024-01-25 14:12:00 +00:00
|
|
|
# AssertionError: '.' != '/tmp/nix-build-pinocchio-2.7.0.drv/sou[84 chars].dae'
|
2023-08-22 20:05:09 +00:00
|
|
|
"-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;test-py-bindings_geometry_model_urdf'"
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
pythonImportsCheck = lib.optionals (!pythonSupport) [
|
|
|
|
"pinocchio"
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives";
|
2022-12-17 10:02:37 +00:00
|
|
|
homepage = "https://github.com/stack-of-tasks/pinocchio";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = lib.licenses.bsd2;
|
|
|
|
maintainers = with lib.maintainers; [ nim65s wegank ];
|
|
|
|
platforms = lib.platforms.unix;
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
})
|