about summary refs log tree commit diff
path: root/pkgs/by-name/op/openturns/package.nix
blob: 152714133fa7aa5126daca25879dc0615bc61d9c (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
91
92
93
94
95
96
97
98
99
{
  lib,
  boost,
  ceres-solver,
  cmake,
  cminpack,
  darwin,
  dlib,
  fetchFromGitHub,
  fetchpatch,
  hdf5,
  hmat-oss,
  ipopt,
  libxml2,
  nlopt,
  pagmo2,
  primesieve,
  python3Packages,
  spectra,
  stdenv,
  swig,
  tbb,
  # Boolean flags
  runTests ? false, # tests take an hour to build on a 48-core machine
  enablePython ? false,
}:

let
  inherit (darwin.apple_sdk.frameworks) Accelerate;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "openturns";
  version = "1.22";

  src = fetchFromGitHub {
    owner = "openturns";
    repo = "openturns";
    rev = "v${finalAttrs.version}";
    hash = "sha256-ku3/mPoa1YJVJB99R/kWlOubIO+OZAiKfPqS/DrtJQk=";
  };

  nativeBuildInputs = [
    cmake
  ]
  ++ lib.optionals enablePython [ python3Packages.sphinx ];

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

  cmakeFlags = [
    (lib.cmakeBool "BUILD_PYTHON" enablePython)
    (lib.cmakeBool "CMAKE_UNITY_BUILD" true)
    (lib.cmakeBool "USE_SPHINX" enablePython)
    (lib.cmakeFeature "CMAKE_UNITY_BUILD_BATCH_SIZE" "32")
    (lib.cmakeFeature "SWIG_COMPILE_FLAGS" "-O1")
    (lib.cmakeOptionType "PATH" "OPENTURNS_SYSCONFIG_PATH" "$out/etc")
  ];

  checkTarget = lib.concatStringsSep " " [
    "tests"
    "check"
  ];

  strictDeps = true;

  doCheck = runTests;

  meta = {
    homepage = "https://openturns.github.io/www/";
    description = "Multivariate probabilistic modeling and uncertainty treatment library";
    changelog = "https://github.com/openturns/openturns/raw/v${finalAttrs.version}/ChangeLog";
    license = with lib.licenses; [ lgpl3Plus gpl3Plus ];
    maintainers = with lib.maintainers; [ gdinh ];
    platforms = lib.platforms.unix;
  };
})