jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / c / celero.rb
blob806c719a92c7051e8320f7251e5abb384945ed6b
1 class Celero < Formula
2   desc "C++ Benchmark Authoring Library/Framework"
3   homepage "https://github.com/DigitalInBlue/Celero"
4   url "https://github.com/DigitalInBlue/Celero/archive/refs/tags/v2.9.0.tar.gz"
5   sha256 "d59df84696e0dd58022d2c42837362c06eba6d1e29bac61f7b3143bc73d779e5"
6   license "Apache-2.0"
8   bottle do
9     sha256 cellar: :any,                 arm64_sequoia:  "8df764c6550e49e740ac10d19e1dcfa18708fac66695b00ffeb724eaf2d798d4"
10     sha256 cellar: :any,                 arm64_sonoma:   "a623447721e67bc374800d2c048c9c65fdba7fe06a21ea497a5adba2905157ff"
11     sha256 cellar: :any,                 arm64_ventura:  "6c5aa0d8b749c0ae1a99501d00026676de190997457820798992145237268783"
12     sha256 cellar: :any,                 arm64_monterey: "f3c479a0f6ab3d2d366bae855864122e04cf21627b000a395fbb68fb1f44366c"
13     sha256 cellar: :any,                 arm64_big_sur:  "d6566ee0ac67ff7c0970df553b971fc626c02e70ad106dc2d44e88905562af4f"
14     sha256 cellar: :any,                 sonoma:         "dffd38a438568728d366fe4b5ddc943c6023c247742f146c3afc7d492b94153b"
15     sha256 cellar: :any,                 ventura:        "42ef19078dce4acd6d50aa076308fff7910e06355c0a8eea600e1832fd86a87d"
16     sha256 cellar: :any,                 monterey:       "6011c0b09373fb45f77460bb8b3019f4124748f53007dae89421e0c801d9b6b1"
17     sha256 cellar: :any,                 big_sur:        "5092b4825085f08851008b0f776942ad17629900a485e825778a97599b5793c1"
18     sha256 cellar: :any_skip_relocation, x86_64_linux:   "5d360871cfd166555c2d16b0841b4669c0755532da2970bab216f7f9524596a5"
19   end
21   depends_on "cmake" => :build
23   def install
24     args = %w[
25       -DCELERO_COMPILE_DYNAMIC_LIBRARIES=ON
26       -DCELERO_ENABLE_EXPERIMENTS=OFF
27       -DCELERO_ENABLE_TESTS=OFF
28     ]
30     system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
31     system "cmake", "--build", "build"
32     system "cmake", "--install", "build"
33   end
35   test do
36     (testpath/"test.cpp").write <<~CPP
37       #include <celero/Celero.h>
38       #include <chrono>
39       #include <thread>
41       CELERO_MAIN
43       BASELINE(DemoSleep, Baseline, 60, 1) {
44         std::this_thread::sleep_for(std::chrono::microseconds(10000));
45       }
46       BENCHMARK(DemoSleep, HalfBaseline, 60, 1) {
47         std::this_thread::sleep_for(std::chrono::microseconds(5000));
48       }
49       BENCHMARK(DemoSleep, TwiceBaseline, 60, 1) {
50         std::this_thread::sleep_for(std::chrono::microseconds(20000));
51       }
52     CPP
53     system ENV.cxx, "-std=c++14", "test.cpp", "-L#{lib}", "-lcelero", "-o", "test"
54     system "./test"
55   end
56 end