about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/pagmo2/default.nix
blob: 4bbf6f77288f2f42b063f9926649a7aa95c14803 (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
{ fetchFromGitHub
, lib, stdenv
, cmake
, eigen
, nlopt
, ipopt
, boost
, tbb
 # tests pass but take 30+ minutes
, runTests ? false
}:

stdenv.mkDerivation rec {
  pname = "pagmo2";
  version = "2.19.0";

  src = fetchFromGitHub {
     owner = "esa";
     repo = "pagmo2";
     rev = "v${version}";
     sha256 = "sha256-z5kg2xKZ666EPK844yp+hi4iGisaIPme9xNdzsAEEjw=";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ eigen nlopt boost tbb ] ++ lib.optional (!stdenv.isDarwin) ipopt;

  cmakeFlags = [
    "-DPAGMO_BUILD_TESTS=${if runTests then "ON" else "OFF"}"
    "-DPAGMO_WITH_EIGEN3=yes"
    "-DPAGMO_WITH_NLOPT=yes"
    "-DNLOPT_LIBRARY=${nlopt}/lib/libnlopt${stdenv.hostPlatform.extensions.sharedLibrary}"
  ] ++ lib.optionals stdenv.isLinux [
    "-DPAGMO_WITH_IPOPT=yes"
    "-DCMAKE_CXX_FLAGS='-fuse-ld=gold'"
  ] ++ lib.optionals stdenv.isDarwin [
    # FIXME: fails ipopt test with Invalid_Option on darwin, so disable.
    "-DPAGMO_WITH_IPOPT=no"
    "-DLLVM_USE_LINKER=gold"
  ];

  doCheck = runTests;

  meta = with lib; {
    homepage = "https://esa.github.io/pagmo2/";
    description = "Scientific library for massively parallel optimization";
    license = licenses.gpl3Plus;
    platforms = platforms.unix;
    maintainers = [ maintainers.costrouc ];
  };
}