-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathrapidfuzz-cpp.rb
37 lines (32 loc) · 1.16 KB
/
rapidfuzz-cpp.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class RapidfuzzCpp < Formula
desc "Rapid fuzzy string matching in C++ using the Levenshtein Distance"
homepage "https://rapidfuzz.github.io/rapidfuzz-cpp/"
url "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v3.3.2.tar.gz"
sha256 "cf619bb1e7a525472077e76287041d9cd89e97073a24095bcb97f81897b0c1d4"
license "MIT"
head "https://github.com/rapidfuzz/rapidfuzz-cpp.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, all: "6c3d224d6635841d64372d9214e0557ce73d2792e504557def95e55183a2098d"
end
depends_on "cmake" => :build
def install
system "cmake", "-S", ".", "-B", "build", *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
(testpath/"test.cpp").write <<~CPP
#include <rapidfuzz/fuzz.hpp>
#include <string>
#include <iostream>
int main()
{
std::string a = "aaaa";
std::string b = "abab";
std::cout << rapidfuzz::fuzz::ratio(a, b) << std::endl;
}
CPP
system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-o", "test"
assert_equal "50", shell_output("./test").strip
end
end