libhwy: fix tests when cross-compiling

It seems to need some help to find gtest when cross compiling.

(Only applies when cross-compiling to compatible architectures where
the tests are enabled, like pkgsStatic.)

Co-authored-by: Daniel Olsen <daniel.olsen99@gmail.com>

+9 -4
+9 -4
pkgs/development/libraries/libhwy/default.nix
··· 23 23 24 24 nativeBuildInputs = [ cmake ninja ]; 25 25 26 - checkInputs = [ gtest ]; 27 - 28 26 # Required for case-insensitive filesystems ("BUILD" exists) 29 27 dontUseCmakeBuildDir = true; 30 28 31 - cmakeFlags = [ 29 + cmakeFlags = let 30 + libExt = stdenv.hostPlatform.extensions.library; 31 + in [ 32 32 "-GNinja" 33 33 "-DCMAKE_INSTALL_LIBDIR=lib" 34 34 "-DCMAKE_INSTALL_INCLUDEDIR=include" 35 - ] ++ lib.optional doCheck "-DHWY_SYSTEM_GTEST:BOOL=ON"; 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 + ]; 36 41 37 42 # hydra's darwin machines run into https://github.com/libjxl/libjxl/issues/408 38 43 doCheck = !stdenv.hostPlatform.isDarwin;