diff options
| author | Caleb Xu | 2015-02-04 23:58:41 -0500 |
|---|---|---|
| committer | Mike McQuaid | 2015-02-05 10:21:36 +0000 |
| commit | 1f546355de277e753c2b26e871ee8873b1adcce8 (patch) | |
| tree | 7cd34dc69a0a219ad1d6b7b6258aa9cbdf2eda97 /Library | |
| parent | 32a4621930ec0a4952c548c17d02bdfa57f57967 (diff) | |
| download | homebrew-1f546355de277e753c2b26e871ee8873b1adcce8.tar.bz2 | |
flatbuffers 1.0.3 (new formula)
Closes #36544.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/flatbuffers.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Library/Formula/flatbuffers.rb b/Library/Formula/flatbuffers.rb new file mode 100644 index 000000000..18608aa35 --- /dev/null +++ b/Library/Formula/flatbuffers.rb @@ -0,0 +1,61 @@ +class Flatbuffers < Formula + homepage "https://google.github.io/flatbuffers" + url "https://github.com/google/flatbuffers/archive/v1.0.3.tar.gz" + sha1 "8daba5be5436b7cb99f1883e3eb7f1c5da52d6b9" + + 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 |
