James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 1 | # @unused |
| 2 | load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") |
| 3 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 4 | package( |
| 5 | default_visibility = ["//visibility:private"], |
| 6 | ) |
| 7 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 8 | # Public flatc library to compile flatbuffer files at runtime. |
| 9 | cc_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 Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 20 | 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 Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 29 | strip_include_prefix = "/include", |
| 30 | visibility = ["//:__pkg__"], |
| 31 | ) |
| 32 | |
| 33 | # Public flatc compiler library. |
| 34 | cc_library( |
| 35 | name = "flatc_library", |
| 36 | srcs = [ |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 37 | "annotated_binary_text_gen.cpp", |
| 38 | "annotated_binary_text_gen.h", |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 39 | "bfbs_gen.h", |
| 40 | "bfbs_gen_lua.cpp", |
| 41 | "bfbs_gen_lua.h", |
James Kuszmaul | 65541cb | 2022-11-08 14:53:47 -0800 | [diff] [blame] | 42 | "bfbs_gen_nim.cpp", |
| 43 | "bfbs_gen_nim.h", |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 44 | "bfbs_namer.h", |
| 45 | "binary_annotator.cpp", |
| 46 | "binary_annotator.h", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 47 | "flatc.cpp", |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 48 | "namer.h", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 49 | ], |
| 50 | hdrs = [ |
| 51 | "//:flatc_headers", |
| 52 | ], |
| 53 | strip_include_prefix = "/include", |
Austin Schuh | fa30c35 | 2022-10-16 11:12:02 -0700 | [diff] [blame] | 54 | visibility = ["//visibility:public"], |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 55 | deps = [ |
| 56 | ":flatbuffers", |
| 57 | ], |
| 58 | ) |
| 59 | |
| 60 | # Public flatc compiler. |
| 61 | cc_library( |
| 62 | name = "flatc", |
| 63 | srcs = [ |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 64 | "bfbs_gen.h", |
| 65 | "bfbs_gen_lua.cpp", |
| 66 | "bfbs_gen_lua.h", |
James Kuszmaul | 65541cb | 2022-11-08 14:53:47 -0800 | [diff] [blame] | 67 | "bfbs_gen_nim.cpp", |
| 68 | "bfbs_gen_nim.h", |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 69 | "bfbs_namer.h", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 70 | "flatc_main.cpp", |
| 71 | "idl_gen_cpp.cpp", |
| 72 | "idl_gen_csharp.cpp", |
| 73 | "idl_gen_dart.cpp", |
| 74 | "idl_gen_go.cpp", |
| 75 | "idl_gen_grpc.cpp", |
| 76 | "idl_gen_java.cpp", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 77 | "idl_gen_json_schema.cpp", |
| 78 | "idl_gen_kotlin.cpp", |
| 79 | "idl_gen_lobster.cpp", |
| 80 | "idl_gen_lua.cpp", |
| 81 | "idl_gen_php.cpp", |
| 82 | "idl_gen_python.cpp", |
| 83 | "idl_gen_rust.cpp", |
| 84 | "idl_gen_swift.cpp", |
| 85 | "idl_gen_text.cpp", |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 86 | "idl_gen_ts.cpp", |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 87 | "idl_namer.h", |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 88 | "namer.h", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 89 | "util.cpp", |
| 90 | ], |
| 91 | hdrs = [ |
| 92 | "//:flatc_headers", |
| 93 | ], |
| 94 | strip_include_prefix = "/include", |
| 95 | visibility = ["//:__pkg__"], |
| 96 | deps = [ |
| 97 | ":flatc_library", |
| 98 | "//grpc/src/compiler:cpp_generator", |
| 99 | "//grpc/src/compiler:go_generator", |
| 100 | "//grpc/src/compiler:java_generator", |
| 101 | "//grpc/src/compiler:python_generator", |
| 102 | "//grpc/src/compiler:swift_generator", |
| 103 | "//grpc/src/compiler:ts_generator", |
| 104 | ], |
| 105 | ) |