aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/flatbuffers/BUILD.bazel
blob: 934c0d9650068c7afd55610f6cd905e7cd73fa19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # Apache 2.0

exports_files(["LICENSE.txt"])

config_setting(
    name = "freebsd",
    values = {"cpu": "freebsd"},
    visibility = ["//visibility:public"],
)

config_setting(
    name = "windows",
    values = {"cpu": "x64_windows"},
)

FLATBUFFERS_COPTS = select({
    ":windows": [],
    "//conditions:default": [
        "-Wno-implicit-fallthrough",
        "-fexceptions",
    ],
})

# Public flatc library to compile flatbuffer files at runtime.
cc_library(
    name = "flatbuffers",
    srcs = [
        "include/flatbuffers/code_generators.h",
        "include/flatbuffers/reflection_generated.h",
        "src/code_generators.cpp",
        "src/idl_gen_fbs.cpp",
        "src/idl_gen_general.cpp",
        "src/idl_gen_text.cpp",
        "src/idl_parser.cpp",
        "src/reflection.cpp",
        "src/util.cpp",
    ],
    hdrs = [
        "include/flatbuffers/base.h",
        "include/flatbuffers/flatbuffers.h",
        "include/flatbuffers/flexbuffers.h",
        "include/flatbuffers/hash.h",
        "include/flatbuffers/idl.h",
        "include/flatbuffers/reflection.h",
        "include/flatbuffers/stl_emulation.h",
        "include/flatbuffers/util.h",
    ],
    copts = FLATBUFFERS_COPTS,
    includes = ["include/"],
)

# Public flatc compiler library.
cc_library(
    name = "flatc_library",
    srcs = [
        "grpc/src/compiler/config.h",
        "grpc/src/compiler/go_generator.h",
        "grpc/src/compiler/schema_interface.h",
        "include/flatbuffers/base.h",
        "include/flatbuffers/code_generators.h",
        "include/flatbuffers/flatbuffers.h",
        "include/flatbuffers/flatc.h",
        "include/flatbuffers/flexbuffers.h",
        "include/flatbuffers/hash.h",
        "include/flatbuffers/idl.h",
        "include/flatbuffers/reflection.h",
        "include/flatbuffers/reflection_generated.h",
        "include/flatbuffers/stl_emulation.h",
        "include/flatbuffers/util.h",
        "src/code_generators.cpp",
        "src/flatc.cpp",
        "src/idl_gen_fbs.cpp",
        "src/idl_parser.cpp",
        "src/reflection.cpp",
        "src/util.cpp",
    ],
    hdrs = [
        "include/flatbuffers/base.h",
        "include/flatbuffers/code_generators.h",
        "include/flatbuffers/flatbuffers.h",
        "include/flatbuffers/flatc.h",
        "include/flatbuffers/idl.h",
        "include/flatbuffers/reflection.h",
        "include/flatbuffers/stl_emulation.h",
        "include/flatbuffers/util.h",
    ],
    copts = FLATBUFFERS_COPTS,
    includes = [
        "grpc/",
        "include/",
    ],
)

# Public flatc compiler.
cc_binary(
    name = "flatc",
    srcs = [
        "grpc/src/compiler/cpp_generator.cc",
        "grpc/src/compiler/cpp_generator.h",
        "grpc/src/compiler/go_generator.cc",
        "grpc/src/compiler/go_generator.h",
        "grpc/src/compiler/java_generator.cc",
        "grpc/src/compiler/java_generator.h",
        "grpc/src/compiler/schema_interface.h",
        "src/flatc_main.cpp",
        "src/idl_gen_cpp.cpp",
        "src/idl_gen_general.cpp",
        "src/idl_gen_go.cpp",
        "src/idl_gen_grpc.cpp",
        "src/idl_gen_js.cpp",
        "src/idl_gen_json_schema.cpp",
        "src/idl_gen_php.cpp",
        "src/idl_gen_python.cpp",
        "src/idl_gen_text.cpp",
    ],
    copts = FLATBUFFERS_COPTS,
    includes = [
        "grpc/",
        "include/",
    ],
    linkopts = select({
        ":freebsd": [
            "-lm",
        ],
        ":windows": [],
        "//conditions:default": [
            "-lm",
            "-ldl",
        ],
    }),
    deps = [
        ":flatc_library",
    ],
)

filegroup(
    name = "runtime_cc_srcs",
    srcs = [
        "include/flatbuffers/base.h",
        "include/flatbuffers/flatbuffers.h",
        "include/flatbuffers/minireflect.h",
        "include/flatbuffers/stl_emulation.h",
        "include/flatbuffers/util.h",
    ],
)

cc_library(
    name = "runtime_cc",
    hdrs = ["runtime_cc_srcs"],
    includes = ["include"],
    linkstatic = 1,
)