2023-08-10 07:59:29 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, doctest
|
|
|
|
}:
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-09-09 14:08:57 +00:00
|
|
|
pname = "xsimd";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "12.1.1";
|
2021-05-03 20:48:10 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xtensor-stack";
|
|
|
|
repo = "xsimd";
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-ofUFieeRtpnzNv3Ad5oYwKWb2XcqQHoj601TIhydJyI=";
|
2021-05-03 20:48:10 +00:00
|
|
|
};
|
2023-08-10 07:59:29 +00:00
|
|
|
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
|
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
cmakeFlags = [
|
2024-01-02 11:29:13 +00:00
|
|
|
"-DBUILD_TESTS=${if (finalAttrs.finalPackage.doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
|
2023-08-10 07:59:29 +00:00
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
2023-08-10 07:59:29 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
doctest
|
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
checkTarget = "xtest";
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "C++ wrappers for SIMD intrinsics";
|
|
|
|
homepage = "https://github.com/xtensor-stack/xsimd";
|
|
|
|
license = licenses.bsd3;
|
2024-01-25 14:12:00 +00:00
|
|
|
maintainers = with maintainers; [ tobim doronbehar ];
|
2021-05-03 20:48:10 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|