Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 1 | licenses(["notice"]) |
| 2 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 3 | load("@//tools:environments.bzl", "mcu_cpus") |
| 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", |
| 11 | ]) |
| 12 | |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 13 | # Public flatc library to compile flatbuffer files at runtime. |
| 14 | cc_library( |
| 15 | name = "flatbuffers", |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 16 | copts = ["-Wno-cast-align"], |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 17 | hdrs = ["//:public_headers"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 18 | linkstatic = 1, |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 19 | strip_include_prefix = "/include", |
| 20 | deps = ["//src:flatbuffers"], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 21 | ) |
| 22 | |
| 23 | # Public C++ headers for the Flatbuffers library. |
| 24 | filegroup( |
| 25 | name = "public_headers", |
| 26 | srcs = [ |
| 27 | "include/flatbuffers/base.h", |
| 28 | "include/flatbuffers/code_generators.h", |
| 29 | "include/flatbuffers/flatbuffers.h", |
| 30 | "include/flatbuffers/flexbuffers.h", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 31 | "include/flatbuffers/grpc.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 32 | "include/flatbuffers/hash.h", |
| 33 | "include/flatbuffers/idl.h", |
| 34 | "include/flatbuffers/minireflect.h", |
| 35 | "include/flatbuffers/reflection.h", |
| 36 | "include/flatbuffers/reflection_generated.h", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 37 | "include/flatbuffers/registry.h", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 38 | "include/flatbuffers/stl_emulation.h", |
| 39 | "include/flatbuffers/util.h", |
| 40 | ], |
| 41 | ) |
| 42 | |
| 43 | # Public flatc compiler library. |
| 44 | cc_library( |
| 45 | name = "flatc_library", |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 46 | linkstatic = 1, |
| 47 | deps = [ |
| 48 | "//src:flatc_library", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 49 | ], |
| 50 | ) |
| 51 | |
| 52 | # Public flatc compiler. |
| 53 | cc_binary( |
| 54 | name = "flatc", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 55 | data = [ |
| 56 | "reflection/reflection.fbs", |
| 57 | ], |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 58 | deps = [ |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 59 | "//src:flatc", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 60 | ], |
| 61 | ) |
| 62 | |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 63 | filegroup( |
| 64 | name = "flatc_headers", |
| 65 | srcs = [ |
| 66 | "include/flatbuffers/flatc.h", |
| 67 | ], |
| 68 | visibility = ["//:__subpackages__"], |
| 69 | ) |
| 70 | |
| 71 | # Library used by flatbuffer_cc_library rules. |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 72 | cc_library( |
| 73 | name = "runtime_cc", |
| 74 | hdrs = [ |
| 75 | "include/flatbuffers/base.h", |
| 76 | "include/flatbuffers/flatbuffers.h", |
| 77 | "include/flatbuffers/flexbuffers.h", |
| 78 | "include/flatbuffers/stl_emulation.h", |
| 79 | "include/flatbuffers/util.h", |
| 80 | ], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 81 | compatible_with = mcu_cpus, |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 82 | linkstatic = 1, |
Austin Schuh | 7c75e58 | 2020-11-14 16:41:18 -0800 | [diff] [blame^] | 83 | strip_include_prefix = "/include", |
Austin Schuh | 4ac96a8 | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 84 | ) |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 85 | py_library( |
| 86 | name = "flatpy", |
| 87 | srcs = glob(["python/flatbuffers/*.py"]), |
| 88 | imports = ["python/"], |
| 89 | ) |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 90 | |
| 91 | filegroup( |
| 92 | name = "flatjs", |
| 93 | srcs = ["js/flatbuffers.js"], |
| 94 | ) |