Files

46 lines
1.6 KiB
Ruby

class Simdjson < Formula
bottle do
root_url "https://homebrew.hyprnet/bottles"
sha256 cellar: :any, arm64_sequoia: "a824a28ffc068be855d204b0b76fc096453013a76e84ccfc200acf3289197095"
sha256 cellar: :any, arm64_tahoe: "da88957275c7f0fd3f47f6e183da15eda1c4fd013515c59d8a75316fbf8ddeff"
sha256 cellar: :any, x86_64_linux: "4ae6ad35a77df021c89c62d6bb82fb2b3b9b962143761a9a840d8492b69cbb2a"
end
desc "SIMD-accelerated C++ JSON parser"
homepage "https://simdjson.org"
url "https://github.com/simdjson/simdjson/archive/refs/tags/v4.6.6.tar.gz"
sha256 "1cd4c4c18263d2ae1f0cd5d4ba8b14e679b5a419ca15988a0da4cf43c514f28d"
license "Apache-2.0"
compatibility_version 3
head "https://github.com/simdjson/simdjson.git", branch: "master"
depends_on "cmake" => :build
def install
system "cmake", "-S", ".", "-B", "build",
"-DBUILD_SHARED_LIBS=ON",
"-DSIMDJSON_BUILD_STATIC_LIB=ON",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
(testpath/"test.json").write({ name: "Homebrew", isNull: nil }.to_json)
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <simdjson.h>
int main(void) {
simdjson::dom::parser parser;
simdjson::dom::element json = parser.load("test.json");
std::cout << json["name"] << std::endl;
}
CPP
system ENV.cxx, "test.cpp", "-std=c++11",
"-I#{include}", "-L#{lib}", "-lsimdjson", "-o", "test"
assert_equal "\"Homebrew\"\n", shell_output("./test")
end
end