James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 1 | load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") |
| 2 | |
| 3 | licenses(["notice"]) |
| 4 | |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 5 | package( |
| 6 | default_visibility = ["//visibility:public"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 7 | ) |
| 8 | |
| 9 | exports_files([ |
| 10 | "LICENSE", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 11 | "tsconfig.json", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 12 | ]) |
| 13 | |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 14 | config_setting( |
| 15 | name = "platform_freebsd", |
| 16 | constraint_values = [ |
| 17 | "@platforms//os:freebsd", |
| 18 | ], |
| 19 | ) |
| 20 | |
| 21 | config_setting( |
| 22 | name = "platform_openbsd", |
| 23 | constraint_values = [ |
| 24 | "@platforms//os:openbsd", |
| 25 | ], |
| 26 | ) |
| 27 | |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 28 | # Public flatc library to compile flatbuffer files at runtime. |
| 29 | cc_library( |
| 30 | name = "flatbuffers", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 31 | hdrs = ["//:public_headers"], |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 32 | copts = ["-Wno-cast-align"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 33 | linkstatic = 1, |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 34 | strip_include_prefix = "/include", |
| 35 | deps = ["//src:flatbuffers"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 36 | ) |
| 37 | |
| 38 | # Public C++ headers for the Flatbuffers library. |
| 39 | filegroup( |
| 40 | name = "public_headers", |
| 41 | srcs = [ |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 42 | "include/flatbuffers/allocator.h", |
| 43 | "include/flatbuffers/array.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 44 | "include/flatbuffers/base.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 45 | "include/flatbuffers/bfbs_generator.h", |
| 46 | "include/flatbuffers/buffer.h", |
| 47 | "include/flatbuffers/buffer_ref.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 48 | "include/flatbuffers/code_generators.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 49 | "include/flatbuffers/default_allocator.h", |
| 50 | "include/flatbuffers/detached_buffer.h", |
| 51 | "include/flatbuffers/flatbuffer_builder.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 52 | "include/flatbuffers/flatbuffers.h", |
Austin Schuh | a1d006e | 2022-09-14 21:50:42 -0700 | [diff] [blame^] | 53 | "include/flatbuffers/flex_flat_util.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 54 | "include/flatbuffers/flexbuffers.h", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 55 | "include/flatbuffers/grpc.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 56 | "include/flatbuffers/hash.h", |
| 57 | "include/flatbuffers/idl.h", |
| 58 | "include/flatbuffers/minireflect.h", |
| 59 | "include/flatbuffers/reflection.h", |
| 60 | "include/flatbuffers/reflection_generated.h", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 61 | "include/flatbuffers/registry.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 62 | "include/flatbuffers/stl_emulation.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 63 | "include/flatbuffers/string.h", |
| 64 | "include/flatbuffers/struct.h", |
| 65 | "include/flatbuffers/table.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 66 | "include/flatbuffers/util.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 67 | "include/flatbuffers/vector.h", |
| 68 | "include/flatbuffers/vector_downward.h", |
| 69 | "include/flatbuffers/verifier.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 70 | ], |
| 71 | ) |
| 72 | |
| 73 | # Public flatc compiler library. |
| 74 | cc_library( |
| 75 | name = "flatc_library", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 76 | linkstatic = 1, |
| 77 | deps = [ |
| 78 | "//src:flatc_library", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 79 | ], |
| 80 | ) |
| 81 | |
| 82 | # Public flatc compiler. |
| 83 | cc_binary( |
| 84 | name = "flatc", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 85 | data = ["//reflection:reflection_fbs_schema"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 86 | deps = [ |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 87 | "//src:flatc", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 88 | ], |
| 89 | ) |
| 90 | |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 91 | filegroup( |
| 92 | name = "flatc_headers", |
| 93 | srcs = [ |
| 94 | "include/flatbuffers/flatc.h", |
| 95 | ], |
| 96 | visibility = ["//:__subpackages__"], |
| 97 | ) |
| 98 | |
| 99 | # Library used by flatbuffer_cc_library rules. |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 100 | cc_library( |
| 101 | name = "runtime_cc", |
| 102 | hdrs = [ |
| 103 | "include/flatbuffers/base.h", |
| 104 | "include/flatbuffers/flatbuffers.h", |
| 105 | "include/flatbuffers/flexbuffers.h", |
| 106 | "include/flatbuffers/stl_emulation.h", |
| 107 | "include/flatbuffers/util.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 108 | "include/flatbuffers/vector.h", |
| 109 | "include/flatbuffers/verifier.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 110 | ], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 111 | linkstatic = 1, |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 112 | strip_include_prefix = "/include", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 113 | ) |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 114 | |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 115 | py_library( |
| 116 | name = "flatpy", |
| 117 | srcs = glob(["python/flatbuffers/*.py"]), |
| 118 | imports = ["python/"], |
| 119 | ) |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 120 | |
| 121 | filegroup( |
| 122 | name = "flatjs", |
| 123 | srcs = ["js/flatbuffers.js"], |
| 124 | ) |