1 { cmake, cudatoolkit, fetchFromGitHub, gfortran, lib, llvmPackages, python3Packages, stdenv, targetPlatform
4 , enableExamples ? true
5 , enableFortran ? builtins.elem targetPlatform.system gfortran.meta.platforms
8 , enableUtilities ? true }:
10 stdenv.mkDerivation rec {
14 src = fetchFromGitHub {
18 sha256 = "19ycflz35qsrzfcvxdyy0mgbykfghfi9y5v684jb4awjp7nf562c";
21 nativeBuildInputs = [ cmake ];
23 buildInputs = lib.optional enableCuda cudatoolkit
24 ++ lib.optional enableFortran gfortran
25 ++ lib.optional enableOpenMP llvmPackages.openmp
26 ++ lib.optionals enablePython (with python3Packages; [ cython numpy python ]);
29 # More tests not enabled by default
30 ''-DZFP_BINARY_DIR=${placeholder "out"}''
31 ''-DZFP_BUILD_TESTING_LARGE=ON''
33 ++ lib.optionals targetPlatform.isDarwin [
34 "-DCMAKE_INSTALL_BINDIR=bin"
35 "-DCMAKE_INSTALL_LIBDIR=lib"
37 ++ lib.optional enableCfp "-DBUILD_CFP=ON"
38 ++ lib.optional enableCuda "-DZFP_WITH_CUDA=ON"
39 ++ lib.optional enableExamples "-DBUILD_EXAMPLES=ON"
40 ++ lib.optional enableFortran "-DBUILD_ZFORP=ON"
41 ++ lib.optional enableOpenMP "-DZFP_WITH_OPENMP=ON"
42 ++ lib.optional enablePython "-DBUILD_ZFPY=ON"
43 ++ ([ "-DBUILD_UTILITIES=${if enableUtilities then "ON" else "OFF"}" ]);
45 preCheck = lib.optional targetPlatform.isDarwin ''
46 export DYLD_LIBRARY_PATH="$out/lib:$DYLD_LIBRARY_PATH"
52 homepage = "https://computing.llnl.gov/projects/zfp";
53 description = "Library for random-access compression of floating-point arrays";
54 license = licenses.bsd3;
55 maintainers = [ maintainers.spease ];
57 platforms = platforms.aarch64 ++ platforms.x86_64;