nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 58 lines 1.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 ninja, 7 gtest, 8 prometheus-cpp, 9}: 10 11stdenv.mkDerivation rec { 12 pname = "gbenchmark"; 13 version = "1.9.4"; 14 15 src = fetchFromGitHub { 16 owner = "google"; 17 repo = "benchmark"; 18 rev = "v${version}"; 19 hash = "sha256-P7wJcKkIBoWtN9FCRticpBzYbEZPq71a0iW/2oDTZRU="; 20 }; 21 22 nativeBuildInputs = [ 23 cmake 24 ninja 25 ]; 26 27 buildInputs = [ gtest ]; 28 29 cmakeFlags = [ 30 (lib.cmakeBool "BENCHMARK_USE_BUNDLED_GTEST" false) 31 (lib.cmakeBool "BENCHMARK_ENABLE_WERROR" false) 32 ]; 33 34 # We ran into issues with gtest 1.8.5 conditioning on 35 # `#if __has_cpp_attribute(maybe_unused)`, which was, for some 36 # reason, going through even when C++14 was being used and 37 # breaking the build on Darwin by triggering errors about using 38 # C++17 features. 39 # 40 # This might be a problem with our Clang, as it does not reproduce 41 # with Xcode, but we just work around it by silencing the warning. 42 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-c++17-attribute-extensions"; 43 44 # Tests fail on 32-bit due to not enough precision 45 doCheck = stdenv.hostPlatform.is64bit; 46 47 passthru.tests = { 48 inherit prometheus-cpp; 49 }; 50 51 meta = with lib; { 52 description = "Microbenchmark support library"; 53 homepage = "https://github.com/google/benchmark"; 54 license = licenses.asl20; 55 platforms = platforms.linux ++ platforms.darwin ++ platforms.freebsd; 56 maintainers = with maintainers; [ abbradar ]; 57 }; 58}