Skip to content

Commit

Permalink
google-benchmark: 0.1.0 (new formula)
Browse files Browse the repository at this point in the history
Closes Homebrew/legacy-homebrew#43399.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
  • Loading branch information
Teddy Reed authored and DomT4 committed Aug 31, 2015
1 parent c75559e commit 127ab28
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Formula/google-benchmark.rb
@@ -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

0 comments on commit 127ab28

Please sign in to comment.