about summary refs log tree commit diff
path: root/pkgs/by-name/hp/hpp-fcl/package.nix
blob: 78ce6456c301cbe3a1a62e07c0ac0eaad79d57c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  doxygen,
  boost,
  eigen,
  assimp,
  octomap,
  qhull,
  pythonSupport ? false,
  python3Packages,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "hpp-fcl";
  version = "2.4.5";

  src = fetchFromGitHub {
    owner = "humanoid-path-planner";
    repo = "hpp-fcl";
    rev = "v${finalAttrs.version}";
    fetchSubmodules = true;
    hash = "sha256-0OORdtT7vMpvK3BPJvtvuLcz0+bfu1+nVvzs3y+LyQw=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    doxygen
  ] ++ lib.optionals pythonSupport [ python3Packages.numpy ];

  propagatedBuildInputs =
    [
      assimp
      qhull
      octomap
      zlib
    ]
    ++ lib.optionals (!pythonSupport) [
      boost
      eigen
    ]
    ++ lib.optionals pythonSupport [
      python3Packages.boost
      python3Packages.eigenpy
    ];

  cmakeFlags = [
    (lib.cmakeBool "HPP_FCL_HAS_QHULL" true)
    (lib.cmakeBool "INSTALL_DOCUMENTATION" true)
    (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
  ];

  doCheck = true;
  # pythonImportsCheck, but in stdenv.mkDerivation
  postInstall = lib.optionalString pythonSupport ''
    PYTHONPATH=$out/${python3Packages.python.sitePackages}:$PYTHONPATH
    python -c "import hppfcl"
  '';

  outputs = [
    "dev"
    "out"
    "doc"
  ];
  postFixup = ''
    moveToOutput share/ament_index "$dev"
    moveToOutput share/${finalAttrs.pname} "$dev"
  '';

  meta = {
    description = "Extension of the Flexible Collision Library";
    homepage = "https://github.com/humanoid-path-planner/hpp-fcl";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ nim65s ];
  };
})