63 lines
1.8 KiB
Ruby
63 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.10.6",
|
|
:revision => "d53ea86b14fbf1e7f2cb0f1c2a520ccf81a78dd6"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "80419c7922e83b42aea3d0f4120541b1dd5a4be34fdef269516ee5af5d3504df" => :mojave
|
|
sha256 "593eac31c2980a972b8e14189711cef500b565acc2d9c072829422b81164fa55" => :high_sierra
|
|
sha256 "b65d486aa69b7ad2f3d3602f34bd2b555c57fa9173e401ea0a244daf44277de6" => :sierra
|
|
end
|
|
|
|
depends_on "libyaml"
|
|
|
|
def install
|
|
ENV["COV"] = "gcov"
|
|
|
|
system "./configure", "--disable-binary",
|
|
"--disable-vera",
|
|
"--prefix=#{prefix}"
|
|
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
|