class GoogleBenchmark < Formula desc "C++ microbenchmark support library" homepage "https://github.com/google/benchmark" url "https://github.com/google/benchmark/archive/v1.4.0.tar.gz" sha256 "616f252f37d61b15037e3c2ef956905baf9c9eecfeab400cb3ad25bae714e214" head "https://github.com/google/benchmark.git" bottle do cellar :any_skip_relocation sha256 "76c2713d3de1596cf9cb298d906aebcd0c06259a4595ca519e7be3ae9b32a58e" => :high_sierra sha256 "e733b53d5fbddaf8a75a0fbcfe415c5bdb420a9666f770e06afa4e844cef45e9" => :sierra sha256 "79e9bdfa601cc661a7cc0c7129b54d11e7f0dc183ed85a0f67304a80c498626a" => :el_capitan end depends_on "cmake" => :build needs :cxx11 def install ENV.cxx11 system "cmake", "-DBENCHMARK_ENABLE_GTEST_TESTS=OFF", *std_cmake_args system "make", "install" end test do (testpath/"test.cpp").write <<~EOS #include #include 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