Unverified Commit 0ebcf660 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #325214 from nim65s/pin310

pinocchio: 3.0.0 -> 3.1.0
parents 50e8287d 901faa61
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, boost
, eigen
, example-robot-data
, collisionSupport ? !stdenv.isDarwin
, collisionSupport ? true
, console-bridge
, jrl-cmakemodules
, hpp-fcl
@@ -16,28 +17,30 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "pinocchio";
  version = "3.0.0";
  version = "3.1.0";

  src = fetchFromGitHub {
    owner = "stack-of-tasks";
    repo = "pinocchio";
    rev = "v${finalAttrs.version}";
    hash = "sha256-h4NzfS27+jWyHbegxF+pgN6JzJdVAoM16J6G/9uNJc4=";
    hash = "sha256-WgMqb+NHnaxW9/qSZ0UGI4zGxGjh12a5DwtdX9byBiw=";
  };

  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
  prePatch = lib.optionalString (stdenv.isLinux && stdenv.isAarch64) ''
    substituteInPlace unittest/algorithm/utils/CMakeLists.txt \
      --replace-fail "add_pinocchio_unit_test(force)" ""
  '';

  patches = [
    # fix urdf & collision support on aarch64-darwin
    (fetchpatch {
      name = "static-pointer_cast.patch";
      url = "https://github.com/stack-of-tasks/pinocchio/pull/2339/commits/ead869e8f3cce757851b9a011c4a2f55fb66582b.patch";
      hash = "sha256-CkrWQJP/pPNs6B3a1FclfM7JWwkmsPzRumS46KQHv0s=";
    })
  ];

  # example-robot-data models are used in checks.
  # Upstream provide them as git submodule, but we can use our own version instead.
  postPatch = ''
@@ -45,6 +48,13 @@ stdenv.mkDerivation (finalAttrs: {
    ln -s ${example-robot-data.src} models/example-robot-data
  '';

  # CMAKE_BUILD_TYPE defaults to Release in this package,
  # which enable -O3, which break some tests
  # ref. https://github.com/stack-of-tasks/pinocchio/issues/2304#issuecomment-2231018300
  postConfigure = ''
    substituteInPlace CMakeCache.txt --replace-fail '-O3' '-O2'
  '';

  strictDeps = true;

  nativeBuildInputs = [
@@ -71,9 +81,6 @@ stdenv.mkDerivation (finalAttrs: {
    (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
    (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport)
    (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport)
  ] ++ lib.optionals (pythonSupport && stdenv.isDarwin) [
    # AssertionError: '.' != '/tmp/nix-build-pinocchio-2.7.0.drv/sou[84 chars].dae'
    "-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;test-py-bindings_geometry_model_urdf'"
  ];

  doCheck = true;