evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / pi / pinocchio / package.nix
blob7284be49df7caedc15082ce12054bb515e5f4754
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   hpp-fcl,
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.2.0";
26   src = fetchFromGitHub {
27     owner = "stack-of-tasks";
28     repo = "pinocchio";
29     rev = "v${finalAttrs.version}";
30     hash = "sha256-8V+n1TwFojXKOVkGG8k9aXVadt2NBFlZKba93L+NRNU=";
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   # CMAKE_BUILD_TYPE defaults to Release in this package,
58   # which enable -O3, which break some tests
59   # ref. https://github.com/stack-of-tasks/pinocchio/issues/2304#issuecomment-2231018300
60   postConfigure = ''
61     substituteInPlace CMakeCache.txt --replace-fail '-O3' '-O2'
62   '';
64   strictDeps = true;
66   nativeBuildInputs =
67     [
68       cmake
69       doxygen
70       pkg-config
71     ]
72     ++ lib.optionals pythonSupport [
73       python3Packages.python
74       python3Packages.pythonImportsCheckHook
75     ];
77   propagatedBuildInputs =
78     [
79       console-bridge
80       jrl-cmakemodules
81       urdfdom
82     ]
83     ++ lib.optionals (!pythonSupport) [
84       boost
85       eigen
86     ]
87     ++ lib.optionals (!pythonSupport && collisionSupport) [ hpp-fcl ]
88     ++ lib.optionals pythonSupport [
89       python3Packages.boost
90       python3Packages.eigenpy
91     ]
92     ++ lib.optionals (pythonSupport && collisionSupport) [ python3Packages.hpp-fcl ]
93     ++ lib.optionals (!pythonSupport && casadiSupport) [ casadi ]
94     ++ lib.optionals (pythonSupport && casadiSupport) [ python3Packages.casadi ];
96   checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ];
98   cmakeFlags = [
99     (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
100     (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport)
101     (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport)
102     (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport)
103     (lib.cmakeBool "INSTALL_DOCUMENTATION" true)
104   ];
106   doCheck = true;
107   pythonImportsCheck = [ "pinocchio" ];
109   meta = {
110     description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives";
111     homepage = "https://github.com/stack-of-tasks/pinocchio";
112     license = lib.licenses.bsd2;
113     maintainers = with lib.maintainers; [
114       nim65s
115       wegank
116     ];
117     platforms = lib.platforms.unix;
118   };