2022-12-17 10:02:37 +00:00
|
|
|
{ lib, stdenv, cmake, ninja, gtest, fetchFromGitHub }:
|
2022-01-26 04:04:25 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libhwy";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "1.0.2";
|
2022-01-26 04:04:25 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "highway";
|
|
|
|
rev = version;
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-CHzDLzOnu/QfejWiRKE9I5UUyRxoEooNtYVe8FQwu7c=";
|
2022-01-26 04:04:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
|
|
|
|
|
|
|
# Required for case-insensitive filesystems ("BUILD" exists)
|
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
cmakeFlags = let
|
2022-12-17 10:02:37 +00:00
|
|
|
libExt = stdenv.hostPlatform.extensions.sharedLibrary;
|
2022-09-09 14:08:57 +00:00
|
|
|
in [
|
2022-01-26 04:04:25 +00:00
|
|
|
"-GNinja"
|
|
|
|
"-DCMAKE_INSTALL_LIBDIR=lib"
|
|
|
|
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
2022-09-09 14:08:57 +00:00
|
|
|
] ++ lib.optionals doCheck [
|
|
|
|
"-DHWY_SYSTEM_GTEST:BOOL=ON"
|
|
|
|
"-DGTEST_INCLUDE_DIR=${lib.getDev gtest}/include"
|
|
|
|
"-DGTEST_LIBRARY=${lib.getLib gtest}/lib/libgtest${libExt}"
|
|
|
|
"-DGTEST_MAIN_LIBRARY=${lib.getLib gtest}/lib/libgtest_main${libExt}"
|
2022-12-17 10:02:37 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isAarch32 [
|
|
|
|
"-DHWY_CMAKE_ARM7=ON"
|
2022-09-09 14:08:57 +00:00
|
|
|
];
|
2022-01-26 04:04:25 +00:00
|
|
|
|
|
|
|
# hydra's darwin machines run into https://github.com/libjxl/libjxl/issues/408
|
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Performance-portable, length-agnostic SIMD with runtime dispatch";
|
|
|
|
homepage = "https://github.com/google/highway";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ zhaofengli ];
|
|
|
|
};
|
|
|
|
}
|