1package(default_visibility = ["//visibility:public"]) 2 3licenses(["notice"]) 4 5exports_files(["LICENSE.txt"]) 6 7licenses(["notice"]) 8 9config_setting( 10 name = "freebsd", 11 values = {"cpu": "freebsd"}, 12) 13 14config_setting( 15 name = "windows", 16 values = {"cpu": "x64_windows"}, 17) 18 19load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") 20 21# Public flatc library to compile flatbuffer files at runtime. 22cc_library( 23 name = "flatbuffers", 24 hdrs = ["//:public_headers"], 25 linkstatic = 1, 26 strip_include_prefix = "/include", 27 visibility = ["//visibility:public"], 28 deps = ["//src:flatbuffers"], 29) 30 31# Public C++ headers for the Flatbuffers library. 32filegroup( 33 name = "public_headers", 34 srcs = [ 35 "include/flatbuffers/base.h", 36 "include/flatbuffers/code_generators.h", 37 "include/flatbuffers/flatbuffers.h", 38 "include/flatbuffers/flexbuffers.h", 39 "include/flatbuffers/hash.h", 40 "include/flatbuffers/idl.h", 41 "include/flatbuffers/minireflect.h", 42 "include/flatbuffers/reflection.h", 43 "include/flatbuffers/reflection_generated.h", 44 "include/flatbuffers/registry.h", 45 "include/flatbuffers/stl_emulation.h", 46 "include/flatbuffers/util.h", 47 ], 48 visibility = ["//:__subpackages__"], 49) 50 51# Public flatc compiler library. 52cc_library( 53 name = "flatc_library", 54 linkstatic = 1, 55 visibility = ["//visibility:public"], 56 deps = [ 57 "@flatbuffers//src:flatc_library", 58 ], 59) 60 61# Public flatc compiler. 62cc_binary( 63 name = "flatc", 64 linkopts = select({ 65 ":freebsd": [ 66 "-lm", 67 ], 68 ":windows": [], 69 "//conditions:default": [ 70 "-lm", 71 "-ldl", 72 ], 73 }), 74 visibility = ["//visibility:public"], 75 deps = [ 76 "@flatbuffers//src:flatc", 77 ], 78) 79 80filegroup( 81 name = "flatc_headers", 82 srcs = [ 83 "include/flatbuffers/flatc.h", 84 ], 85 visibility = ["//:__subpackages__"], 86) 87 88# Library used by flatbuffer_cc_library rules. 89cc_library( 90 name = "runtime_cc", 91 hdrs = [ 92 "include/flatbuffers/base.h", 93 "include/flatbuffers/flatbuffers.h", 94 "include/flatbuffers/flexbuffers.h", 95 "include/flatbuffers/stl_emulation.h", 96 "include/flatbuffers/util.h", 97 ], 98 linkstatic = 1, 99 strip_include_prefix = "/include", 100 visibility = ["//visibility:public"], 101) 102 103