Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / xtensor / default.nix
blob7873da993fde9556afb13d09a4864a24f10af184
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cmake
5 , doctest
6 , enableAssertions ? false
7 , enableBoundChecks ? false # Broadcasts don't pass bound checks
8 , nlohmann_json
9 , xtl
10 # Although this dependency is of the same GitHub organization, xtensor don't
11 # support xsimd 11 yet, see:
12 # https://github.com/xtensor-stack/xtensor/issues/2721
13 , xsimd10
16 stdenv.mkDerivation (finalAttrs: {
17   pname = "xtensor";
18   version = "0.24.7";
20   src = fetchFromGitHub {
21     owner = "xtensor-stack";
22     repo = "xtensor";
23     rev = finalAttrs.version;
24     hash = "sha256-dVbpcBW+jK9nIl5efk5LdKdBm8CkaJWEZ0ZY7ZuApwk=";
25   };
27   nativeBuildInputs = [
28     cmake
29   ];
30   propagatedBuildInputs = [
31     nlohmann_json
32     xtl
33   ] ++ lib.optionals (!(stdenv.isAarch64 && stdenv.isLinux)) [
34     # xsimd support is broken on aarch64-linux, see:
35     # https://github.com/xtensor-stack/xsimd/issues/945
36     xsimd10
37   ];
39   cmakeFlags = let
40     cmakeBool = x: if x then "ON" else "OFF";
41   in [
42     "-DBUILD_TESTS=${cmakeBool finalAttrs.doCheck}"
43     "-DXTENSOR_ENABLE_ASSERT=${cmakeBool enableAssertions}"
44     "-DXTENSOR_CHECK_DIMENSION=${cmakeBool enableBoundChecks}"
45   ];
47   doCheck = true;
48   nativeCheckInputs = [
49     doctest
50   ];
51   checkTarget = "xtest";
53   meta = with lib; {
54     description = "Multi-dimensional arrays with broadcasting and lazy computing.";
55     homepage = "https://github.com/xtensor-stack/xtensor";
56     license = licenses.bsd3;
57     maintainers = with maintainers; [ cpcloud ];
58     platforms = platforms.all;
59   };