Convert TensorFlow's flatbuffers dependency to new third party import method
PiperOrigin-RevId: 209833197
This commit is contained in:
parent
ce127f779d
commit
13a4688fc3
@ -14,7 +14,7 @@ limitations under the License.
|
|||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
#include "tensorflow/contrib/lite/delegates/eager/kernel.h"
|
#include "tensorflow/contrib/lite/delegates/eager/kernel.h"
|
||||||
|
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/builtin_ops.h"
|
#include "tensorflow/contrib/lite/builtin_ops.h"
|
||||||
#include "tensorflow/contrib/lite/context.h"
|
#include "tensorflow/contrib/lite/context.h"
|
||||||
#include "tensorflow/contrib/lite/context_util.h"
|
#include "tensorflow/contrib/lite/context_util.h"
|
||||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/contrib/lite/delegates/eager/test_util.h"
|
#include "tensorflow/contrib/lite/delegates/eager/test_util.h"
|
||||||
|
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/string.h"
|
#include "tensorflow/contrib/lite/string.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
|
@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/context.h"
|
#include "tensorflow/contrib/lite/context.h"
|
||||||
#include "tensorflow/contrib/lite/experimental/kernels/ctc_beam_search.h"
|
#include "tensorflow/contrib/lite/experimental/kernels/ctc_beam_search.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/internal/optimized/optimized_ops.h"
|
#include "tensorflow/contrib/lite/kernels/internal/optimized/optimized_ops.h"
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/interpreter.h"
|
#include "tensorflow/contrib/lite/interpreter.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/register.h"
|
#include "tensorflow/contrib/lite/kernels/register.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
||||||
|
@ -22,7 +22,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/contrib/lite/kernels/kernel_util.h"
|
#include "tensorflow/contrib/lite/kernels/kernel_util.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/op_macros.h"
|
#include "tensorflow/contrib/lite/kernels/op_macros.h"
|
||||||
|
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/interpreter.h"
|
#include "tensorflow/contrib/lite/interpreter.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/register.h"
|
#include "tensorflow/contrib/lite/kernels/register.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/builtin_op_data.h"
|
#include "tensorflow/contrib/lite/builtin_op_data.h"
|
||||||
#include "tensorflow/contrib/lite/context.h"
|
#include "tensorflow/contrib/lite/context.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/internal/optimized/optimized_ops.h"
|
#include "tensorflow/contrib/lite/kernels/internal/optimized/optimized_ops.h"
|
||||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/interpreter.h"
|
#include "tensorflow/contrib/lite/interpreter.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/register.h"
|
#include "tensorflow/contrib/lite/kernels/register.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
||||||
|
@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
#include "tensorflow/contrib/lite/kernels/internal/mfcc.h"
|
#include "tensorflow/contrib/lite/kernels/internal/mfcc.h"
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/builtin_op_data.h"
|
#include "tensorflow/contrib/lite/builtin_op_data.h"
|
||||||
#include "tensorflow/contrib/lite/context.h"
|
#include "tensorflow/contrib/lite/context.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/internal/mfcc_dct.h"
|
#include "tensorflow/contrib/lite/kernels/internal/mfcc_dct.h"
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "flatbuffers/flexbuffers.h"
|
#include "flatbuffers/flexbuffers.h" // flatbuffers
|
||||||
#include "tensorflow/contrib/lite/interpreter.h"
|
#include "tensorflow/contrib/lite/interpreter.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/register.h"
|
#include "tensorflow/contrib/lite/kernels/register.h"
|
||||||
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
#include "tensorflow/contrib/lite/kernels/test_util.h"
|
||||||
|
@ -48,7 +48,7 @@ exports_files([
|
|||||||
"schema_v3.fbs",
|
"schema_v3.fbs",
|
||||||
])
|
])
|
||||||
|
|
||||||
load("//third_party/flatbuffers:build_defs.bzl", "flatbuffer_cc_library")
|
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
|
||||||
|
|
||||||
# Generic schema for inference on device.
|
# Generic schema for inference on device.
|
||||||
flatbuffer_cc_library(
|
flatbuffer_cc_library(
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "flatbuffers/flatc.h"
|
#include "flatbuffers/flatc.h" // flatbuffers
|
||||||
#include "tensorflow/core/platform/platform.h"
|
#include "tensorflow/core/platform/platform.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_GOOGLE
|
#ifdef PLATFORM_GOOGLE
|
||||||
|
@ -19,10 +19,10 @@ load(
|
|||||||
"//tensorflow/tools/def_file_filter:def_file_filter_configure.bzl",
|
"//tensorflow/tools/def_file_filter:def_file_filter_configure.bzl",
|
||||||
"def_file_filter_configure",
|
"def_file_filter_configure",
|
||||||
)
|
)
|
||||||
|
load("//third_party/flatbuffers:workspace.bzl", flatbuffers = "repo")
|
||||||
|
|
||||||
def initialize_third_party():
|
def initialize_third_party():
|
||||||
# Fill in later
|
flatbuffers()
|
||||||
pass
|
|
||||||
|
|
||||||
# Sanitize a dependency so that it works correctly from code that includes
|
# Sanitize a dependency so that it works correctly from code that includes
|
||||||
# TensorFlow as a submodule.
|
# TensorFlow as a submodule.
|
||||||
@ -740,18 +740,6 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
|
|||||||
build_file = clean_dep("//third_party:arm_neon_2_x86_sse.BUILD"),
|
build_file = clean_dep("//third_party:arm_neon_2_x86_sse.BUILD"),
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_http_archive(
|
|
||||||
name = "flatbuffers",
|
|
||||||
strip_prefix = "flatbuffers-1.9.0",
|
|
||||||
sha256 = "5ca5491e4260cacae30f1a5786d109230db3f3a6e5a0eb45d0d0608293d247e3",
|
|
||||||
urls = [
|
|
||||||
"https://mirror.bazel.build/github.com/google/flatbuffers/archive/v1.9.0.tar.gz",
|
|
||||||
"https://github.com/google/flatbuffers/archive/v1.9.0.tar.gz",
|
|
||||||
],
|
|
||||||
build_file = clean_dep("//third_party/flatbuffers:flatbuffers.BUILD"),
|
|
||||||
system_build_file = clean_dep("//third_party/systemlibs:flatbuffers.BUILD"),
|
|
||||||
)
|
|
||||||
|
|
||||||
native.new_http_archive(
|
native.new_http_archive(
|
||||||
name = "double_conversion",
|
name = "double_conversion",
|
||||||
urls = [
|
urls = [
|
||||||
|
16
third_party/flatbuffers/BUILD
vendored
16
third_party/flatbuffers/BUILD
vendored
@ -1,15 +1 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
# This empty BUILD file is required to make Bazel treat this directory as a package.
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "all_files",
|
|
||||||
srcs = glob(
|
|
||||||
["**/*"],
|
|
||||||
exclude = [
|
|
||||||
"**/METADATA",
|
|
||||||
"**/OWNERS",
|
|
||||||
],
|
|
||||||
),
|
|
||||||
visibility = ["//tensorflow:__subpackages__"],
|
|
||||||
)
|
|
||||||
|
@ -19,7 +19,10 @@ config_setting(
|
|||||||
|
|
||||||
FLATBUFFERS_COPTS = select({
|
FLATBUFFERS_COPTS = select({
|
||||||
":windows": [],
|
":windows": [],
|
||||||
"//conditions:default": ["-Wno-implicit-fallthrough", "-fexceptions"],
|
"//conditions:default": [
|
||||||
|
"-Wno-implicit-fallthrough",
|
||||||
|
"-fexceptions",
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
# Public flatc library to compile flatbuffer files at runtime.
|
# Public flatc library to compile flatbuffer files at runtime.
|
106
third_party/flatbuffers/build_defs.bzl
vendored
106
third_party/flatbuffers/build_defs.bzl
vendored
@ -1,5 +1,4 @@
|
|||||||
# Description:
|
"""BUILD rules for generating flatbuffer files."""
|
||||||
# BUILD rules for generating flatbuffer files.
|
|
||||||
|
|
||||||
flatc_path = "@flatbuffers//:flatc"
|
flatc_path = "@flatbuffers//:flatc"
|
||||||
|
|
||||||
@ -8,7 +7,8 @@ DEFAULT_FLATC_ARGS = [
|
|||||||
"--gen-object-api",
|
"--gen-object-api",
|
||||||
]
|
]
|
||||||
|
|
||||||
def flatbuffer_library_public(name,
|
def flatbuffer_library_public(
|
||||||
|
name,
|
||||||
srcs,
|
srcs,
|
||||||
outs,
|
outs,
|
||||||
language_flag,
|
language_flag,
|
||||||
@ -19,7 +19,11 @@ def flatbuffer_library_public(name,
|
|||||||
reflection_name = "",
|
reflection_name = "",
|
||||||
reflection_visiblity = None,
|
reflection_visiblity = None,
|
||||||
output_to_bindir = False):
|
output_to_bindir = False):
|
||||||
'''Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
|
"""Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
|
||||||
|
|
||||||
|
Outs:
|
||||||
|
filegroup(name): all generated source files.
|
||||||
|
Fileset([reflection_name]): (Optional) all generated reflection binaries.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
name: Rule name.
|
name: Rule name.
|
||||||
@ -35,16 +39,15 @@ def flatbuffer_library_public(name,
|
|||||||
reflection binaries for the schemas.
|
reflection binaries for the schemas.
|
||||||
reflection_visiblity: The visibility of the generated reflection Fileset.
|
reflection_visiblity: The visibility of the generated reflection Fileset.
|
||||||
output_to_bindir: Passed to genrule for output to bin directory.
|
output_to_bindir: Passed to genrule for output to bin directory.
|
||||||
Outs:
|
"""
|
||||||
filegroup(name): all generated source files.
|
|
||||||
Fileset([reflection_name]): (Optional) all generated reflection binaries.
|
|
||||||
'''
|
|
||||||
include_paths_cmd = ["-I %s" % (s) for s in include_paths]
|
include_paths_cmd = ["-I %s" % (s) for s in include_paths]
|
||||||
|
|
||||||
# '$(@D)' when given a single source target will give the appropriate
|
# '$(@D)' when given a single source target will give the appropriate
|
||||||
# directory. Appending 'out_prefix' is only necessary when given a build
|
# directory. Appending 'out_prefix' is only necessary when given a build
|
||||||
# target with multiple sources.
|
# target with multiple sources.
|
||||||
output_directory = (
|
output_directory = (
|
||||||
("-o $(@D)/%s" % (out_prefix)) if len(srcs) > 1 else ("-o $(@D)"))
|
("-o $(@D)/%s" % (out_prefix)) if len(srcs) > 1 else ("-o $(@D)")
|
||||||
|
)
|
||||||
genrule_cmd = " ".join([
|
genrule_cmd = " ".join([
|
||||||
"for f in $(SRCS); do",
|
"for f in $(SRCS); do",
|
||||||
"$(location %s)" % (flatc_path),
|
"$(location %s)" % (flatc_path),
|
||||||
@ -60,9 +63,10 @@ def flatbuffer_library_public(name,
|
|||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
outs = outs,
|
outs = outs,
|
||||||
output_to_bindir = output_to_bindir,
|
output_to_bindir = output_to_bindir,
|
||||||
tools=includes + [flatc_path,],
|
tools = includes + [flatc_path],
|
||||||
cmd = genrule_cmd,
|
cmd = genrule_cmd,
|
||||||
message="Generating flatbuffer files for %s:" % (name),)
|
message = "Generating flatbuffer files for %s:" % (name),
|
||||||
|
)
|
||||||
if reflection_name:
|
if reflection_name:
|
||||||
reflection_genrule_cmd = " ".join([
|
reflection_genrule_cmd = " ".join([
|
||||||
"for f in $(SRCS); do",
|
"for f in $(SRCS); do",
|
||||||
@ -76,52 +80,40 @@ def flatbuffer_library_public(name,
|
|||||||
"done",
|
"done",
|
||||||
])
|
])
|
||||||
reflection_outs = [
|
reflection_outs = [
|
||||||
(out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1]) for s in srcs
|
(out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1])
|
||||||
|
for s in srcs
|
||||||
]
|
]
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = "%s_srcs" % reflection_name,
|
name = "%s_srcs" % reflection_name,
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
outs = reflection_outs,
|
outs = reflection_outs,
|
||||||
output_to_bindir = output_to_bindir,
|
output_to_bindir = output_to_bindir,
|
||||||
tools=includes + [flatc_path,],
|
tools = includes + [flatc_path],
|
||||||
cmd = reflection_genrule_cmd,
|
cmd = reflection_genrule_cmd,
|
||||||
message="Generating flatbuffer reflection binary for %s:" % (name),)
|
message = "Generating flatbuffer reflection binary for %s:" % (name),
|
||||||
|
)
|
||||||
native.Fileset(
|
native.Fileset(
|
||||||
name = reflection_name,
|
name = reflection_name,
|
||||||
out = "%s_out" % reflection_name,
|
out = "%s_out" % reflection_name,
|
||||||
entries = [
|
entries = [
|
||||||
native.FilesetEntry(files = reflection_outs),
|
native.FilesetEntry(files = reflection_outs),
|
||||||
],
|
],
|
||||||
visibility=reflection_visiblity
|
visibility = reflection_visiblity,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def flatbuffer_cc_library(
|
||||||
def flatbuffer_cc_library(name, srcs, srcs_filegroup_name="",
|
name,
|
||||||
out_prefix="", includes=[], include_paths=[],
|
srcs,
|
||||||
|
srcs_filegroup_name = "",
|
||||||
|
out_prefix = "",
|
||||||
|
includes = [],
|
||||||
|
include_paths = [],
|
||||||
flatc_args = DEFAULT_FLATC_ARGS,
|
flatc_args = DEFAULT_FLATC_ARGS,
|
||||||
visibility=None, srcs_filegroup_visibility=None,
|
visibility = None,
|
||||||
|
srcs_filegroup_visibility = None,
|
||||||
gen_reflections = False):
|
gen_reflections = False):
|
||||||
'''A cc_library with the generated reader/writers for the given flatbuffer definitions.
|
'''A cc_library with the generated reader/writers for the given flatbuffer definitions.
|
||||||
|
|
||||||
Args:
|
|
||||||
name: Rule name.
|
|
||||||
srcs: Source .fbs files. Sent in order to the compiler.
|
|
||||||
srcs_filegroup_name: Name of the output filegroup that holds srcs. Pass this
|
|
||||||
filegroup into the `includes` parameter of any other
|
|
||||||
flatbuffer_cc_library that depends on this one's schemas.
|
|
||||||
out_prefix: Prepend this path to the front of all generated files. Usually
|
|
||||||
is a directory name.
|
|
||||||
includes: Optional, list of filegroups of schemas that the srcs depend on.
|
|
||||||
** SEE REMARKS BELOW **
|
|
||||||
include_paths: Optional, list of paths the includes files can be found in.
|
|
||||||
flatc_args: Optional list of additional arguments to pass to flatc
|
|
||||||
(e.g. --gen-mutable).
|
|
||||||
visibility: The visibility of the generated cc_library. By default, use the
|
|
||||||
default visibility of the project.
|
|
||||||
srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
|
|
||||||
By default, use the value of the visibility parameter above.
|
|
||||||
gen_reflections: Optional, if true this will generate the flatbuffer
|
|
||||||
reflection binaries for the schemas.
|
|
||||||
Outs:
|
Outs:
|
||||||
filegroup([name]_srcs): all generated .h files.
|
filegroup([name]_srcs): all generated .h files.
|
||||||
filegroup(srcs_filegroup_name if specified, or [name]_includes if not):
|
filegroup(srcs_filegroup_name if specified, or [name]_includes if not):
|
||||||
@ -159,13 +151,35 @@ def flatbuffer_cc_library(name, srcs, srcs_filegroup_name="",
|
|||||||
)
|
)
|
||||||
|
|
||||||
Happy dependent Flatbuffering!
|
Happy dependent Flatbuffering!
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: Rule name.
|
||||||
|
srcs: Source .fbs files. Sent in order to the compiler.
|
||||||
|
srcs_filegroup_name: Name of the output filegroup that holds srcs. Pass this
|
||||||
|
filegroup into the `includes` parameter of any other
|
||||||
|
flatbuffer_cc_library that depends on this one's schemas.
|
||||||
|
out_prefix: Prepend this path to the front of all generated files. Usually
|
||||||
|
is a directory name.
|
||||||
|
includes: Optional, list of filegroups of schemas that the srcs depend on.
|
||||||
|
** SEE REMARKS BELOW **
|
||||||
|
include_paths: Optional, list of paths the includes files can be found in.
|
||||||
|
flatc_args: Optional list of additional arguments to pass to flatc
|
||||||
|
(e.g. --gen-mutable).
|
||||||
|
visibility: The visibility of the generated cc_library. By default, use the
|
||||||
|
default visibility of the project.
|
||||||
|
srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
|
||||||
|
By default, use the value of the visibility parameter above.
|
||||||
|
gen_reflections: Optional, if true this will generate the flatbuffer
|
||||||
|
reflection binaries for the schemas.
|
||||||
'''
|
'''
|
||||||
output_headers = [
|
output_headers = [
|
||||||
(out_prefix + "%s_generated.h") % (s.replace(".fbs", "").split("/")[-1]) for s in srcs
|
(out_prefix + "%s_generated.h") % (s.replace(".fbs", "").split("/")[-1])
|
||||||
|
for s in srcs
|
||||||
]
|
]
|
||||||
reflection_name = "%s_reflection" % name if gen_reflections else ""
|
reflection_name = "%s_reflection" % name if gen_reflections else ""
|
||||||
|
|
||||||
flatbuffer_library_public(name="%s_srcs" % (name),
|
flatbuffer_library_public(
|
||||||
|
name = "%s_srcs" % (name),
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
outs = output_headers,
|
outs = output_headers,
|
||||||
language_flag = "-c",
|
language_flag = "-c",
|
||||||
@ -174,8 +188,10 @@ def flatbuffer_cc_library(name, srcs, srcs_filegroup_name="",
|
|||||||
include_paths = include_paths,
|
include_paths = include_paths,
|
||||||
flatc_args = flatc_args,
|
flatc_args = flatc_args,
|
||||||
reflection_name = reflection_name,
|
reflection_name = reflection_name,
|
||||||
reflection_visiblity=visibility,)
|
reflection_visiblity = visibility,
|
||||||
native.cc_library(name=name,
|
)
|
||||||
|
native.cc_library(
|
||||||
|
name = name,
|
||||||
hdrs = output_headers,
|
hdrs = output_headers,
|
||||||
srcs = output_headers,
|
srcs = output_headers,
|
||||||
features = [
|
features = [
|
||||||
@ -186,11 +202,13 @@ def flatbuffer_cc_library(name, srcs, srcs_filegroup_name="",
|
|||||||
],
|
],
|
||||||
includes = ["."],
|
includes = ["."],
|
||||||
linkstatic = 1,
|
linkstatic = 1,
|
||||||
visibility=visibility)
|
visibility = visibility,
|
||||||
|
)
|
||||||
|
|
||||||
# A filegroup for the `srcs`. That is, all the schema files for this
|
# A filegroup for the `srcs`. That is, all the schema files for this
|
||||||
# Flatbuffer set.
|
# Flatbuffer set.
|
||||||
native.filegroup(
|
native.filegroup(
|
||||||
name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
|
name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
visibility=srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility)
|
visibility = srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility,
|
||||||
|
)
|
||||||
|
19
third_party/flatbuffers/workspace.bzl
vendored
Normal file
19
third_party/flatbuffers/workspace.bzl
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
"""Loads the Flatbuffers library, used by TF Lite."""
|
||||||
|
|
||||||
|
load("//third_party:repo.bzl", "third_party_http_archive")
|
||||||
|
|
||||||
|
def repo():
|
||||||
|
third_party_http_archive(
|
||||||
|
name = "flatbuffers",
|
||||||
|
strip_prefix = "flatbuffers-1.9.0",
|
||||||
|
sha256 = "5ca5491e4260cacae30f1a5786d109230db3f3a6e5a0eb45d0d0608293d247e3",
|
||||||
|
urls = [
|
||||||
|
"https://mirror.bazel.build/github.com/google/flatbuffers/archive/v1.9.0.tar.gz",
|
||||||
|
"https://github.com/google/flatbuffers/archive/v1.9.0.tar.gz",
|
||||||
|
],
|
||||||
|
build_file = "//third_party/flatbuffers:BUILD.bazel",
|
||||||
|
system_build_file = "//third_party/flatbuffers:BUILD.system",
|
||||||
|
link_files = {
|
||||||
|
"//third_party/flatbuffers:build_defs.bzl": "build_defs.bzl",
|
||||||
|
},
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user