1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 makeDesktopItem,
6 copyDesktopItems,
7 cmake,
8 boost,
9 cgal,
10 eigen,
11 flann,
12 gdal,
13 gmp,
14 laszip,
15 mpfr,
16 pcl,
17 libsForQt5,
18 tbb,
19 xercesc,
20 wrapGAppsHook3,
21}:
22
23stdenv.mkDerivation rec {
24 pname = "cloudcompare";
25 version = "2.13.2";
26
27 src = fetchFromGitHub {
28 owner = "CloudCompare";
29 repo = "CloudCompare";
30 rev = "v${version}";
31 hash = "sha256-a/0lf3Mt5ZpLFRM8jAoqZer8pY1ROgPRY4dPt34Bk3E=";
32 fetchSubmodules = true;
33 };
34
35 nativeBuildInputs = [
36 cmake
37 eigen # header-only
38 wrapGAppsHook3
39 copyDesktopItems
40 libsForQt5.wrapQtAppsHook
41 ];
42
43 buildInputs = [
44 boost
45 cgal
46 flann
47 gdal
48 gmp
49 laszip
50 mpfr
51 pcl
52 libsForQt5.qtbase
53 libsForQt5.qtsvg
54 libsForQt5.qttools
55 tbb
56 xercesc
57 ];
58
59 cmakeFlags = [
60 "-DCCCORELIB_USE_TBB=ON"
61 "-DOPTION_USE_DXF_LIB=ON"
62 "-DOPTION_USE_GDAL=ON"
63 "-DOPTION_USE_SHAPE_LIB=ON"
64
65 "-DPLUGIN_GL_QEDL=ON"
66 "-DPLUGIN_GL_QSSAO=ON"
67
68 "-DPLUGIN_IO_QADDITIONAL=ON"
69 "-DPLUGIN_IO_QCORE=ON"
70 "-DPLUGIN_IO_QCSV_MATRIX=ON"
71 "-DPLUGIN_IO_QE57=ON"
72 "-DPLUGIN_IO_QFBX=OFF" # Autodesk FBX SDK is gratis+proprietary; not packaged in nixpkgs
73 "-DPLUGIN_IO_QLAS=ON" # required for .las/.laz support
74 "-DPLUGIN_IO_QPHOTOSCAN=ON"
75 "-DPLUGIN_IO_QRDB=OFF" # Riegl rdblib is proprietary; not packaged in nixpkgs
76
77 "-DCCCORELIB_USE_CGAL=ON" # enables Delauney triangulation support
78 "-DPLUGIN_STANDARD_QPCL=ON" # Adds PCD import and export support
79 "-DPLUGIN_STANDARD_QANIMATION=ON"
80 "-DPLUGIN_STANDARD_QBROOM=ON"
81 "-DPLUGIN_STANDARD_QCANUPO=ON"
82 "-DPLUGIN_STANDARD_QCOMPASS=ON"
83 "-DPLUGIN_STANDARD_QCSF=ON"
84 "-DPLUGIN_STANDARD_QFACETS=ON"
85 "-DPLUGIN_STANDARD_QHOUGH_NORMALS=ON"
86 "-DEIGEN_ROOT_DIR=${eigen}/include/eigen3" # needed for hough normals
87 "-DPLUGIN_STANDARD_QHPR=ON"
88 "-DPLUGIN_STANDARD_QM3C2=ON"
89 "-DPLUGIN_STANDARD_QMPLANE=ON"
90 "-DPLUGIN_STANDARD_QPOISSON_RECON=ON"
91 "-DPLUGIN_STANDARD_QRANSAC_SD=OFF" # not compatible with GPL, broken on non-x86
92 "-DPLUGIN_STANDARD_QSRA=ON"
93 "-DPLUGIN_STANDARD_QCLOUDLAYERS=ON"
94 ];
95
96 dontWrapGApps = true;
97
98 postInstall = ''
99 install -Dm444 $src/qCC/images/icon/cc_icon_16.png $out/share/icons/hicolor/16x16/apps/CloudCompare.png
100 install -Dm444 $src/qCC/images/icon/cc_icon_32.png $out/share/icons/hicolor/32x32/apps/CloudCompare.png
101 install -Dm444 $src/qCC/images/icon/cc_icon_64.png $out/share/icons/hicolor/64x64/apps/CloudCompare.png
102 install -Dm444 $src/qCC/images/icon/cc_icon_256.png $out/share/icons/hicolor/256x256/apps/CloudCompare.png
103
104 install -Dm444 $src/qCC/images/icon/cc_viewer_icon_16.png $out/share/icons/hicolor/16x16/apps/ccViewer.png
105 install -Dm444 $src/qCC/images/icon/cc_viewer_icon_32.png $out/share/icons/hicolor/32x32/apps/ccViewer.png
106 install -Dm444 $src/qCC/images/icon/cc_viewer_icon_64.png $out/share/icons/hicolor/64x64/apps/ccViewer.png
107 install -Dm444 $src/qCC/images/icon/cc_viewer_icon_256.png $out/share/icons/hicolor/256x256/apps/ccViewer.png
108 '';
109
110 # fix file dialogs crashing on non-NixOS (and avoid double wrapping)
111 preFixup = ''
112 qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
113 '';
114
115 desktopItems = [
116 (makeDesktopItem {
117 name = "CloudCompare";
118 desktopName = "CloudCompare";
119 comment = "3D point cloud and mesh processing software";
120 exec = "CloudCompare";
121 terminal = false;
122 categories = [
123 "Graphics"
124 "3DGraphics"
125 "Viewer"
126 ];
127 keywords = [
128 "3d"
129 "processing"
130 ];
131 icon = "CloudCompare";
132 })
133 (makeDesktopItem {
134 name = "ccViewer";
135 desktopName = "CloudCompare Viewer";
136 comment = "3D point cloud and mesh processing software";
137 exec = "ccViewer";
138 terminal = false;
139 categories = [
140 "Graphics"
141 "3DGraphics"
142 "Viewer"
143 ];
144 keywords = [
145 "3d"
146 "viewer"
147 ];
148 icon = "ccViewer";
149 })
150 ];
151
152 meta = with lib; {
153 description = "3D point cloud and mesh processing software";
154 homepage = "https://cloudcompare.org";
155 license = licenses.gpl2Plus;
156 maintainers = with maintainers; [ nh2 ];
157 mainProgram = "CloudCompare";
158 platforms = with platforms; linux; # only tested here; might work on others
159 };
160}