1{ lib
2, stdenv
3, fetchFromGitHub
4, wrapQtAppsHook
5, cmake
6, qhull
7, flann
8, boost
9, vtk
10, eigen
11, pkg-config
12, qtbase
13, libusb1
14, libpcap
15, libtiff
16, libXt
17, libpng
18, Cocoa
19, AGL
20, OpenGL
21, withCuda ? false, cudatoolkit
22}:
23
24stdenv.mkDerivation rec {
25 pname = "pcl";
26 version = "1.13.0";
27
28 src = fetchFromGitHub {
29 owner = "PointCloudLibrary";
30 repo = "pcl";
31 rev = "${pname}-${version}";
32 sha256 = "sha256-JDiDAmdpwUR3Sff63ehyvetIFXAgGOrI+HEaZ5lURps=";
33 };
34
35 # remove attempt to prevent (x86/x87-specific) extended precision use
36 # when SSE not detected
37 postPatch = lib.optionalString (!stdenv.hostPlatform.isx86) ''
38 sed -i '/-ffloat-store/d' cmake/pcl_find_sse.cmake
39 '';
40
41 nativeBuildInputs = [ pkg-config cmake wrapQtAppsHook ];
42 buildInputs = [
43 eigen
44 libusb1
45 libpcap
46 qtbase
47 libXt
48 ]
49 ++ lib.optionals stdenv.isDarwin [ Cocoa AGL ]
50 ++ lib.optionals withCuda [ cudatoolkit ];
51
52 propagatedBuildInputs = [
53 boost
54 flann
55 libpng
56 libtiff
57 qhull
58 vtk
59 ];
60
61 cmakeFlags = lib.optionals stdenv.isDarwin [
62 "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks"
63 ] ++ lib.optionals withCuda [ "-DWITH_CUDA=true" ];
64
65 meta = {
66 homepage = "https://pointclouds.org/";
67 description = "Open project for 2D/3D image and point cloud processing";
68 license = lib.licenses.bsd3;
69 maintainers = with lib.maintainers; [ viric ];
70 platforms = with lib.platforms; linux ++ darwin;
71 };
72}