59 lines
1.5 KiB
Ruby
59 lines
1.5 KiB
Ruby
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.5.1.tar.gz"
|
|
sha256 "8c4560ca32e3c555716d9363bed469e2c60e0f443ec32bc08e7abfe681e25ca9"
|
|
head "https://github.com/dvidelabs/flatcc.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "17b33c3326512047102e7055fa8d7d8b8b6781dde0ed65dd2c38525283f1ce5c" => :high_sierra
|
|
sha256 "972fd44d9828746a29c4eef6f64cfa5fa67508601384117b979d39837e2498d7" => :sierra
|
|
sha256 "ea29799a542aa866c8fe1e5f9416e7bd274edf74da7f400c1d63690c1acd5930" => :el_capitan
|
|
end
|
|
|
|
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
|
|
// 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 bin/"flatcc", "-av", "--json", "test.fbs"
|
|
end
|
|
end
|