blob: 030de35beb320db473693f4cb3666c542bb50417 [file] [log] [blame]
James Kuszmaulf5eb4682023-09-22 17:16:59 -07001#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
9DEFINE_string(reflection_bfbs, "", "Path to the .bfbs reflection file.");
10DEFINE_string(output_file, "", "Path to the output header to write.");
James Kuszmaul9a2d5f02023-12-14 11:38:35 -080011DEFINE_string(base_file_name, "",
12 "Name of the base file to generate code for as used by the "
13 "reflection::Schema object.");
James Kuszmaulf5eb4682023-09-22 17:16:59 -070014
15namespace aos::fbs {
16int Main() {
17 aos::FlatbufferVector<reflection::Schema> schema =
18 aos::FileToFlatbuffer<reflection::Schema>(FLAGS_reflection_bfbs);
19 aos::util::WriteStringToFileOrDie(
James Kuszmaul9a2d5f02023-12-14 11:38:35 -080020 FLAGS_output_file,
21 GenerateCodeForRootTableFile(&schema.message(), FLAGS_base_file_name));
James Kuszmaulf5eb4682023-09-22 17:16:59 -070022 return EXIT_SUCCESS;
23}
24} // namespace aos::fbs
25int main(int argc, char *argv[]) {
26 aos::InitGoogle(&argc, &argv);
27 return aos::fbs::Main();
28}