summaryrefslogtreecommitdiff
path: root/src/BUILD.bazel
blob: 28bc551324158592437181575e38376f59ba7d58 (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
# @unused
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

package(
    default_visibility = ["//visibility:private"],
)

# Public flatc library to compile flatbuffer files at runtime.
cc_library(
    name = "flatbuffers",
    srcs = [
        "code_generators.cpp",
        "idl_gen_fbs.cpp",
        "idl_gen_text.cpp",
        "idl_parser.cpp",
        "reflection.cpp",
        "util.cpp",
    ],
    hdrs = ["//:public_headers"],
    linkopts = select({
        # TODO: Bazel uses `clang` instead of `clang++` to link
        # C++ code on BSD. Temporarily adding these linker flags while
        # we wait for Bazel to resolve
        # https://github.com/bazelbuild/bazel/issues/12023.
        "//:platform_freebsd": ["-lm"],
        "//:platform_openbsd": ["-lm"],
        "//conditions:default": [],
    }),
    strip_include_prefix = "/include",
    visibility = ["//:__pkg__"],
)

# Public flatc compiler library.
cc_library(
    name = "flatc_library",
    srcs = [
        "bfbs_gen.h",
        "bfbs_gen_lua.cpp",
        "bfbs_gen_lua.h",
        "flatc.cpp",
    ],
    hdrs = [
        "//:flatc_headers",
    ],
    strip_include_prefix = "/include",
    visibility = ["//:__pkg__"],
    deps = [
        ":flatbuffers",
    ],
)

# Public flatc compiler.
cc_library(
    name = "flatc",
    srcs = [
        "bfbs_gen.h",
        "bfbs_gen_lua.cpp",
        "bfbs_gen_lua.h",
        "flatc_main.cpp",
        "idl_gen_cpp.cpp",
        "idl_gen_csharp.cpp",
        "idl_gen_dart.cpp",
        "idl_gen_go.cpp",
        "idl_gen_grpc.cpp",
        "idl_gen_java.cpp",
        "idl_gen_json_schema.cpp",
        "idl_gen_kotlin.cpp",
        "idl_gen_lobster.cpp",
        "idl_gen_lua.cpp",
        "idl_gen_php.cpp",
        "idl_gen_python.cpp",
        "idl_gen_rust.cpp",
        "idl_gen_swift.cpp",
        "idl_gen_text.cpp",
        "idl_gen_ts.cpp",
        "util.cpp",
    ],
    hdrs = [
        "//:flatc_headers",
    ],
    strip_include_prefix = "/include",
    visibility = ["//:__pkg__"],
    deps = [
        ":flatc_library",
        "//grpc/src/compiler:cpp_generator",
        "//grpc/src/compiler:go_generator",
        "//grpc/src/compiler:java_generator",
        "//grpc/src/compiler:python_generator",
        "//grpc/src/compiler:swift_generator",
        "//grpc/src/compiler:ts_generator",
    ],
)