about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/itk
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-12-01 19:00:09 +0100
committerAlyssa Ross <hi@alyssa.is>2023-12-01 19:00:09 +0100
commit9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d (patch)
tree4368f9e4cb2d5b93a956c085337e45cb70f1e331 /nixpkgs/pkgs/development/libraries/itk
parenta9cbfb6941b47d6f50129e6e36927882392daed7 (diff)
parent2344fe1da14cb08b0c18743b207995f9b8597915 (diff)
downloadnixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.gz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.bz2
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.lz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.xz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.zst
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.zip
Merge https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/itk')
-rw-r--r--nixpkgs/pkgs/development/libraries/itk/generic.nix43
1 files changed, 32 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/libraries/itk/generic.nix b/nixpkgs/pkgs/development/libraries/itk/generic.nix
index 3a6b2afee0d9..e2db993707e2 100644
--- a/nixpkgs/pkgs/development/libraries/itk/generic.nix
+++ b/nixpkgs/pkgs/development/libraries/itk/generic.nix
@@ -1,7 +1,8 @@
 { version, rev, sourceSha256 }:
 
-{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper
-, pkg-config, libX11, libuuid, xz, vtk, Cocoa }:
+{ lib, stdenv, fetchFromGitHub, cmake
+, expat, fftw, gdcm, hdf5-cpp, libjpeg, libminc, libtiff, libpng
+, libX11, libuuid, xz, vtk, zlib, Cocoa }:
 
 let
   itkGenericLabelInterpolatorSrc = fetchFromGitHub {
@@ -41,8 +42,6 @@ stdenv.mkDerivation {
     substituteInPlace CMake/ITKSetStandardCompilerFlags.cmake  \
       --replace "-march=corei7" ""  \
       --replace "-mtune=native" ""
-    substituteInPlace Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in  \
-      --replace "@OPENJPEG_INSTALL_LIB_DIR@" "@OPENJPEG_INSTALL_FULL_LIB_DIR@"
     ln -sr ${itkGenericLabelInterpolatorSrc} Modules/External/ITKGenericLabelInterpolator
     ln -sr ${itkAdaptiveDenoisingSrc} Modules/External/ITKAdaptiveDenoising
     ln -sr ${itkSimpleITKFiltersSrc} Modules/External/ITKSimpleITKFilters
@@ -52,6 +51,15 @@ stdenv.mkDerivation {
     "-DBUILD_EXAMPLES=OFF"
     "-DBUILD_SHARED_LIBS=ON"
     "-DITK_FORBID_DOWNLOADS=ON"
+    "-DITK_USE_SYSTEM_LIBRARIES=ON"  # finds common libraries e.g. hdf5, libpng, libtiff, zlib, but not GDCM, NIFTI, MINC, etc.
+    # note ITK_USE_SYSTEM_EIGEN, part of ITK_USE_SYSTEM_LIBRARIES,
+    # causes "...-itk-5.2.1/include/ITK-5.2/itkSymmetricEigenAnalysis.h:23:31: fatal error: Eigen/Eigenvalues: No such file or directory"
+    # when compiling c3d, but maybe an ITK 5.2/eigen version issue:
+    "-DITK_USE_SYSTEM_EIGEN=OFF"
+    "-DITK_USE_SYSTEM_GOOGLETEST=OFF"  # ANTs build failure due to https://github.com/ANTsX/ANTs/issues/1489
+    "-DITK_USE_SYSTEM_GDCM=ON"
+    "-DITK_USE_SYSTEM_MINC=ON"
+    "-DLIBMINC_DIR=${libminc}/lib/cmake"
     "-DModule_ITKMINC=ON"
     "-DModule_ITKIOMINC=ON"
     "-DModule_ITKIOTransformMINC=ON"
@@ -63,8 +71,12 @@ stdenv.mkDerivation {
     "-DModule_GenericLabelInterpolator=ON"
   ];
 
-  nativeBuildInputs = [ cmake xz makeWrapper ];
-  buildInputs = [ libX11 libuuid vtk ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
+  nativeBuildInputs = [ cmake xz ];
+  buildInputs = [
+    libX11
+    libuuid
+    vtk
+  ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
   # Due to ITKVtkGlue=ON and the additional dependencies needed to configure VTK 9
   # (specifically libGL and libX11 on Linux),
   # it's now seemingly necessary for packages that configure ITK to
@@ -72,11 +84,20 @@ stdenv.mkDerivation {
   # These deps were propagated from VTK 9 in https://github.com/NixOS/nixpkgs/pull/206935,
   # so we simply propagate them again from ITK.
   # This admittedly is a hack and seems like an issue with VTK 9's CMake configuration.
-  propagatedBuildInputs = vtk.propagatedBuildInputs;
-
-  postInstall = ''
-    wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkg-config}/bin"
-  '';
+  propagatedBuildInputs = [
+    # The dependencies we've un-vendored from ITK, such as GDCM, must be propagated,
+    # otherwise other software built against ITK fails to configure since ITK headers
+    # refer to these previously vendored libraries:
+    expat
+    fftw
+    gdcm
+    hdf5-cpp
+    libjpeg
+    libminc
+    libpng
+    libtiff
+    zlib
+  ] ++ vtk.propagatedBuildInputs;
 
   meta = {
     description = "Insight Segmentation and Registration Toolkit";