summary refs log tree commit diff
path: root/pkgs/development/libraries/xsimd
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/development/libraries/xsimd
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/development/libraries/xsimd')
-rw-r--r--pkgs/development/libraries/xsimd/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/pkgs/development/libraries/xsimd/default.nix b/pkgs/development/libraries/xsimd/default.nix
new file mode 100644
index 00000000000..745ee9ee3fc
--- /dev/null
+++ b/pkgs/development/libraries/xsimd/default.nix
@@ -0,0 +1,56 @@
+{ lib, stdenv, fetchFromGitHub, cmake, gtest }:
+let
+  version = "7.5.0";
+
+  darwin_src = fetchFromGitHub {
+    owner = "xtensor-stack";
+    repo = "xsimd";
+    rev = version;
+    sha256 = "eGAdRSYhf7rbFdm8g1Tz1ZtSVu44yjH/loewblhv9Vs=";
+    # Avoid requiring apple_sdk. We're doing this here instead of in the patchPhase
+    # because this source is directly used in arrow-cpp.
+    # pyconfig.h defines _GNU_SOURCE to 1, so we need to stamp that out too.
+    # Upstream PR with a better fix: https://github.com/xtensor-stack/xsimd/pull/463
+    postFetch = ''
+      mkdir $out
+      tar -xf $downloadedFile --directory=$out --strip-components=1
+      substituteInPlace $out/include/xsimd/types/xsimd_scalar.hpp \
+        --replace 'defined(__APPLE__)' 0 \
+        --replace 'defined(_GNU_SOURCE)' 0
+    '';
+  };
+
+  src = fetchFromGitHub {
+    owner = "xtensor-stack";
+    repo = "xsimd";
+    rev = version;
+    sha256 = "0c9pq5vz43j99z83w3b9qylfi66mn749k1afpv5cwfxggbxvy63f";
+  };
+in stdenv.mkDerivation {
+  pname = "xsimd";
+  inherit version;
+  src = if stdenv.hostPlatform.isDarwin then darwin_src else src;
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [ "-DBUILD_TESTS=ON" ];
+
+  doCheck = true;
+  checkInputs = [ gtest ];
+  checkTarget = "xtest";
+  GTEST_FILTER = let
+      # Upstream Issue: https://github.com/xtensor-stack/xsimd/issues/456
+      filteredTests = lib.optionals stdenv.hostPlatform.isDarwin [
+        "error_gamma_test/sse_double.gamma"
+        "error_gamma_test/avx_double.gamma"
+      ];
+    in "-${builtins.concatStringsSep ":" filteredTests}";
+
+  meta = with lib; {
+    description = "C++ wrappers for SIMD intrinsics";
+    homepage = "https://github.com/xtensor-stack/xsimd";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ tobim ];
+    platforms = platforms.all;
+  };
+}