blob: d8bbfcd10963c492f89df51ac13dcdab5739b549 [file] [log] [blame]
James Kuszmaul8e62b022022-03-22 09:33:25 -07001# @unused
2load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
3
Austin Schuh272c6132020-11-14 16:37:52 -08004package(
5 default_visibility = ["//visibility:private"],
6)
7
Austin Schuh272c6132020-11-14 16:37:52 -08008# Public flatc library to compile flatbuffer files at runtime.
9cc_library(
10 name = "flatbuffers",
11 srcs = [
12 "code_generators.cpp",
13 "idl_gen_fbs.cpp",
14 "idl_gen_text.cpp",
15 "idl_parser.cpp",
16 "reflection.cpp",
17 "util.cpp",
18 ],
19 hdrs = ["//:public_headers"],
James Kuszmaul8e62b022022-03-22 09:33:25 -070020 linkopts = select({
21 # TODO: Bazel uses `clang` instead of `clang++` to link
22 # C++ code on BSD. Temporarily adding these linker flags while
23 # we wait for Bazel to resolve
24 # https://github.com/bazelbuild/bazel/issues/12023.
25 "//:platform_freebsd": ["-lm"],
26 "//:platform_openbsd": ["-lm"],
27 "//conditions:default": [],
28 }),
Austin Schuh272c6132020-11-14 16:37:52 -080029 strip_include_prefix = "/include",
30 visibility = ["//:__pkg__"],
31)
32
33# Public flatc compiler library.
34cc_library(
35 name = "flatc_library",
36 srcs = [
James Kuszmaul8e62b022022-03-22 09:33:25 -070037 "bfbs_gen.h",
38 "bfbs_gen_lua.cpp",
39 "bfbs_gen_lua.h",
Austin Schuh272c6132020-11-14 16:37:52 -080040 "flatc.cpp",
41 ],
42 hdrs = [
43 "//:flatc_headers",
44 ],
45 strip_include_prefix = "/include",
46 visibility = ["//:__pkg__"],
47 deps = [
48 ":flatbuffers",
49 ],
50)
51
52# Public flatc compiler.
53cc_library(
54 name = "flatc",
55 srcs = [
James Kuszmaul8e62b022022-03-22 09:33:25 -070056 "bfbs_gen.h",
57 "bfbs_gen_lua.cpp",
58 "bfbs_gen_lua.h",
Austin Schuh272c6132020-11-14 16:37:52 -080059 "flatc_main.cpp",
60 "idl_gen_cpp.cpp",
61 "idl_gen_csharp.cpp",
62 "idl_gen_dart.cpp",
63 "idl_gen_go.cpp",
64 "idl_gen_grpc.cpp",
65 "idl_gen_java.cpp",
Austin Schuh272c6132020-11-14 16:37:52 -080066 "idl_gen_json_schema.cpp",
67 "idl_gen_kotlin.cpp",
68 "idl_gen_lobster.cpp",
69 "idl_gen_lua.cpp",
70 "idl_gen_php.cpp",
71 "idl_gen_python.cpp",
72 "idl_gen_rust.cpp",
73 "idl_gen_swift.cpp",
74 "idl_gen_text.cpp",
James Kuszmaul8e62b022022-03-22 09:33:25 -070075 "idl_gen_ts.cpp",
76 "namer.h",
Austin Schuh272c6132020-11-14 16:37:52 -080077 "util.cpp",
78 ],
79 hdrs = [
80 "//:flatc_headers",
81 ],
82 strip_include_prefix = "/include",
83 visibility = ["//:__pkg__"],
84 deps = [
85 ":flatc_library",
86 "//grpc/src/compiler:cpp_generator",
87 "//grpc/src/compiler:go_generator",
88 "//grpc/src/compiler:java_generator",
89 "//grpc/src/compiler:python_generator",
90 "//grpc/src/compiler:swift_generator",
91 "//grpc/src/compiler:ts_generator",
92 ],
93)