flatcc 0.2.0 (new formula)

This commit is contained in:
Flier Lu 2016-03-16 16:23:34 +08:00 committed by Xu Cheng
parent 0cb5b4f5bc
commit 9239964bdb

52
Formula/flatcc.rb Normal file
View file

@ -0,0 +1,52 @@
class Flatcc < Formula
desc "FlatBuffers Compiler and Library in C for C"
homepage "https://github.com/dvidelabs/flatcc"
url "https://github.com/dvidelabs/flatcc/archive/v0.2.0.tar.gz"
sha256 "5327e0c0faa37643f59be6f086576ef76a13d36b655d2bf9547f89ffce3b3413"
head "https://github.com/dvidelabs/flatcc.git"
depends_on "cmake" => :build
def install
system "cmake", "-G", "Unix Makefiles", buildpath, *std_cmake_args
system "make"
bin.install "bin/flatcc"
lib.install "lib/libflatcc.a"
lib.install "lib/libflatccrt.a"
include.install Dir["include/*"]
end
test do
(testpath/"test.fbs").write <<-EOS.undent
// example IDL file
namespace MyGame.Sample;
enum Color:byte { Red = 0, Green, Blue = 2 }
union Any { Monster } // add more elements..
struct Vec3 {
x:float;
y:float;
z:float;
}
table Monster {
pos:Vec3;
mana:short = 150;
hp:short = 100;
name:string;
friendly:bool = false (deprecated);
inventory:[ubyte];
color:Color = Blue;
}
root_type Monster;
EOS
system "flatcc", "-av", "--json", "test.fbs"
end
end