class Flatbuffers < Formula desc "Serialization library for C++, supporting Java, C#, and Go" homepage "https://google.github.io/flatbuffers" url "https://github.com/google/flatbuffers/archive/v1.2.0.tar.gz" sha256 "a6cacab3cbcc99e2308d8aa328bff060ba19061ce6eb23be85eccb63fb3446b5" head "https://github.com/google/flatbuffers.git" bottle do cellar :any_skip_relocation sha256 "5fa1f6842ced0fa187d9259e4309eab3b488cdf2132ac8e097979a7a8a5d4c1b" => :el_capitan sha256 "cb4926ae1f9ec11c13cf2eeb4229ccd24f0780f3ba33f1b7acc3f6f11ebeb0ed" => :yosemite sha256 "be12580517a5994d5a4886b3c5c9dd97702f1ae2da3a395bdb4d9cb291e50a02" => :mavericks end depends_on "cmake" => :build def install system "cmake", "-G", "Unix Makefiles", *std_cmake_args system "make", "install" end test do def testfbs; <<-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 end (testpath/"test.fbs").write(testfbs) def testjson; <<-EOS.undent { pos: { x: 1, y: 2, z: 3 }, hp: 80, name: "MyMonster" } EOS end (testpath/"test.json").write(testjson) system "flatc", "-c", "-b", "test.fbs", "test.json" end end