google-benchmark: 0.1.0 (new formula)

Closes Homebrew/homebrew#43399.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
Teddy Reed 2015-08-30 01:37:07 -07:00 committed by Dominyk Tiller
parent c75559e5f5
commit 127ab286b1

View file

@ -0,0 +1,35 @@
class GoogleBenchmark < Formula
desc "C++ microbenchmark support library"
homepage "https://github.com/google/benchmark"
url "https://github.com/google/benchmark/archive/v0.1.0.tar.gz"
sha256 "41aa7dca7aa94911deee078e39f7602d760f2911bb33086b5a2c8204717ddad4"
depends_on "cmake" => :build
needs :cxx11
def install
ENV.cxx11
system "cmake", *std_cmake_args
system "make"
system "make", "test"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <string>
#include <benchmark/benchmark.h>
static void BM_StringCreation(benchmark::State& state) {
while (state.KeepRunning())
std::string empty_string;
}
BENCHMARK(BM_StringCreation);
BENCHMARK_MAIN();
EOS
flags = ["-stdlib=libc++", "-I#{include}", "-L#{lib}", "-lbenchmark"] + ENV.cflags.to_s.split
system ENV.cxx, "-o", "test", "test.cpp", *flags
system "./test"
end
end