python313Packages.publicsuffixlist: 1.0.2.20250122 -> 1.0.2.20250124 (#376319)
[NixPkgs.git] / pkgs / by-name / pi / pinocchio / package.nix
blob47d4cde8e6f026e692d2f3dbe41314e4f37b2b1c
2   boost,
3   casadi,
4   casadiSupport ? true,
5   cmake,
6   collisionSupport ? true,
7   console-bridge,
8   doxygen,
9   eigen,
10   example-robot-data,
11   fetchFromGitHub,
12   coal,
13   jrl-cmakemodules,
14   lib,
15   pkg-config,
16   pythonSupport ? false,
17   python3Packages,
18   stdenv,
19   urdfdom,
22 stdenv.mkDerivation (finalAttrs: {
23   pname = "pinocchio";
24   version = "3.3.1";
26   src = fetchFromGitHub {
27     owner = "stack-of-tasks";
28     repo = "pinocchio";
29     rev = "v${finalAttrs.version}";
30     hash = "sha256-dm5xfYAnn5N/8ZKTMyZNFM5/j3LLBrG+NOgmtxCAI6I=";
31   };
33   outputs = [
34     "out"
35     "doc"
36   ];
38   # test failure, ref https://github.com/stack-of-tasks/pinocchio/issues/2277
39   prePatch = lib.optionalString (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) ''
40     substituteInPlace unittest/algorithm/utils/CMakeLists.txt \
41       --replace-fail "add_pinocchio_unit_test(force)" ""
42   '';
44   postPatch = ''
45     # example-robot-data models are used in checks.
46     # Upstream provide them as git submodule, but we can use our own version instead.
47     test -d models/example-robot-data && rmdir models/example-robot-data
48     ln -s ${example-robot-data.src} models/example-robot-data
50     # allow package:// uri use in examples
51     export ROS_PACKAGE_PATH=${example-robot-data}/share
53     # silence matplotlib warning
54     export MPLCONFIGDIR=$(mktemp -d)
55   '';
57   strictDeps = true;
59   nativeBuildInputs =
60     [
61       cmake
62       doxygen
63       pkg-config
64     ]
65     ++ lib.optionals pythonSupport [
66       python3Packages.python
67       python3Packages.pythonImportsCheckHook
68     ];
70   propagatedBuildInputs =
71     [
72       console-bridge
73       jrl-cmakemodules
74       urdfdom
75     ]
76     ++ lib.optionals (!pythonSupport) [
77       boost
78       eigen
79     ]
80     ++ lib.optionals (!pythonSupport && collisionSupport) [ coal ]
81     ++ lib.optionals pythonSupport [
82       python3Packages.boost
83       python3Packages.eigenpy
84     ]
85     ++ lib.optionals (pythonSupport && collisionSupport) [ python3Packages.coal ]
86     ++ lib.optionals (!pythonSupport && casadiSupport) [ casadi ]
87     ++ lib.optionals (pythonSupport && casadiSupport) [ python3Packages.casadi ];
89   checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ];
91   cmakeFlags =
92     [
93       (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
94       (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport)
95       (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport)
96       (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport)
97       (lib.cmakeBool "INSTALL_DOCUMENTATION" true)
98       # Disable test that fails on darwin
99       # https://github.com/stack-of-tasks/pinocchio/blob/42306ed023b301aafef91e2e76cb070c5e9c3f7d/flake.nix#L24C1-L27C17
100     ]
101     ++ lib.optionals stdenv.hostPlatform.isDarwin [
102       (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;pinocchio-example-py-casadi-quadrotor-ocp")
103     ];
105   doCheck = true;
106   pythonImportsCheck = [ "pinocchio" ];
108   meta = {
109     description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives";
110     homepage = "https://github.com/stack-of-tasks/pinocchio";
111     license = lib.licenses.bsd2;
112     maintainers = with lib.maintainers; [
113       nim65s
114       wegank
115     ];
116     platforms = lib.platforms.unix;
117   };