1 { lib, stdenv, cmake, ninja, gtest, fetchpatch, fetchFromGitHub }:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
11 sha256 = "sha256-v2HyyHtBydr7QiI83DW1yRv2kWjUOGxFT6mmdrN9XPo=";
15 # Remove on next release
16 # https://github.com/google/highway/issues/460
18 name = "hwy-add-missing-includes.patch";
19 url = "https://github.com/google/highway/commit/8ccab40c2f931aca6004d175eec342cc60f6baec.patch";
20 sha256 = "sha256-wlp5gIvK2+OlKtsZwxq/pXTbESkUtimHXaYDjcBzmQ0=";
24 nativeBuildInputs = [ cmake ninja ];
26 # Required for case-insensitive filesystems ("BUILD" exists)
27 dontUseCmakeBuildDir = true;
30 libExt = stdenv.hostPlatform.extensions.library;
33 "-DCMAKE_INSTALL_LIBDIR=lib"
34 "-DCMAKE_INSTALL_INCLUDEDIR=include"
35 ] ++ lib.optionals doCheck [
36 "-DHWY_SYSTEM_GTEST:BOOL=ON"
37 "-DGTEST_INCLUDE_DIR=${lib.getDev gtest}/include"
38 "-DGTEST_LIBRARY=${lib.getLib gtest}/lib/libgtest${libExt}"
39 "-DGTEST_MAIN_LIBRARY=${lib.getLib gtest}/lib/libgtest_main${libExt}"
42 # hydra's darwin machines run into https://github.com/libjxl/libjxl/issues/408
43 doCheck = !stdenv.hostPlatform.isDarwin;
46 description = "Performance-portable, length-agnostic SIMD with runtime dispatch";
47 homepage = "https://github.com/google/highway";
48 license = licenses.asl20;
49 platforms = platforms.unix;
50 maintainers = with maintainers; [ zhaofengli ];