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"], |
James Kuszmaul | f5eb468 | 2023-09-22 17:16:59 -0700 | [diff] [blame^] | 44 | defines = ["FLATBUFFERS_USE_STD_SPAN"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 45 | linkstatic = 1, |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 46 | strip_include_prefix = "/include", |
| 47 | deps = ["//src:flatbuffers"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 48 | ) |
| 49 | |
| 50 | # Public C++ headers for the Flatbuffers library. |
| 51 | filegroup( |
| 52 | name = "public_headers", |
| 53 | srcs = [ |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 54 | "include/flatbuffers/allocator.h", |
| 55 | "include/flatbuffers/array.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 56 | "include/flatbuffers/base.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 57 | "include/flatbuffers/bfbs_generator.h", |
| 58 | "include/flatbuffers/buffer.h", |
| 59 | "include/flatbuffers/buffer_ref.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 60 | "include/flatbuffers/code_generators.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 61 | "include/flatbuffers/default_allocator.h", |
| 62 | "include/flatbuffers/detached_buffer.h", |
| 63 | "include/flatbuffers/flatbuffer_builder.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 64 | "include/flatbuffers/flatbuffers.h", |
Austin Schuh | a1d006e | 2022-09-14 21:50:42 -0700 | [diff] [blame] | 65 | "include/flatbuffers/flex_flat_util.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 66 | "include/flatbuffers/flexbuffers.h", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 67 | "include/flatbuffers/grpc.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 68 | "include/flatbuffers/hash.h", |
| 69 | "include/flatbuffers/idl.h", |
| 70 | "include/flatbuffers/minireflect.h", |
| 71 | "include/flatbuffers/reflection.h", |
| 72 | "include/flatbuffers/reflection_generated.h", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 73 | "include/flatbuffers/registry.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 74 | "include/flatbuffers/stl_emulation.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 75 | "include/flatbuffers/string.h", |
| 76 | "include/flatbuffers/struct.h", |
| 77 | "include/flatbuffers/table.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 78 | "include/flatbuffers/util.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 79 | "include/flatbuffers/vector.h", |
| 80 | "include/flatbuffers/vector_downward.h", |
| 81 | "include/flatbuffers/verifier.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 82 | ], |
| 83 | ) |
| 84 | |
| 85 | # Public flatc compiler library. |
| 86 | cc_library( |
| 87 | name = "flatc_library", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 88 | linkstatic = 1, |
| 89 | deps = [ |
| 90 | "//src:flatc_library", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 91 | ], |
| 92 | ) |
| 93 | |
| 94 | # Public flatc compiler. |
| 95 | cc_binary( |
| 96 | name = "flatc", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 97 | data = ["//reflection:reflection_fbs_schema"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 98 | deps = [ |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 99 | "//src:flatc", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 100 | ], |
| 101 | ) |
| 102 | |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 103 | filegroup( |
| 104 | name = "flatc_headers", |
| 105 | srcs = [ |
| 106 | "include/flatbuffers/flatc.h", |
| 107 | ], |
| 108 | visibility = ["//:__subpackages__"], |
| 109 | ) |
| 110 | |
| 111 | # Library used by flatbuffer_cc_library rules. |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 112 | cc_library( |
| 113 | name = "runtime_cc", |
| 114 | hdrs = [ |
| 115 | "include/flatbuffers/base.h", |
| 116 | "include/flatbuffers/flatbuffers.h", |
| 117 | "include/flatbuffers/flexbuffers.h", |
| 118 | "include/flatbuffers/stl_emulation.h", |
| 119 | "include/flatbuffers/util.h", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 120 | "include/flatbuffers/vector.h", |
| 121 | "include/flatbuffers/verifier.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 122 | ], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 123 | linkstatic = 1, |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame] | 124 | strip_include_prefix = "/include", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 125 | ) |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 126 | |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 127 | py_library( |
| 128 | name = "flatpy", |
| 129 | srcs = glob(["python/flatbuffers/*.py"]), |
| 130 | imports = ["python/"], |
| 131 | ) |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 132 | |
| 133 | filegroup( |
| 134 | name = "flatjs", |
| 135 | srcs = ["js/flatbuffers.js"], |
| 136 | ) |