64 lines
1.8 KiB
Ruby
64 lines
1.8 KiB
Ruby
class ThorsSerializer < Formula
|
|
desc "Declarative serialization library (JSON/YAML) for C++"
|
|
homepage "https://github.com/Loki-Astari/ThorsSerializer"
|
|
url "https://github.com/Loki-Astari/ThorsSerializer.git",
|
|
:tag => "1.13.4",
|
|
:revision => "b3aa5587c37198ba10cca4190f385c33db31b8dc"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "9191bbecaed9cafc9fa2ba125aefd8ce505d1a9ab569ff53379f29be76f2f2e8" => :mojave
|
|
sha256 "d811d9908126d3abed8ed61a15b33a8c96c7cbae94da1da077599ec3fd0b7e0f" => :high_sierra
|
|
sha256 "9f6910ed5a6634a2f5e5c6faaaaca77ac677d2a03352cd0580d812de3b12e33f" => :sierra
|
|
end
|
|
|
|
depends_on "libyaml"
|
|
|
|
def install
|
|
ENV["COV"] = "gcov"
|
|
|
|
system "./configure", "--disable-binary",
|
|
"--disable-vera",
|
|
"--prefix=#{prefix}"
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include "ThorSerialize/JsonThor.h"
|
|
#include "ThorSerialize/SerUtil.h"
|
|
#include <sstream>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
struct Block
|
|
{
|
|
std::string key;
|
|
int code;
|
|
};
|
|
ThorsAnvil_MakeTrait(Block, key, code);
|
|
|
|
int main()
|
|
{
|
|
using ThorsAnvil::Serialize::jsonImport;
|
|
using ThorsAnvil::Serialize::jsonExport;
|
|
|
|
std::stringstream inputData(R"({"key":"XYZ","code":37373})");
|
|
|
|
Block object;
|
|
inputData >> jsonImport(object);
|
|
|
|
if (object.key != "XYZ" || object.code != 37373) {
|
|
std::cerr << "Fail";
|
|
return 1;
|
|
}
|
|
std::cerr << "OK";
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "-std=c++14", "test.cpp", "-o", "test",
|
|
"-I#{include}", "-L#{lib}", "-lThorSerialize17"
|
|
system "./test"
|
|
end
|
|
end
|