Skip to content

Commit

Permalink
vtk: add vtk-dicom module
Browse files Browse the repository at this point in the history
  • Loading branch information
kurnevsky committed Jun 5, 2024
1 parent 57610d2 commit 39911da
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions pkgs/development/libraries/vtk/generic.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{ majorVersion, minorVersion, sourceSha256, patchesToFetch ? [] }:
{ stdenv, lib, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, libpng, libtiff
, fetchpatch
{ stdenv, lib, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, libpng, libtiff, gdcm
, fetchFromGitHub, fetchpatch
, enableQt ? false, qtx11extras, qttools, qtdeclarative, qtEnv
, enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given."
, enableVtkDicom ? true
# Darwin support
, AGL, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT, OpenGL
, ApplicationServices, CoreText, IOSurface, ImageIO, xpc, libobjc
Expand All @@ -23,6 +24,18 @@ in stdenv.mkDerivation {
sha256 = sourceSha256;
};

preConfigure = let
vtk-dicom = fetchFromGitHub {
owner = "dgobbi";
repo = "vtk-dicom";
rev = "v0.8.15";
sha256 = "sha256-1q9d95wrmAfVXsdvtdMb8CPsPgvnarQWFrxqiE+QxnE=";
};
in ''
cp -r ${vtk-dicom} ./Remote/vtkDICOM
chmod -R +w ./Remote/vtkDICOM
'';

nativeBuildInputs = [ cmake ];

buildInputs = [ libpng libtiff ]
Expand All @@ -48,6 +61,8 @@ in stdenv.mkDerivation {
GLUT
] ++ optionals enablePython [
python
] ++ optionals enableVtkDicom [
(gdcm.override { enableVTK = false; })
];
propagatedBuildInputs = optionals stdenv.isDarwin [ libobjc ]
++ optionals stdenv.isLinux [ libX11 libGL ];
Expand Down Expand Up @@ -93,6 +108,12 @@ in stdenv.mkDerivation {
++ optionals enablePython [
"-DVTK_WRAP_PYTHON:BOOL=ON"
"-DVTK_PYTHON_VERSION:STRING=${pythonMajor}"
]
++ optionals enableVtkDicom [
"-DVTK_ENABLE_REMOTE_MODULES=YES"
# Allows to read compressed dicom files:
# https://dgobbi.github.io/vtk-dicom/doc/api/installation.html
"-DUSE_GDCM=ON"
];

env = lib.optionalAttrs stdenv.cc.isClang {
Expand Down

0 comments on commit 39911da

Please sign in to comment.