1{ lib
2, stdenv
3, fetchurl
4, fetchFromGitHub
5
6, cmake
7, doxygen
8, zlib
9, python3Packages
10}:
11
12let
13 testdata = fetchFromGitHub {
14 owner = "BrunoLevy";
15 repo = "geogram.data";
16 rev = "8fd071a560bd6859508f1710981386d0b2ba01b1";
17 hash = "sha256-jMUGX6/uYIZMVwXxTAAGUaOXqF+NrFQqgmIPCD58cwM=";
18 };
19in
20stdenv.mkDerivation rec {
21 pname = "geogram";
22 version = "1.8.3";
23
24 src = fetchurl {
25 url = "https://github.com/BrunoLevy/geogram/releases/download/v${version}/geogram_${version}.tar.gz";
26 hash = "sha256-91q0M/4kAr0UoWXOQIEYS1VbgEQ/F4EBOfJE9Vr1bnw=";
27 };
28
29 outputs = [ "bin" "lib" "dev" "doc" "out" ];
30
31 cmakeFlags = [
32 # Triangle is unfree
33 "-DGEOGRAM_WITH_TRIANGLE=OFF"
34
35 # Disable some extra features (feel free to create a PR if you need one of those)
36
37 # If GEOGRAM_WITH_LEGACY_NUMERICS is enabled GeoGram will build its own version of
38 # ARPACK, CBLAS, CLAPACK, LIBF2C and SUPERLU
39 "-DGEOGRAM_WITH_LEGACY_NUMERICS=OFF"
40
41 # Don't build Lua
42 "-DGEOGRAM_WITH_LUA=OFF"
43
44 # Disable certain features requiring GLFW
45 "-DGEOGRAM_WITH_GRAPHICS=OFF"
46
47 # NOTE: Options introduced by patch (see below)
48 "-DGEOGRAM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake"
49 "-DGEOGRAM_INSTALL_PKGCONFIG_DIR=${placeholder "dev"}/lib/pkgconfig"
50 ];
51
52 nativeBuildInputs = [
53 cmake
54 doxygen
55 ];
56
57 buildInputs = [
58 zlib
59 ];
60
61 patches = [
62 # See https://github.com/BrunoLevy/geogram/pull/76
63 ./fix-cmake-install-destination.patch
64
65 # This patch replaces the bundled (outdated) zlib with our zlib
66 # Should be harmless, but if there are issues this patch can also be removed
67 # Also check https://github.com/BrunoLevy/geogram/issues/49 for progress
68 ./replace-bundled-zlib.patch
69 ];
70
71 postPatch = lib.optionalString stdenv.isAarch64 ''
72 substituteInPlace cmake/platforms/*/config.cmake \
73 --replace "-m64" ""
74 '';
75
76 postBuild = ''
77 make doc-devkit-full
78 '';
79
80 nativeCheckInputs = [
81 python3Packages.robotframework
82 ];
83
84 doCheck = true;
85
86 checkPhase =
87 let
88 skippedTests = [
89 # Failing tests as of version 1.8.3
90 "FileConvert"
91 "Reconstruct"
92 "Remesh"
93
94 # Skip slow RVD test
95 "RVD"
96 ];
97 in
98 ''
99 runHook preCheck
100
101 ln -s ${testdata} ../tests/data
102
103 source tests/testenv.sh
104 robot \
105 ${lib.concatMapStringsSep " " (t: lib.escapeShellArg "--skip=${t}") skippedTests} \
106 ../tests
107
108 runHook postCheck
109 '';
110
111 meta = with lib; {
112 description = "Programming Library with Geometric Algorithms";
113 longDescription = ''
114 Geogram contains the main results in Geometry Processing from the former ALICE Inria project,
115 that is, more than 30 research articles published in ACM SIGGRAPH, ACM Transactions on Graphics,
116 Symposium on Geometry Processing and Eurographics.
117 '';
118 homepage = "https://github.com/BrunoLevy/geogram";
119 license = licenses.bsd3;
120
121 # Broken on aarch64-linux as of version 1.8.3
122 # See https://github.com/BrunoLevy/geogram/issues/74
123 broken = stdenv.isLinux && stdenv.isAarch64;
124
125 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
126 maintainers = with maintainers; [ tmarkus ];
127 };
128}