From 49518d287b1f3221e6481e88192258f0a93cb690 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 17 Sep 2024 15:52:06 +0200 Subject: pinocchio: move to pkgs/by-name --- pkgs/by-name/pi/pinocchio/package.nix | 104 ++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 pkgs/by-name/pi/pinocchio/package.nix (limited to 'pkgs/by-name/pi/pinocchio/package.nix') diff --git a/pkgs/by-name/pi/pinocchio/package.nix b/pkgs/by-name/pi/pinocchio/package.nix new file mode 100644 index 000000000000..238ae8d46337 --- /dev/null +++ b/pkgs/by-name/pi/pinocchio/package.nix @@ -0,0 +1,104 @@ +{ lib +, stdenv +, fetchFromGitHub +, casadi +, cmake +, boost +, eigen +, example-robot-data +, casadiSupport ? true +, collisionSupport ? true +, console-bridge +, jrl-cmakemodules +, hpp-fcl +, urdfdom +, pythonSupport ? false +, python3Packages +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "pinocchio"; + version = "3.2.0"; + + src = fetchFromGitHub { + owner = "stack-of-tasks"; + repo = "pinocchio"; + rev = "v${finalAttrs.version}"; + hash = "sha256-8V+n1TwFojXKOVkGG8k9aXVadt2NBFlZKba93L+NRNU="; + }; + + # 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)" "" + ''; + + postPatch = '' + # example-robot-data models are used in checks. + # Upstream provide them as git submodule, but we can use our own version instead. + test -d models/example-robot-data && rmdir models/example-robot-data + ln -s ${example-robot-data.src} models/example-robot-data + + # allow package:// uri use in examples + export ROS_PACKAGE_PATH=${example-robot-data}/share + + # silence matplotlib warning + export MPLCONFIGDIR=$(mktemp -d) + ''; + + # 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 = [ + cmake + ] ++ lib.optionals pythonSupport [ + python3Packages.python + python3Packages.pythonImportsCheckHook + ]; + + propagatedBuildInputs = [ + console-bridge + jrl-cmakemodules + urdfdom + ] ++ lib.optionals (!pythonSupport) [ + boost + eigen + ] ++ lib.optionals (!pythonSupport && collisionSupport) [ + hpp-fcl + ] ++ lib.optionals pythonSupport [ + python3Packages.boost + python3Packages.eigenpy + ] ++ lib.optionals (pythonSupport && collisionSupport) [ + python3Packages.hpp-fcl + ] ++ lib.optionals (!pythonSupport && casadiSupport) [ + casadi + ] ++ lib.optionals (pythonSupport && casadiSupport) [ + python3Packages.casadi + ]; + + checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ]; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport) + (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport) + (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport) + (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport) + ]; + + doCheck = true; + pythonImportsCheck = [ "pinocchio" ]; + + meta = { + description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives"; + homepage = "https://github.com/stack-of-tasks/pinocchio"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ nim65s wegank ]; + platforms = lib.platforms.unix; + }; +}) -- cgit 1.4.1 From f048cdeba0b5112a95656e87979b168a8384d5c6 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 17 Sep 2024 15:52:22 +0200 Subject: pinocchio: format --- pkgs/by-name/pi/pinocchio/package.nix | 87 ++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'pkgs/by-name/pi/pinocchio/package.nix') diff --git a/pkgs/by-name/pi/pinocchio/package.nix b/pkgs/by-name/pi/pinocchio/package.nix index 238ae8d46337..ff1b5cf9572f 100644 --- a/pkgs/by-name/pi/pinocchio/package.nix +++ b/pkgs/by-name/pi/pinocchio/package.nix @@ -1,19 +1,20 @@ -{ lib -, stdenv -, fetchFromGitHub -, casadi -, cmake -, boost -, eigen -, example-robot-data -, casadiSupport ? true -, collisionSupport ? true -, console-bridge -, jrl-cmakemodules -, hpp-fcl -, urdfdom -, pythonSupport ? false -, python3Packages +{ + lib, + stdenv, + fetchFromGitHub, + casadi, + cmake, + boost, + eigen, + example-robot-data, + casadiSupport ? true, + collisionSupport ? true, + console-bridge, + jrl-cmakemodules, + hpp-fcl, + urdfdom, + pythonSupport ? false, + python3Packages, }: stdenv.mkDerivation (finalAttrs: { @@ -55,32 +56,31 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; - nativeBuildInputs = [ - cmake - ] ++ lib.optionals pythonSupport [ - python3Packages.python - python3Packages.pythonImportsCheckHook - ]; + nativeBuildInputs = + [ cmake ] + ++ lib.optionals pythonSupport [ + python3Packages.python + python3Packages.pythonImportsCheckHook + ]; - propagatedBuildInputs = [ - console-bridge - jrl-cmakemodules - urdfdom - ] ++ lib.optionals (!pythonSupport) [ - boost - eigen - ] ++ lib.optionals (!pythonSupport && collisionSupport) [ - hpp-fcl - ] ++ lib.optionals pythonSupport [ - python3Packages.boost - python3Packages.eigenpy - ] ++ lib.optionals (pythonSupport && collisionSupport) [ - python3Packages.hpp-fcl - ] ++ lib.optionals (!pythonSupport && casadiSupport) [ - casadi - ] ++ lib.optionals (pythonSupport && casadiSupport) [ - python3Packages.casadi - ]; + propagatedBuildInputs = + [ + console-bridge + jrl-cmakemodules + urdfdom + ] + ++ lib.optionals (!pythonSupport) [ + boost + eigen + ] + ++ lib.optionals (!pythonSupport && collisionSupport) [ hpp-fcl ] + ++ lib.optionals pythonSupport [ + python3Packages.boost + python3Packages.eigenpy + ] + ++ lib.optionals (pythonSupport && collisionSupport) [ python3Packages.hpp-fcl ] + ++ lib.optionals (!pythonSupport && casadiSupport) [ casadi ] + ++ lib.optionals (pythonSupport && casadiSupport) [ python3Packages.casadi ]; checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ]; @@ -98,7 +98,10 @@ stdenv.mkDerivation (finalAttrs: { description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives"; homepage = "https://github.com/stack-of-tasks/pinocchio"; license = lib.licenses.bsd2; - maintainers = with lib.maintainers; [ nim65s wegank ]; + maintainers = with lib.maintainers; [ + nim65s + wegank + ]; platforms = lib.platforms.unix; }; }) -- cgit 1.4.1 From da033dc206c64ba954d740f7f982db5028a19cfa Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Wed, 18 Sep 2024 12:20:46 +0200 Subject: pinocchio: build documentation --- pkgs/by-name/pi/pinocchio/package.nix | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'pkgs/by-name/pi/pinocchio/package.nix') diff --git a/pkgs/by-name/pi/pinocchio/package.nix b/pkgs/by-name/pi/pinocchio/package.nix index ff1b5cf9572f..e754078a3805 100644 --- a/pkgs/by-name/pi/pinocchio/package.nix +++ b/pkgs/by-name/pi/pinocchio/package.nix @@ -1,20 +1,22 @@ { - lib, - stdenv, - fetchFromGitHub, - casadi, - cmake, boost, - eigen, - example-robot-data, + casadi, casadiSupport ? true, + cmake, collisionSupport ? true, console-bridge, - jrl-cmakemodules, + doxygen, + eigen, + example-robot-data, + fetchFromGitHub, hpp-fcl, - urdfdom, + jrl-cmakemodules, + lib, + pkg-config, pythonSupport ? false, python3Packages, + stdenv, + urdfdom, }: stdenv.mkDerivation (finalAttrs: { @@ -28,6 +30,11 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-8V+n1TwFojXKOVkGG8k9aXVadt2NBFlZKba93L+NRNU="; }; + outputs = [ + "out" + "doc" + ]; + # 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 \ @@ -57,7 +64,11 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; nativeBuildInputs = - [ cmake ] + [ + cmake + doxygen + pkg-config + ] ++ lib.optionals pythonSupport [ python3Packages.python python3Packages.pythonImportsCheckHook @@ -89,6 +100,7 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport) (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport) (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport) + (lib.cmakeBool "INSTALL_DOCUMENTATION" true) ]; doCheck = true; -- cgit 1.4.1