1licenses(["notice"]) 2 3package( 4 default_visibility = ["//visibility:public"], 5 features = [ 6 "-layering_check", 7 "-parse_headers", 8 ], 9) 10 11exports_files([ 12 "LICENSE", 13]) 14 15load(":build_defs.bzl", "flatbuffer_cc_library") 16 17# Public flatc library to compile flatbuffer files at runtime. 18cc_library( 19 name = "flatbuffers", 20 srcs = [ 21 "src/code_generators.cpp", 22 "src/idl_gen_fbs.cpp", 23 "src/idl_gen_general.cpp", 24 "src/idl_gen_text.cpp", 25 "src/idl_parser.cpp", 26 "src/reflection.cpp", 27 "src/util.cpp", 28 ], 29 hdrs = [":public_headers"], 30 includes = ["include/"], 31 linkstatic = 1, 32) 33 34# Public C++ headers for the Flatbuffers library. 35filegroup( 36 name = "public_headers", 37 srcs = [ 38 "include/flatbuffers/base.h", 39 "include/flatbuffers/code_generators.h", 40 "include/flatbuffers/flatbuffers.h", 41 "include/flatbuffers/flexbuffers.h", 42 "include/flatbuffers/hash.h", 43 "include/flatbuffers/idl.h", 44 "include/flatbuffers/minireflect.h", 45 "include/flatbuffers/reflection.h", 46 "include/flatbuffers/reflection_generated.h", 47 "include/flatbuffers/stl_emulation.h", 48 "include/flatbuffers/util.h", 49 ], 50) 51 52# Public flatc compiler library. 53cc_library( 54 name = "flatc_library", 55 srcs = [ 56 "src/code_generators.cpp", 57 "src/flatc.cpp", 58 "src/idl_gen_fbs.cpp", 59 "src/idl_parser.cpp", 60 "src/reflection.cpp", 61 "src/util.cpp", 62 ], 63 hdrs = [ 64 "include/flatbuffers/flatc.h", 65 ":public_headers", 66 ], 67 includes = [ 68 "grpc/", 69 "include/", 70 ], 71) 72 73# Public flatc compiler. 74cc_binary( 75 name = "flatc", 76 srcs = [ 77 "grpc/src/compiler/config.h", 78 "grpc/src/compiler/cpp_generator.cc", 79 "grpc/src/compiler/cpp_generator.h", 80 "grpc/src/compiler/go_generator.cc", 81 "grpc/src/compiler/go_generator.h", 82 "grpc/src/compiler/java_generator.cc", 83 "grpc/src/compiler/java_generator.h", 84 "grpc/src/compiler/schema_interface.h", 85 "src/flatc_main.cpp", 86 "src/idl_gen_cpp.cpp", 87 "src/idl_gen_dart.cpp", 88 "src/idl_gen_general.cpp", 89 "src/idl_gen_go.cpp", 90 "src/idl_gen_grpc.cpp", 91 "src/idl_gen_js_ts.cpp", 92 "src/idl_gen_json_schema.cpp", 93 "src/idl_gen_lobster.cpp", 94 "src/idl_gen_lua.cpp", 95 "src/idl_gen_php.cpp", 96 "src/idl_gen_python.cpp", 97 "src/idl_gen_rust.cpp", 98 "src/idl_gen_text.cpp", 99 ], 100 includes = [ 101 "grpc/", 102 "include/", 103 ], 104 deps = [ 105 ":flatc_library", 106 ], 107) 108 109cc_library( 110 name = "runtime_cc", 111 hdrs = [ 112 "include/flatbuffers/base.h", 113 "include/flatbuffers/flatbuffers.h", 114 "include/flatbuffers/flexbuffers.h", 115 "include/flatbuffers/stl_emulation.h", 116 "include/flatbuffers/util.h", 117 ], 118 includes = ["include/"], 119 linkstatic = 1, 120) 121 122# Test binary. 123cc_test( 124 name = "flatbuffers_test", 125 testonly = 1, 126 srcs = [ 127 "include/flatbuffers/minireflect.h", 128 "include/flatbuffers/registry.h", 129 "src/code_generators.cpp", 130 "src/idl_gen_fbs.cpp", 131 "src/idl_gen_general.cpp", 132 "src/idl_gen_text.cpp", 133 "src/idl_parser.cpp", 134 "src/reflection.cpp", 135 "src/util.cpp", 136 "tests/namespace_test/namespace_test1_generated.h", 137 "tests/namespace_test/namespace_test2_generated.h", 138 "tests/test.cpp", 139 "tests/test_assert.cpp", 140 "tests/test_assert.h", 141 "tests/test_builder.cpp", 142 "tests/test_builder.h", 143 "tests/union_vector/union_vector_generated.h", 144 ":public_headers", 145 ], 146 copts = [ 147 "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE", 148 "-DBAZEL_TEST_DATA_PATH", 149 ], 150 data = [ 151 ":tests/include_test/include_test1.fbs", 152 ":tests/include_test/sub/include_test2.fbs", 153 ":tests/monster_test.bfbs", 154 ":tests/monster_test.fbs", 155 ":tests/monsterdata_test.golden", 156 ":tests/prototest/imported.proto", 157 ":tests/prototest/test.golden", 158 ":tests/prototest/test.proto", 159 ":tests/prototest/test_union.golden", 160 ":tests/unicode_test.json", 161 ":tests/union_vector/union_vector.fbs", 162 ], 163 includes = ["include/"], 164 deps = [ 165 ":monster_extra_cc_fbs", 166 ":monster_test_cc_fbs", 167 ], 168) 169 170# Test bzl rules 171 172flatbuffer_cc_library( 173 name = "monster_test_cc_fbs", 174 srcs = ["tests/monster_test.fbs"], 175 include_paths = ["tests/include_test"], 176 includes = [ 177 "tests/include_test/include_test1.fbs", 178 "tests/include_test/sub/include_test2.fbs", 179 ], 180) 181 182flatbuffer_cc_library( 183 name = "monster_extra_cc_fbs", 184 srcs = ["tests/monster_extra.fbs"], 185) 186