python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / libhwy / default.nix
blob43b2e93d8270ae10c2784d8ff25584462d2ca35c
1 { lib, stdenv, cmake, ninja, gtest, fetchpatch, fetchFromGitHub }:
3 stdenv.mkDerivation rec {
4   pname = "libhwy";
5   version = "0.15.0";
7   src = fetchFromGitHub {
8     owner = "google";
9     repo = "highway";
10     rev = version;
11     sha256 = "sha256-v2HyyHtBydr7QiI83DW1yRv2kWjUOGxFT6mmdrN9XPo=";
12   };
14   patches = [
15     # Remove on next release
16     # https://github.com/google/highway/issues/460
17     (fetchpatch {
18       name = "hwy-add-missing-includes.patch";
19       url = "https://github.com/google/highway/commit/8ccab40c2f931aca6004d175eec342cc60f6baec.patch";
20       sha256 = "sha256-wlp5gIvK2+OlKtsZwxq/pXTbESkUtimHXaYDjcBzmQ0=";
21     })
22   ];
24   nativeBuildInputs = [ cmake ninja ];
26   # Required for case-insensitive filesystems ("BUILD" exists)
27   dontUseCmakeBuildDir = true;
29   cmakeFlags = let
30     libExt = stdenv.hostPlatform.extensions.library;
31   in [
32     "-GNinja"
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}"
40   ];
42   # hydra's darwin machines run into https://github.com/libjxl/libjxl/issues/408
43   doCheck = !stdenv.hostPlatform.isDarwin;
45   meta = with lib; {
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 ];
51   };