about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/openturns/default.nix
blob: 4c80c4b9ac81094203516d630afbfa8c1c245525 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, swig
, boost
, spectra
, libxml2
, tbb
, hmat-oss
, nlopt
, cminpack
, ceres-solver
, dlib
, hdf5
, primesieve
, pagmo2
, ipopt
, Accelerate
# tests take an hour to build on a 48-core machine
, runTests ? false
, enablePython ? false
, python3Packages
}:

stdenv.mkDerivation rec {
  pname = "openturns";
  version = "1.20";

  src = fetchFromGitHub {
    owner = "openturns";
    repo = "openturns";
    rev = "v${version}";
    sha256 = "sha256-QeapH937yGnK6oD+rgIERePxz6ooxGpOx6x9LyFDt2A=";
  };

  patches = [
    # Fix build with primesieve 11, https://github.com/openturns/openturns/pull/2187
    # Remove with next version update.
    (fetchpatch {
      url = "https://github.com/openturns/openturns/commit/a85061f89a5763061467beac516c1355fe81b9be.patch";
      hash = "sha256-z28ipBuX3b5UFEnKuDfp+kMI5cUcwXVz/8WZHlICnvE=";
    })
  ];

  nativeBuildInputs = [ cmake ] ++ lib.optional enablePython python3Packages.sphinx;
  buildInputs = [
    swig
    boost
    spectra
    libxml2
    tbb
    hmat-oss
    nlopt
    cminpack
    ceres-solver
    dlib
    hdf5
    primesieve
    pagmo2
    ipopt
  ] ++ lib.optionals enablePython [
    python3Packages.python
    python3Packages.matplotlib
    python3Packages.psutil
    python3Packages.dill
  ] ++ lib.optional stdenv.isDarwin Accelerate;

  cmakeFlags = [
    "-DOPENTURNS_SYSCONFIG_PATH=$out/etc"
    "-DCMAKE_UNITY_BUILD=ON"
    "-DCMAKE_UNITY_BUILD_BATCH_SIZE=32"
    "-DSWIG_COMPILE_FLAGS='-O1'"
    "-DUSE_SPHINX=${if enablePython then "ON" else "OFF"}"
    "-DBUILD_PYTHON=${if enablePython then "ON" else "OFF"}"
  ];

  doCheck = runTests;

  checkTarget = "tests check";

  meta = with lib; {
    description = "Multivariate probabilistic modeling and uncertainty treatment library";
    license = with licenses; [ lgpl3 gpl3 ];
    homepage = "https://openturns.github.io/www/";
    maintainers = with maintainers; [ gdinh ];
    platforms = platforms.unix;
  };
}