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.0",
|
|
:revision => "b5faf0766294ec83b600a43b6fcf3224165db839"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "f4934a556e23940ffbdc844eb8c0df629a540806938a8ccd998f0f004644da0f" => :mojave
|
|
sha256 "ef086ac4bb57a8601cf969fcb342789663ca4993a543b49e92c7264f63dace24" => :high_sierra
|
|
sha256 "ef4e0bb5299cce8fc468114dc18ee35dadfcde62f4052c9525c30f68cf06f143" => :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
|