commit
64b8d10a48
128
pkgs/development/libraries/geogram/default.nix
Normal file
128
pkgs/development/libraries/geogram/default.nix
Normal file
|
@ -0,0 +1,128 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, fetchFromGitHub
|
||||
|
||||
, cmake
|
||||
, doxygen
|
||||
, zlib
|
||||
, python3Packages
|
||||
}:
|
||||
|
||||
let
|
||||
testdata = fetchFromGitHub {
|
||||
owner = "BrunoLevy";
|
||||
repo = "geogram.data";
|
||||
rev = "8fd071a560bd6859508f1710981386d0b2ba01b1";
|
||||
hash = "sha256-jMUGX6/uYIZMVwXxTAAGUaOXqF+NrFQqgmIPCD58cwM=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "geogram";
|
||||
version = "1.8.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/BrunoLevy/geogram/releases/download/v${version}/geogram_${version}.tar.gz";
|
||||
hash = "sha256-91q0M/4kAr0UoWXOQIEYS1VbgEQ/F4EBOfJE9Vr1bnw=";
|
||||
};
|
||||
|
||||
outputs = [ "bin" "lib" "dev" "doc" "out" ];
|
||||
|
||||
cmakeFlags = [
|
||||
# Triangle is unfree
|
||||
"-DGEOGRAM_WITH_TRIANGLE=OFF"
|
||||
|
||||
# Disable some extra features (feel free to create a PR if you need one of those)
|
||||
|
||||
# If GEOGRAM_WITH_LEGACY_NUMERICS is enabled GeoGram will build its own version of
|
||||
# ARPACK, CBLAS, CLAPACK, LIBF2C and SUPERLU
|
||||
"-DGEOGRAM_WITH_LEGACY_NUMERICS=OFF"
|
||||
|
||||
# Don't build Lua
|
||||
"-DGEOGRAM_WITH_LUA=OFF"
|
||||
|
||||
# Disable certain features requiring GLFW
|
||||
"-DGEOGRAM_WITH_GRAPHICS=OFF"
|
||||
|
||||
# NOTE: Options introduced by patch (see below)
|
||||
"-DGEOGRAM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake"
|
||||
"-DGEOGRAM_INSTALL_PKGCONFIG_DIR=${placeholder "dev"}/lib/pkgconfig"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
doxygen
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
zlib
|
||||
];
|
||||
|
||||
patches = [
|
||||
# See https://github.com/BrunoLevy/geogram/pull/76
|
||||
./fix-cmake-install-destination.patch
|
||||
|
||||
# This patch replaces the bundled (outdated) zlib with our zlib
|
||||
# Should be harmless, but if there are issues this patch can also be removed
|
||||
# Also check https://github.com/BrunoLevy/geogram/issues/49 for progress
|
||||
./replace-bundled-zlib.patch
|
||||
];
|
||||
|
||||
postPatch = lib.optionalString stdenv.isAarch64 ''
|
||||
substituteInPlace cmake/platforms/*/config.cmake \
|
||||
--replace "-m64" ""
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
make doc-devkit-full
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
python3Packages.robotframework
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
checkPhase =
|
||||
let
|
||||
skippedTests = [
|
||||
# Failing tests as of version 1.8.3
|
||||
"FileConvert"
|
||||
"Reconstruct"
|
||||
"Remesh"
|
||||
|
||||
# Skip slow RVD test
|
||||
"RVD"
|
||||
];
|
||||
in
|
||||
''
|
||||
runHook preCheck
|
||||
|
||||
ln -s ${testdata} ../tests/data
|
||||
|
||||
source tests/testenv.sh
|
||||
robot \
|
||||
${lib.concatMapStringsSep " " (t: lib.escapeShellArg "--skip=${t}") skippedTests} \
|
||||
../tests
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Programming Library with Geometric Algorithms";
|
||||
longDescription = ''
|
||||
Geogram contains the main results in Geometry Processing from the former ALICE Inria project,
|
||||
that is, more than 30 research articles published in ACM SIGGRAPH, ACM Transactions on Graphics,
|
||||
Symposium on Geometry Processing and Eurographics.
|
||||
'';
|
||||
homepage = "https://github.com/BrunoLevy/geogram";
|
||||
license = licenses.bsd3;
|
||||
|
||||
# Broken on aarch64-linux as of version 1.8.3
|
||||
# See https://github.com/BrunoLevy/geogram/issues/74
|
||||
broken = stdenv.isLinux && stdenv.isAarch64;
|
||||
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
maintainers = with maintainers; [ tmarkus ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
--- a/cmake/utilities.cmake 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/cmake/utilities.cmake 2023-03-09 19:28:16.556251981 +0100
|
||||
@@ -241,9 +241,9 @@
|
||||
install(
|
||||
TARGETS ${ARGN}
|
||||
COMPONENT runtime
|
||||
- RUNTIME DESTINATION bin
|
||||
- LIBRARY DESTINATION lib
|
||||
- ARCHIVE DESTINATION lib
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
@@ -270,9 +270,9 @@
|
||||
install(
|
||||
TARGETS ${ARGN}
|
||||
COMPONENT ${component}
|
||||
- RUNTIME DESTINATION bin
|
||||
- LIBRARY DESTINATION lib
|
||||
- ARCHIVE DESTINATION lib
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
--- a/src/lib/geogram/CMakeLists.txt 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/src/lib/geogram/CMakeLists.txt 2023-03-09 20:29:12.346780432 +0100
|
||||
@@ -76,7 +76,7 @@
|
||||
# Install include files for the standard devkit
|
||||
install(
|
||||
DIRECTORY api
|
||||
- DESTINATION include/${VORPALINE_INCLUDE_SUBPATH}/geogram
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${VORPALINE_INCLUDE_SUBPATH}/geogram
|
||||
COMPONENT devkit
|
||||
FILES_MATCHING PATTERN *.h
|
||||
)
|
||||
@@ -84,7 +84,7 @@
|
||||
# Install include files for the full devkit
|
||||
install(
|
||||
DIRECTORY .
|
||||
- DESTINATION include/${VORPALINE_INCLUDE_SUBPATH}/geogram
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${VORPALINE_INCLUDE_SUBPATH}/geogram
|
||||
COMPONENT devkit-full
|
||||
FILES_MATCHING PATTERN *.h
|
||||
# Exclude all files related to licensing
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_BINARY_DIR}/geogram${VORPALINE_VERSION_MAJOR}.pc"
|
||||
- DESTINATION lib${LIB_SUFFIX}/pkgconfig
|
||||
+ DESTINATION ${GEOGRAM_INSTALL_PKGCONFIG_DIR}
|
||||
)
|
||||
|
||||
|
||||
--- a/CMakeLists.txt 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/CMakeLists.txt 2023-03-09 20:40:20.075218356 +0100
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
# FindGeogram.cmake
|
||||
|
||||
-install(FILES cmake/FindGeogram.cmake DESTINATION lib/cmake/modules COMPONENT devkit)
|
||||
+install(FILES cmake/FindGeogram.cmake DESTINATION ${GEOGRAM_INSTALL_CMAKE_DIR} COMPONENT devkit)
|
||||
|
||||
# Configure CPack
|
||||
|
||||
--- a/doc/CMakeLists.txt 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/doc/CMakeLists.txt 2023-03-09 21:12:04.386327003 +0100
|
||||
@@ -25,14 +25,14 @@
|
||||
|
||||
# Install documentation
|
||||
if(GEOGRAM_WITH_VORPALINE)
|
||||
- install(FILES README.txt DESTINATION doc COMPONENT runtime)
|
||||
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt DESTINATION doc COMPONENT runtime OPTIONAL)
|
||||
+ install(FILES README.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime)
|
||||
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime OPTIONAL)
|
||||
endif()
|
||||
|
||||
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION.txt DESTINATION doc/geogram COMPONENT runtime OPTIONAL)
|
||||
-
|
||||
- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devkit/html DESTINATION doc/devkit COMPONENT doc-devkit OPTIONAL)
|
||||
- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devkit-full/html DESTINATION doc/devkit COMPONENT doc-devkit-full OPTIONAL)
|
||||
- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devkit-internal/html DESTINATION doc/devkit COMPONENT doc-devkit-internal OPTIONAL)
|
||||
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION.txt DESTINATION ${CMAKE_INSTALL_DOCDIR}/geogram COMPONENT runtime OPTIONAL)
|
||||
+
|
||||
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devkit/html DESTINATION ${CMAKE_INSTALL_DOCDIR}/devkit COMPONENT doc-devkit OPTIONAL)
|
||||
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devkit-full/html DESTINATION ${CMAKE_INSTALL_DOCDIR}/devkit COMPONENT doc-devkit-full OPTIONAL)
|
||||
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devkit-internal/html DESTINATION ${CMAKE_INSTALL_DOCDIR}/devkit COMPONENT doc-devkit-internal OPTIONAL)
|
||||
|
||||
endif()
|
|
@ -0,0 +1,46 @@
|
|||
--- a/src/lib/geogram/third_party/CMakeLists.txt 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/src/lib/geogram/third_party/CMakeLists.txt 2023-03-09 20:46:16.740801862 +0100
|
||||
@@ -33,7 +33,6 @@
|
||||
aux_source_directories(SOURCES "Source Files\\LM6" LM7)
|
||||
aux_source_directories(SOURCES "Source Files\\rply" rply)
|
||||
aux_source_directories(SOURCES "Source Files\\shewchuk" shewchuk)
|
||||
-aux_source_directories(SOURCES "Source Files\\zlib" zlib)
|
||||
aux_source_directories(SOURCES "Source Files\\PoissonRecon" PoissonRecon)
|
||||
aux_source_directories(SOURCES "Source Files\\xatlas" xatlas)
|
||||
|
||||
--- a/src/lib/geogram/CMakeLists.txt 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/src/lib/geogram/CMakeLists.txt 2023-03-09 20:49:21.080059939 +0100
|
||||
@@ -70,6 +70,9 @@
|
||||
target_link_libraries(geogram psapi)
|
||||
endif()
|
||||
|
||||
+find_package(ZLIB REQUIRED)
|
||||
+target_link_libraries(geogram ZLIB::ZLIB)
|
||||
+
|
||||
# Install the library
|
||||
install_devkit_targets(geogram)
|
||||
|
||||
--- a/src/lib/geogram/basic/geofile.h 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/src/lib/geogram/basic/geofile.h 2023-03-09 20:52:33.713329571 +0100
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <geogram/basic/numeric.h>
|
||||
#include <geogram/basic/memory.h>
|
||||
#include <geogram/basic/string.h>
|
||||
-#include <geogram/third_party/zlib/zlib.h>
|
||||
+#include <zlib.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
--- a/src/lib/geogram/third_party/CMakeLists.txt 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/src/lib/geogram/third_party/CMakeLists.txt 2023-03-09 20:54:50.276520762 +0100
|
||||
@@ -60,8 +59,10 @@
|
||||
${ANDROID_NDK}/sources/android/native_app_glue
|
||||
)
|
||||
message(STATUS "building for Android")
|
||||
endif()
|
||||
|
||||
+find_package(ZLIB REQUIRED)
|
||||
+target_link_libraries(geogram_third_party PUBLIC ZLIB::ZLIB)
|
||||
|
||||
set_target_properties(
|
||||
geogram_third_party PROPERTIES
|
|
@ -20069,6 +20069,8 @@ with pkgs;
|
|||
geoipDatabase = geolite-legacy;
|
||||
};
|
||||
|
||||
geogram = callPackage ../development/libraries/geogram { };
|
||||
|
||||
geographiclib = callPackage ../development/libraries/geographiclib { };
|
||||
|
||||
geoip = callPackage ../development/libraries/geoip { };
|
||||
|
|
Loading…
Reference in a new issue