flatcc 0.2.0 (new formula)
This commit is contained in:
parent
0cb5b4f5bc
commit
9239964bdb
1 changed files with 52 additions and 0 deletions
52
Formula/flatcc.rb
Normal file
52
Formula/flatcc.rb
Normal 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
|
Loading…
Reference in a new issue