summary refs log tree commit diff
path: root/pkgs/development/libraries/numcpp/default.nix
blob: 56713f2a6a5ee0342d05a17f48fe04de788c2f54 (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  boost,
  python3,
  gtest,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "numcpp";
  version = "2.11.0";

  src = fetchFromGitHub {
    owner = "dpilger26";
    repo = "NumCpp";
    rev = "Version_${finalAttrs.version}";
    hash = "sha256-IAku1bcaMkawZxpQbvxcS6VX07ogw4UGo1DX2Wa8xwU=";
  };

  nativeCheckInputs = [gtest python3];

  nativeBuildInputs = [cmake];

  buildInputs = [boost];

  cmakeFlags = lib.optionals finalAttrs.finalPackage.doCheck [
    "-DBUILD_TESTS=ON"
    "-DBUILD_MULTIPLE_TEST=ON"
  ];

  doCheck = !stdenv.isDarwin && !stdenv.hostPlatform.isStatic;

  postInstall = ''
    substituteInPlace $out/share/NumCpp/cmake/NumCppConfig.cmake \
      --replace "\''${PACKAGE_PREFIX_DIR}/" ""
  '';

  NIX_CFLAGS_COMPILE="-Wno-error";

  meta = with lib; {
    description = "A Templatized Header Only C++ Implementation of the Python NumPy Library";
    homepage = "https://github.com/dpilger26/NumCpp";
    license = licenses.mit;
    maintainers = with maintainers; [spalf];
    platforms = platforms.unix;
  };
})