depot/third_party/nixpkgs/pkgs/by-name/ei/eigenrand/package.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

48 lines
1.1 KiB
Nix

{
cmake,
eigen,
fetchFromGitHub,
gtest,
lib,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "eigenrand";
version = "0.5.1";
src = fetchFromGitHub {
owner = "bab2min";
repo = "EigenRand";
rev = "v${finalAttrs.version}";
hash = "sha256-mrpkWIb6kfLvppmIfzhjF1/3m1zSd8XG1D07V6Zjlu0=";
};
# Avoid downloading googletest: we already have it.
postPatch = ''
substituteInPlace CMakeLists.txt --replace-fail \
"FetchContent_MakeAvailable(googletest)" \
"add_subdirectory(${gtest.src} googletest SYSTEM)"
'';
postInstall = ''
# Remove installed tests and googletest stuff
rm -rf $out/bin $out/include/gmock $out/include/gtest $out/lib
'';
nativeBuildInputs = [ cmake ];
propagatedBuildInputs = [ eigen ];
checkInputs = [ gtest ];
doCheck = true;
cmakeFlags = [ "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;EigenRand-test" ];
meta = {
description = "Fastest Random Distribution Generator for Eigen";
homepage = "https://github.com/bab2min/EigenRand";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ nim65s ];
platforms = lib.platforms.unix;
};
})