depot/third_party/nixpkgs/pkgs/development/libraries/xsimd/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

60 lines
1.9 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, doctest
}:
stdenv.mkDerivation (finalAttrs: {
pname = "xsimd";
version = "11.2.0";
src = fetchFromGitHub {
owner = "xtensor-stack";
repo = "xsimd";
rev = finalAttrs.version;
sha256 = "sha256-CzgfxXGZXoJ56dX+mDPsHZC31YudrZXpX2tovh/Vjr0=";
};
patches = [
# Ideally, Accelerate/Accelerate.h should be used for this implementation,
# but it doesn't work... Needs a Darwin user to debug this. We apply this
# patch unconditionally, because the #if macros make sure it doesn't
# interfer with the Linux implementations.
./fix-darwin-exp10-implementation.patch
] ++ lib.optionals stdenv.isDarwin [
# https://github.com/xtensor-stack/xsimd/issues/807
./disable-test_error_gamma-test.patch
] ++ lib.optionals (stdenv.isDarwin || stdenv.hostPlatform.isMusl) [
# - Darwin report: https://github.com/xtensor-stack/xsimd/issues/917
# - Musl report: https://github.com/xtensor-stack/xsimd/issues/798
./disable-exp10-test.patch
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# https://github.com/xtensor-stack/xsimd/issues/798
./disable-polar-test.patch
] ++ lib.optionals stdenv.hostPlatform.isMusl [
# Fix suggested here: https://github.com/xtensor-stack/xsimd/issues/798#issuecomment-1356884601
# Upstream didn't merge that from some reason.
./fix-atan-test.patch
];
nativeBuildInputs = [
cmake
];
cmakeFlags = [
"-DBUILD_TESTS=${if (finalAttrs.finalPackage.doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
];
doCheck = true;
nativeCheckInputs = [
doctest
];
checkTarget = "xtest";
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;
};
})