homebrew-core/Formula/valijson.rb

33 lines
1.0 KiB
Ruby

class Valijson < Formula
desc "Header-only C++ library for JSON Schema validation"
homepage "https://github.com/tristanpenman/valijson"
url "https://github.com/tristanpenman/valijson/archive/refs/tags/v1.0.tar.gz"
sha256 "6b9f0bc89880feb3fe09aa469cd81f6168897d2fbb4e715853da3b94afd3779a"
license "BSD-2-Clause"
bottle do
sha256 cellar: :any_skip_relocation, all: "1e97e2da68f435d2401d5960fed6e383ffee630120e239535821a4441c853ecb"
end
depends_on "cmake" => :build
depends_on "jsoncpp" => :test
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 <<~EOS
#include <valijson/schema.hpp>
#include <valijson/adapters/jsoncpp_adapter.hpp>
#include <valijson/utils/jsoncpp_utils.hpp>
int main (void) { std::cout << "Hello world"; }
EOS
system ENV.cxx, "test.cpp", "-std=c++11", "-L#{Formula["jsoncpp"].opt_lib}", "-ljsoncpp", "-o", "test"
system "./test"
end
end