summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pc/pcl/package.nix
blob: 2b326ed73ff78950973b0873f71025331c3a61a5 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
  lib,
  stdenv,
  config,
  fetchFromGitHub,
  fetchpatch,

  # nativeBuildInputs
  cmake,
  qt6,
  pkg-config,

  # buildInputs
  eigen,
  libxt,
  libpcap,
  libusb1,
  llvmPackages,
  nanoflann,

  # nativeBuildInputs
  boost,
  flann,
  libpng,
  libtiff,
  qhull,
  vtk,

  gitUpdater,

  cudaSupport ? config.cudaSupport,
  cudaPackages,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "pcl";
  version = "1.15.1";

  src = fetchFromGitHub {
    owner = "PointCloudLibrary";
    repo = "pcl";
    tag = "pcl-${finalAttrs.version}";
    hash = "sha256-+KyaajJM0I5CAcr8AiOLC4TkGV3Gm73a0/X8LQWFZMI=";
  };

  patches = [
    (fetchpatch {
      # see https://github.com/NixOS/nixpkgs/issues/485826 to be removed at next release after 1.15.1
      name = "boost-1.89.patch";
      url = "https://github.com/PointCloudLibrary/pcl/commit/99333442ac63971297b4cdd05fab9d2bd2ff57a4.patch";
      hash = "sha256-5vg8VjxoAfEOx9n7Tby1DXe1u4rn+zharkefUovLHv0=";
    })
  ];

  strictDeps = true;

  # remove attempt to prevent (x86/x87-specific) extended precision use
  # when SSE not detected
  postPatch = lib.optionalString (!stdenv.hostPlatform.isx86) ''
    sed -i '/-ffloat-store/d' cmake/pcl_find_sse.cmake
  '';

  nativeBuildInputs = [
    cmake
    qt6.wrapQtAppsHook
    pkg-config
  ]
  ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ];

  buildInputs = [
    eigen
    libxt
    libpcap
    qt6.qtbase
    libusb1
    nanoflann
  ]
  ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];

  propagatedBuildInputs = [
    boost
    flann
    libpng
    libtiff
    qhull
    vtk
  ];

  cmakeFlags = [
    (lib.cmakeBool "BUILD_CUDA" cudaSupport)
    (lib.cmakeBool "BUILD_GPU" cudaSupport)
    (lib.cmakeBool "PCL_ENABLE_MARCHNATIVE" false)
    (lib.cmakeBool "WITH_CUDA" cudaSupport)
  ];

  passthru.updateScript = gitUpdater {
    rev-prefix = "pcl-";
    ignoredVersions = "rc";
  };

  meta = {
    homepage = "https://pointclouds.org/";
    description = "Open project for 2D/3D image and point cloud processing";
    changelog = "https://github.com/PointCloudLibrary/pcl/blob/pcl-${finalAttrs.version}/CHANGES.md";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      GaetanLepage
      usertam
    ];
    platforms = with lib.platforms; linux ++ darwin;
  };
})