nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 56 lines 1.8 kB view raw
1{ lib, stdenv, fetchFromGitHub, cmake, gtest }: 2let 3 version = "7.5.0"; 4 5 darwin_src = fetchFromGitHub { 6 owner = "xtensor-stack"; 7 repo = "xsimd"; 8 rev = version; 9 sha256 = "eGAdRSYhf7rbFdm8g1Tz1ZtSVu44yjH/loewblhv9Vs="; 10 # Avoid requiring apple_sdk. We're doing this here instead of in the patchPhase 11 # because this source is directly used in arrow-cpp. 12 # pyconfig.h defines _GNU_SOURCE to 1, so we need to stamp that out too. 13 # Upstream PR with a better fix: https://github.com/xtensor-stack/xsimd/pull/463 14 postFetch = '' 15 mkdir $out 16 tar -xf $downloadedFile --directory=$out --strip-components=1 17 substituteInPlace $out/include/xsimd/types/xsimd_scalar.hpp \ 18 --replace 'defined(__APPLE__)' 0 \ 19 --replace 'defined(_GNU_SOURCE)' 0 20 ''; 21 }; 22 23 src = fetchFromGitHub { 24 owner = "xtensor-stack"; 25 repo = "xsimd"; 26 rev = version; 27 sha256 = "0c9pq5vz43j99z83w3b9qylfi66mn749k1afpv5cwfxggbxvy63f"; 28 }; 29in stdenv.mkDerivation { 30 pname = "xsimd"; 31 inherit version; 32 src = if stdenv.hostPlatform.isDarwin then darwin_src else src; 33 34 nativeBuildInputs = [ cmake ]; 35 36 cmakeFlags = [ "-DBUILD_TESTS=ON" ]; 37 38 doCheck = true; 39 checkInputs = [ gtest ]; 40 checkTarget = "xtest"; 41 GTEST_FILTER = let 42 # Upstream Issue: https://github.com/xtensor-stack/xsimd/issues/456 43 filteredTests = lib.optionals stdenv.hostPlatform.isDarwin [ 44 "error_gamma_test/sse_double.gamma" 45 "error_gamma_test/avx_double.gamma" 46 ]; 47 in "-${builtins.concatStringsSep ":" filteredTests}"; 48 49 meta = with lib; { 50 description = "C++ wrappers for SIMD intrinsics"; 51 homepage = "https://github.com/xtensor-stack/xsimd"; 52 license = licenses.bsd3; 53 maintainers = with maintainers; [ tobim ]; 54 platforms = platforms.all; 55 }; 56}