1{ stdenv
2, lib
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, pkg-config
7, gfortran
8, texinfo
9, python3
10, boost
11 # Select SIMD alignment width (in bytes) for vectorization.
12, simdWidth ? 1
13 # Pad arrays to simdWidth by default?
14 # Note: Only useful if simdWidth > 1
15, enablePadding ? false
16 # Activate serialization through Boost.Serialize?
17, enableSerialization ? true
18 # Activate test-suite?
19 # WARNING: Some of the tests require up to 1700MB of memory to compile.
20, doCheck ? true
21}:
22
23let
24 inherit (lib) optional optionals;
25in
26stdenv.mkDerivation rec {
27 pname = "blitz++";
28 version = "1.0.2";
29
30 src = fetchFromGitHub {
31 owner = "blitzpp";
32 repo = "blitz";
33 rev = version;
34 hash = "sha256-wZDg+4lCd9iHvxuQQE/qs58NorkxZ0+mf+8PKQ57CDE=";
35 };
36
37 patches = [
38 # https://github.com/blitzpp/blitz/pull/180
39 (fetchpatch {
40 name = "use-cmake-install-full-dir.patch";
41 url = "https://github.com/blitzpp/blitz/commit/020f1d768c7fa3265cec244dc28f3dc8572719c5.patch";
42 hash = "sha256-8hYFNyWrejjIWPN/HzIOphD4Aq6Soe0FFUBmwV4tpWQ=";
43 })
44 ];
45
46 nativeBuildInputs = [
47 cmake
48 pkg-config
49 python3
50 texinfo
51 ];
52
53 buildInputs = [ gfortran texinfo boost ];
54
55 cmakeFlags = optional enablePadding "-DARRAY_LENGTH_PADDING=ON"
56 ++ optional enableSerialization "-DENABLE_SERIALISATION=ON"
57 ++ optional stdenv.is64bit "-DBZ_FULLY64BIT=ON";
58 # FIXME ++ optional doCheck "-DBUILD_TESTING=ON";
59
60 # skip broken library name detection
61 ax_boost_user_serialization_lib = lib.optionalString stdenv.isDarwin "boost_serialization";
62
63 enableParallelBuilding = true;
64
65 inherit doCheck;
66
67 meta = with lib; {
68 description = "Fast multi-dimensional array library for C++";
69 homepage = "https://sourceforge.net/projects/blitz/";
70 license = with licenses; [ artistic2 /* or */ bsd3 /* or */ lgpl3Plus ];
71 platforms = platforms.unix;
72 maintainers = with maintainers; [ ToxicFrog ];
73 longDescription = ''
74 Blitz++ is a C++ class library for scientific computing which provides
75 performance on par with Fortran 77/90. It uses template techniques to
76 achieve high performance. Blitz++ provides dense arrays and vectors,
77 random number generators, and small vectors (useful for representing
78 multicomponent or vector fields).
79 '';
80 };
81}