google-benchmark: 0.1.0 (new formula)
Closes Homebrew/homebrew#43399. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
parent
c75559e5f5
commit
127ab286b1
1 changed files with 35 additions and 0 deletions
35
Formula/google-benchmark.rb
Normal file
35
Formula/google-benchmark.rb
Normal 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
|
Loading…
Reference in a new issue