James Kuszmaul | f5eb468 | 2023-09-22 17:16:59 -0700 | [diff] [blame^] | 1 | #include "flatbuffers/reflection_generated.h" |
| 2 | |
| 3 | #include "aos/flatbuffers.h" |
| 4 | #include "aos/flatbuffers/static_flatbuffers.h" |
| 5 | #include "aos/init.h" |
| 6 | #include "aos/json_to_flatbuffer.h" |
| 7 | #include "aos/util/file.h" |
| 8 | |
| 9 | DEFINE_string(reflection_bfbs, "", "Path to the .bfbs reflection file."); |
| 10 | DEFINE_string(output_file, "", "Path to the output header to write."); |
| 11 | |
| 12 | namespace aos::fbs { |
| 13 | int Main() { |
| 14 | aos::FlatbufferVector<reflection::Schema> schema = |
| 15 | aos::FileToFlatbuffer<reflection::Schema>(FLAGS_reflection_bfbs); |
| 16 | aos::util::WriteStringToFileOrDie( |
| 17 | FLAGS_output_file, GenerateCodeForRootTableFile(&schema.message())); |
| 18 | return EXIT_SUCCESS; |
| 19 | } |
| 20 | } // namespace aos::fbs |
| 21 | int main(int argc, char *argv[]) { |
| 22 | aos::InitGoogle(&argc, &argv); |
| 23 | return aos::fbs::Main(); |
| 24 | } |