about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/math/itpp/default.nix
blob: cb45787e1403501f2c5787a84506bdd2e93b4ac8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ lib, stdenv
, fetchurl
, cmake
, gtest
, blas
, fftw
, liblapack
, gfortran
}:

stdenv.mkDerivation rec {
  pname = "it++";
  version = "4.3.1";

  src = fetchurl {
    url = "mirror://sourceforge/itpp/itpp-${version}.tar.bz2";
    sha256 = "0xxqag9wi0lg78xgw7b40rp6wxqp5grqlbs9z0ifvdfzqlhpcwah";
  };

  nativeBuildInputs = [ cmake gfortran ];
  buildInputs = [
    fftw
    liblapack

    # NOTE: OpenBLAS doesn't work here because IT++ doesn't pass aligned
    # buffers, which causes segfaults in the optimized kernels :-(
    blas
  ];

  cmakeFlags = [
    "-DCMAKE_CXX_FLAGS=-std=c++14"
    "-DBLAS_FOUND:BOOL=TRUE"
    "-DBLAS_LIBRARIES:STRING=${blas}/lib/libblas.so"
    "-DLAPACK_FOUND:BOOL=TRUE"
    "-DLAPACK_LIBRARIES:STRING=${liblapack}/lib/liblapack.so"
    "-DGTEST_DIR:PATH=${gtest.src}/googletest"
  ];

  doCheck = true;

  checkPhase = ''
    ./gtests/itpp_gtests
  '';

  meta = with lib; {
    description = "IT++ is a C++ library of mathematical, signal processing and communication classes and functions";
    mainProgram = "itpp-config";
    homepage = "https://itpp.sourceforge.net/";
    license = licenses.gpl3;
    platforms = platforms.unix;
    maintainers = with maintainers; [ andrew-d ];
    broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/itpp.x86_64-darwin
  };
}