1load("@build_bazel_rules_android//android:rules.bzl", "android_library") 2 3package(default_visibility = ["//visibility:public"]) 4 5licenses(["notice"]) # Apache 2.0 6 7exports_files(["LICENSE.txt"]) 8 9licenses(["notice"]) 10 11config_setting( 12 name = "freebsd", 13 values = {"cpu": "freebsd"}, 14) 15 16config_setting( 17 name = "windows", 18 values = {"cpu": "x64_windows"}, 19) 20 21load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") 22 23# Public flatc library to compile flatbuffer files at runtime. 24cc_library( 25 name = "flatbuffers", 26 hdrs = ["//:public_headers"], 27 linkstatic = 1, 28 strip_include_prefix = "/include", 29 visibility = ["//visibility:public"], 30 deps = ["//src:flatbuffers"], 31) 32 33# Public C++ headers for the Flatbuffers library. 34filegroup( 35 name = "public_headers", 36 srcs = [ 37 "include/flatbuffers/base.h", 38 "include/flatbuffers/code_generators.h", 39 "include/flatbuffers/flatbuffers.h", 40 "include/flatbuffers/flexbuffers.h", 41 "include/flatbuffers/hash.h", 42 "include/flatbuffers/idl.h", 43 "include/flatbuffers/minireflect.h", 44 "include/flatbuffers/reflection.h", 45 "include/flatbuffers/reflection_generated.h", 46 "include/flatbuffers/registry.h", 47 "include/flatbuffers/stl_emulation.h", 48 "include/flatbuffers/util.h", 49 ], 50 visibility = ["//:__subpackages__"], 51) 52 53# Public flatc compiler library. 54cc_library( 55 name = "flatc_library", 56 linkstatic = 1, 57 visibility = ["//visibility:public"], 58 deps = [ 59 "@flatbuffers//src:flatc_library", 60 ], 61) 62 63# Public flatc compiler. 64cc_binary( 65 name = "flatc", 66 linkopts = select({ 67 ":freebsd": [ 68 "-lm", 69 ], 70 ":windows": [], 71 "//conditions:default": [ 72 "-lm", 73 "-ldl", 74 ], 75 }), 76 visibility = ["//visibility:public"], 77 deps = [ 78 "@flatbuffers//src:flatc", 79 ], 80) 81 82filegroup( 83 name = "flatc_headers", 84 srcs = [ 85 "include/flatbuffers/flatc.h", 86 ], 87 visibility = ["//:__subpackages__"], 88) 89 90# Library used by flatbuffer_cc_library rules. 91cc_library( 92 name = "runtime_cc", 93 hdrs = [ 94 "include/flatbuffers/base.h", 95 "include/flatbuffers/flatbuffers.h", 96 "include/flatbuffers/flexbuffers.h", 97 "include/flatbuffers/stl_emulation.h", 98 "include/flatbuffers/util.h", 99 ], 100 linkstatic = 1, 101 strip_include_prefix = "/include", 102 visibility = ["//visibility:public"], 103) 104 105filegroup( 106 name = "runtime_py_srcs", 107 srcs = [ 108 "python/flatbuffers/__init__.py", 109 "python/flatbuffers/builder.py", 110 "python/flatbuffers/compat.py", 111 "python/flatbuffers/encode.py", 112 "python/flatbuffers/number_types.py", 113 "python/flatbuffers/packer.py", 114 "python/flatbuffers/table.py", 115 "python/flatbuffers/util.py", 116 ], 117) 118 119py_library( 120 name = "runtime_py", 121 srcs = [":runtime_py_srcs"], 122 visibility = ["//visibility:public"], 123) 124 125filegroup( 126 name = "runtime_java_srcs", 127 srcs = glob(["java/com/google/flatbuffers/**/*.java"]), 128) 129 130java_library( 131 name = "runtime_java", 132 srcs = [":runtime_java_srcs"], 133 visibility = ["//visibility:public"], 134) 135 136android_library( 137 name = "runtime_android", 138 srcs = [":runtime_java_srcs"], 139 visibility = ["//visibility:public"], 140) 141