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