diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/xtensor')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/xtensor/default.nix | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/nixpkgs/pkgs/development/libraries/xtensor/default.nix b/nixpkgs/pkgs/development/libraries/xtensor/default.nix index 45c1ce936a6e..7873da993fde 100644 --- a/nixpkgs/pkgs/development/libraries/xtensor/default.nix +++ b/nixpkgs/pkgs/development/libraries/xtensor/default.nix @@ -2,36 +2,54 @@ , stdenv , fetchFromGitHub , cmake -, gtest -, xsimd +, doctest +, enableAssertions ? false +, enableBoundChecks ? false # Broadcasts don't pass bound checks +, nlohmann_json , xtl +# Although this dependency is of the same GitHub organization, xtensor don't +# support xsimd 11 yet, see: +# https://github.com/xtensor-stack/xtensor/issues/2721 +, xsimd10 }: -stdenv.mkDerivation rec { + +stdenv.mkDerivation (finalAttrs: { pname = "xtensor"; - version = "0.23.10"; + version = "0.24.7"; src = fetchFromGitHub { owner = "xtensor-stack"; repo = "xtensor"; - rev = version; - sha256 = "1ayrhyh9x33b87ic01b4jzxc8x27yxpxzya5x54ikazvz8p71n14"; + rev = finalAttrs.version; + hash = "sha256-dVbpcBW+jK9nIl5efk5LdKdBm8CkaJWEZ0ZY7ZuApwk="; }; - nativeBuildInputs = [ cmake ]; - propagatedBuildInputs = [ xtl xsimd ]; + nativeBuildInputs = [ + cmake + ]; + propagatedBuildInputs = [ + nlohmann_json + xtl + ] ++ lib.optionals (!(stdenv.isAarch64 && stdenv.isLinux)) [ + # xsimd support is broken on aarch64-linux, see: + # https://github.com/xtensor-stack/xsimd/issues/945 + xsimd10 + ]; - cmakeFlags = [ "-DBUILD_TESTS=ON" ]; + cmakeFlags = let + cmakeBool = x: if x then "ON" else "OFF"; + in [ + "-DBUILD_TESTS=${cmakeBool finalAttrs.doCheck}" + "-DXTENSOR_ENABLE_ASSERT=${cmakeBool enableAssertions}" + "-DXTENSOR_CHECK_DIMENSION=${cmakeBool enableBoundChecks}" + ]; doCheck = true; - nativeCheckInputs = [ gtest ]; + nativeCheckInputs = [ + doctest + ]; checkTarget = "xtest"; - # https://github.com/xtensor-stack/xtensor/issues/2542 - postPatch = '' - substituteInPlace xtensor.pc.in \ - --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ - ''; - meta = with lib; { description = "Multi-dimensional arrays with broadcasting and lazy computing."; homepage = "https://github.com/xtensor-stack/xtensor"; @@ -39,4 +57,4 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ cpcloud ]; platforms = platforms.all; }; -} +}) |