1{ lib, stdenv, fetchFromGitHub, cmake, gtest }:
2stdenv.mkDerivation rec {
3 pname = "xsimd";
4 version = "9.0.1";
5 src = fetchFromGitHub {
6 owner = "xtensor-stack";
7 repo = "xsimd";
8 rev = version;
9 sha256 = "sha256-onALN6agtrHWigtFlCeefD9CiRZI4Y690XTzy2UDnrk=";
10 };
11
12 nativeBuildInputs = [ cmake ];
13
14 cmakeFlags = [ "-DBUILD_TESTS=ON" ];
15
16 doCheck = true;
17 nativeCheckInputs = [ gtest ];
18 checkTarget = "xtest";
19 GTEST_FILTER =
20 let
21 # Upstream Issue: https://github.com/xtensor-stack/xsimd/issues/456
22 filteredTests = lib.optionals stdenv.hostPlatform.isDarwin [
23 "error_gamma_test/*"
24 ];
25 in
26 "-${builtins.concatStringsSep ":" filteredTests}";
27
28 # https://github.com/xtensor-stack/xsimd/issues/748
29 postPatch = ''
30 substituteInPlace xsimd.pc.in \
31 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
32 '';
33
34 meta = with lib; {
35 description = "C++ wrappers for SIMD intrinsics";
36 homepage = "https://github.com/xtensor-stack/xsimd";
37 license = licenses.bsd3;
38 maintainers = with maintainers; [ tobim ];
39 platforms = platforms.all;
40 };
41}