Add support for fixed-size arrays (#5313)
[platform/upstream/flatbuffers.git] / BUILD
1 licenses(["notice"])
2
3 package(
4     default_visibility = ["//visibility:public"],
5     features = [
6         "-layering_check",
7         "-parse_headers",
8     ],
9 )
10
11 exports_files([
12     "LICENSE",
13 ])
14
15 load(":build_defs.bzl", "flatbuffer_cc_library")
16
17 # Public flatc library to compile flatbuffer files at runtime.
18 cc_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.
35 filegroup(
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.
53 cc_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.
74 cc_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         "src/util.cpp",
100     ],
101     includes = [
102         "grpc/",
103         "include/",
104     ],
105     deps = [
106         ":flatc_library",
107     ],
108 )
109
110 cc_library(
111     name = "runtime_cc",
112     hdrs = [
113         "include/flatbuffers/base.h",
114         "include/flatbuffers/flatbuffers.h",
115         "include/flatbuffers/flexbuffers.h",
116         "include/flatbuffers/stl_emulation.h",
117         "include/flatbuffers/util.h",
118     ],
119     includes = ["include/"],
120     linkstatic = 1,
121 )
122
123 # Test binary.
124 cc_test(
125     name = "flatbuffers_test",
126     testonly = 1,
127     srcs = [
128         "include/flatbuffers/minireflect.h",
129         "include/flatbuffers/registry.h",
130         "src/code_generators.cpp",
131         "src/idl_gen_fbs.cpp",
132         "src/idl_gen_general.cpp",
133         "src/idl_gen_text.cpp",
134         "src/idl_parser.cpp",
135         "src/reflection.cpp",
136         "src/util.cpp",
137         "tests/namespace_test/namespace_test1_generated.h",
138         "tests/namespace_test/namespace_test2_generated.h",
139         "tests/test.cpp",
140         "tests/test_assert.cpp",
141         "tests/test_assert.h",
142         "tests/test_builder.cpp",
143         "tests/test_builder.h",
144         "tests/union_vector/union_vector_generated.h",
145         ":public_headers",
146     ],
147     copts = [
148         "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
149         "-DBAZEL_TEST_DATA_PATH",
150     ],
151     data = [
152         ":tests/include_test/include_test1.fbs",
153         ":tests/include_test/sub/include_test2.fbs",
154         ":tests/monster_test.bfbs",
155         ":tests/monster_test.fbs",
156         ":tests/monsterdata_test.golden",
157         ":tests/monsterdata_test.json",
158         ":tests/prototest/imported.proto",
159         ":tests/prototest/test.golden",
160         ":tests/prototest/test.proto",
161         ":tests/prototest/test_union.golden",
162         ":tests/unicode_test.json",
163         ":tests/union_vector/union_vector.fbs",
164         ":tests/union_vector/union_vector.json",
165         ":tests/monster_extra.fbs",
166         ":tests/monsterdata_extra.json",
167         ":tests/arrays_test.bfbs",
168         ":tests/arrays_test.fbs",
169         ":tests/arrays_test.golden",
170     ],
171     includes = ["include/"],
172     deps = [
173         ":monster_extra_cc_fbs",
174         ":monster_test_cc_fbs",
175         ":arrays_test_cc_fbs",
176     ],
177 )
178
179 # Test bzl rules
180
181 flatbuffer_cc_library(
182     name = "monster_test_cc_fbs",
183     srcs = ["tests/monster_test.fbs"],
184     include_paths = ["tests/include_test"],
185     includes = [
186         "tests/include_test/include_test1.fbs",
187         "tests/include_test/sub/include_test2.fbs",
188     ],
189 )
190
191 flatbuffer_cc_library(
192     name = "monster_extra_cc_fbs",
193     srcs = ["tests/monster_extra.fbs"],
194 )
195
196 flatbuffer_cc_library(
197     name = "arrays_test_cc_fbs",
198     srcs = ["tests/arrays_test.fbs"],
199     flatc_args = [
200         "--gen-object-api",
201         "--gen-compare",
202         "--no-includes",
203         "--gen-mutable",
204         "--reflect-names",
205         "--cpp-ptr-type flatbuffers::unique_ptr",
206         "--scoped-enums" ],
207 )