2022-11-21 17:40:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2024-10-11 05:15:48 +00:00
|
|
|
, ninja
|
2022-11-21 17:40:18 +00:00
|
|
|
, gtest
|
|
|
|
, prometheus-cpp
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gbenchmark";
|
2024-10-11 05:15:48 +00:00
|
|
|
version = "1.9.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "benchmark";
|
|
|
|
rev = "v${version}";
|
2024-10-11 05:15:48 +00:00
|
|
|
hash = "sha256-5cl1PIjhXaL58kSyWZXRWLq6BITS2BwEovPhwvk2e18=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
checkInputs = [ gtest ];
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
(lib.cmakeBool "BENCHMARK_USE_BUNDLED_GTEST" false)
|
|
|
|
(lib.cmakeBool "BENCHMARK_ENABLE_WERROR" false)
|
|
|
|
];
|
|
|
|
|
|
|
|
# We ran into issues with gtest 1.8.5 conditioning on
|
|
|
|
# `#if __has_cpp_attribute(maybe_unused)`, which was, for some
|
|
|
|
# reason, going through even when C++14 was being used and
|
|
|
|
# breaking the build on Darwin by triggering errors about using
|
|
|
|
# C++17 features.
|
|
|
|
#
|
|
|
|
# This might be a problem with our Clang, as it does not reproduce
|
|
|
|
# with Xcode, but we just work around it by silencing the warning.
|
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-c++17-attribute-extensions";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# Tests fail on 32-bit due to not enough precision
|
2024-09-26 11:04:55 +00:00
|
|
|
doCheck = stdenv.hostPlatform.is64bit;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit prometheus-cpp;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Microbenchmark support library";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/google/benchmark";
|
|
|
|
license = licenses.asl20;
|
2024-09-19 14:19:46 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin ++ platforms.freebsd;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|