Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / openturns / default.nix
blobe20499b9206c0f928ac7d6c0eb416f9ce9482a44
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , swig
7 , boost
8 , spectra
9 , libxml2
10 , tbb
11 , hmat-oss
12 , nlopt
13 , cminpack
14 , ceres-solver
15 , dlib
16 , hdf5
17 , primesieve
18 , pagmo2
19 , ipopt
20 , Accelerate
21 # tests take an hour to build on a 48-core machine
22 , runTests ? false
23 , enablePython ? false
24 , python3Packages
27 stdenv.mkDerivation rec {
28   pname = "openturns";
29   version = "1.21.1";
31   src = fetchFromGitHub {
32     owner = "openturns";
33     repo = "openturns";
34     rev = "v${version}";
35     sha256 = "sha256-Lg42QqsHYFxeUjZjYFVJFxeJv2MzOpjoShfbIg/095A=";
36   };
38   nativeBuildInputs = [ cmake ] ++ lib.optional enablePython python3Packages.sphinx;
39   buildInputs = [
40     swig
41     boost
42     spectra
43     libxml2
44     tbb
45     hmat-oss
46     nlopt
47     cminpack
48     ceres-solver
49     dlib
50     hdf5
51     primesieve
52     pagmo2
53     ipopt
54   ] ++ lib.optionals enablePython [
55     python3Packages.python
56     python3Packages.matplotlib
57     python3Packages.psutil
58     python3Packages.dill
59   ] ++ lib.optional stdenv.isDarwin Accelerate;
61   cmakeFlags = [
62     "-DOPENTURNS_SYSCONFIG_PATH=$out/etc"
63     "-DCMAKE_UNITY_BUILD=ON"
64     "-DCMAKE_UNITY_BUILD_BATCH_SIZE=32"
65     "-DSWIG_COMPILE_FLAGS='-O1'"
66     "-DUSE_SPHINX=${if enablePython then "ON" else "OFF"}"
67     "-DBUILD_PYTHON=${if enablePython then "ON" else "OFF"}"
68   ];
70   doCheck = runTests;
72   checkTarget = "tests check";
74   meta = with lib; {
75     description = "Multivariate probabilistic modeling and uncertainty treatment library";
76     license = with licenses; [ lgpl3 gpl3 ];
77     homepage = "https://openturns.github.io/www/";
78     changelog = "https://github.com/openturns/openturns/raw/v${version}/ChangeLog";
79     maintainers = with maintainers; [ gdinh ];
80     platforms = platforms.unix;
81   };