More refactoring of the portable builds.
PiperOrigin-RevId: 294873040 Change-Id: Ic1805c0cbfa90e0351c3012a1af47583cd54341c
This commit is contained in:
parent
d6d658bc56
commit
16d4b320f0
@ -454,6 +454,51 @@ config_setting(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Specifies via a config setting if this is a mobile build or not, makes
|
||||
# it easier to combine settings later.
|
||||
selects.config_setting_group(
|
||||
name = "mobile",
|
||||
match_any = [
|
||||
":android",
|
||||
":chromiumos",
|
||||
":emscripten",
|
||||
":ios",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "lite_protos_legacy",
|
||||
values = {"define": "TENSORFLOW_PROTOS=lite"},
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "full_protos",
|
||||
values = {"define": "TENSORFLOW_PROTOS=full"},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "lite_protos",
|
||||
match_any = [":lite_protos_legacy"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "mobile_lite_protos",
|
||||
match_all = [
|
||||
":lite_protos",
|
||||
":mobile",
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "mobile_full_protos",
|
||||
match_all = [
|
||||
":full_protos",
|
||||
":mobile",
|
||||
],
|
||||
)
|
||||
|
||||
# DO NOT ADD ANY NEW EXCEPTIONS TO THIS LIST!
|
||||
# Instead, please use public APIs or public build rules TF provides.
|
||||
# If you need functionality that is not exposed, we will work with you to expand our public APIs.
|
||||
|
@ -78,7 +78,7 @@ tf_portable_proto_library(
|
||||
name = "portable_tf2xla_proto",
|
||||
config_string = "allow_all:true",
|
||||
header_outs = ["//tensorflow/compiler/tf2xla/tf2xla.proto.h"],
|
||||
portable_deps = ["//tensorflow/core:android_proto_lib"],
|
||||
portable_deps = ["//tensorflow/core:portable_proto_lib_full_runtime"],
|
||||
proto_deps = [
|
||||
":tf2xla_proto",
|
||||
"//tensorflow/core:protos_all",
|
||||
|
@ -44,14 +44,14 @@
|
||||
# ":example_parser_configuration" -- A library for extracting the
|
||||
# tensorflow.Example proto configuration from a Graph.
|
||||
#
|
||||
# Public Android targets:
|
||||
# Public mobile targets, e.g. for Android:
|
||||
#
|
||||
# filegroup ":android_proto_srcs" - Protos
|
||||
# filegroup ":android_srcs" - Core sources
|
||||
# cc_library ":android_tensorflow_lib" - Native library
|
||||
# cc_library ":android_tensorflow_lib_lite" - Native library, without ops,
|
||||
# cc_library ":portable_tensorflow_lib" - Native library
|
||||
# cc_library ":portable_tensorflow_lib_lite" - Native library, without ops,
|
||||
# supporting SELECTIVE_REGISTRATION feature.
|
||||
# portable_proto_library ":android_proto_lib" (Google-internal)
|
||||
# portable_proto_library ":portable_proto_lib" (Google-internal)
|
||||
#
|
||||
# Note that :framework and :lib have incomplete transitive dependencies (they
|
||||
# declare but do not define some symbols) if framework_shared_object=True
|
||||
@ -77,12 +77,14 @@ load(
|
||||
"tf_cc_tests",
|
||||
"tf_copts",
|
||||
"tf_cuda_library",
|
||||
"tf_defines_nortti_if_android",
|
||||
"tf_features_nomodules_if_android",
|
||||
"tf_defines_nortti_if_lite_protos",
|
||||
"tf_features_nomodules_if_mobile",
|
||||
"tf_gen_op_libs",
|
||||
"tf_genrule_cmd_append_to_srcs",
|
||||
"tf_openmp_copts",
|
||||
"tf_opts_nortti_if_android",
|
||||
"tf_opts_nortti_if_lite_protos",
|
||||
"tf_opts_nortti_if_mobile",
|
||||
"tf_portable_full_lite_protos",
|
||||
"transitive_hdrs",
|
||||
)
|
||||
|
||||
@ -92,9 +94,6 @@ load("//tensorflow:tensorflow.bzl", "if_nccl")
|
||||
# buildifier: disable=same-origin-load
|
||||
load("//tensorflow:tensorflow.bzl", "tensorflow_opensource_extra_deps")
|
||||
|
||||
# buildifier: disable=same-origin-load
|
||||
# load("//tensorflow:tensorflow.bzl", "tf_android_full_lite_protos")
|
||||
|
||||
# buildifier: disable=same-origin-load
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_test_gpu")
|
||||
|
||||
@ -242,7 +241,7 @@ ERROR_CODES_PROTO_SRCS = [
|
||||
"protobuf/error_codes.proto",
|
||||
"//tensorflow/core/lib/core:error_codes.proto",
|
||||
]
|
||||
# LINT.ThenChange(//tensorflow/core/android_proto_config.asciipb)
|
||||
# LINT.ThenChange(//tensorflow/core/portable_proto_config.asciipb)
|
||||
|
||||
CORE_PROTO_SRCS = COMMON_PROTO_SRCS + EXAMPLE_PROTO_SRCS + FRAMEWORK_PROTO_SRCS + UTIL_PROTO_SRCS + PROFILER_PROTO_SRCS + ERROR_CODES_PROTO_SRCS
|
||||
|
||||
@ -1354,50 +1353,61 @@ alias(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Native library support for Android applications. Does not contain
|
||||
# operators, use :android_tensorflow_lib if you want full operator
|
||||
# Native library support for mobile applications. Does not contain
|
||||
# operators, use :portable_tensorflow_lib if you want full operator
|
||||
# support.
|
||||
#
|
||||
# If you just need TensorFlow types, e.g. Tensors, use
|
||||
# :android_tensorflow_lib_lite_no_runtime.
|
||||
# :portable_tensorflow_lib_lite_no_runtime.
|
||||
#
|
||||
# Compiles to a trivial library on non-Android to prevent irrelevant
|
||||
# build errors. If not building this as part of an android_binary,
|
||||
# These targets link against either full or lite protos depending
|
||||
# on the bazel define TENSORFLOW_PROTOS=full/lite respectively.
|
||||
#
|
||||
# Compiles to a trivial library on non-mobile to prevent irrelevant
|
||||
# build errors. If not building this e.g. as part of an android_binary,
|
||||
# a command such as the following must be used:
|
||||
# bazel build -c opt tensorflow/core:android_tensorflow_lib \
|
||||
# --define=TENSORFLOW_PROTOS=lite \
|
||||
# --crosstool_top=//external:android/crosstool \
|
||||
# --cpu=armeabi-v7a \
|
||||
# --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
|
||||
cc_library(
|
||||
name = "android_tensorflow_lib_lite",
|
||||
srcs = if_android([":mobile_srcs"]),
|
||||
copts = tf_copts(android_optimization_level_override = None),
|
||||
defines = ["SUPPORT_SELECTIVE_REGISTRATION"],
|
||||
linkopts = ["-lz"],
|
||||
name = "portable_tensorflow_lib_lite",
|
||||
srcs = if_mobile([":mobile_srcs"]),
|
||||
copts = tf_copts(android_optimization_level_override = None) + tf_opts_nortti_if_lite_protos() + if_ios(["-Os"]),
|
||||
defines = ["SUPPORT_SELECTIVE_REGISTRATION"] + tf_portable_full_lite_protos(
|
||||
full = [],
|
||||
lite = ["TENSORFLOW_LITE_PROTOS"],
|
||||
) + if_chromiumos(["IS_MOBILE_PLATFORM"]) + tf_defines_nortti_if_lite_protos(),
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = tf_portable_deps_no_runtime(),
|
||||
deps = [
|
||||
":protos_all_cc_impl",
|
||||
"//tensorflow/core/util:stats_calculator_portable",
|
||||
"//tensorflow/core:mobile_additional_lib_deps",
|
||||
] + tf_portable_deps_no_runtime(),
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "android_tensorflow_lib_lite_nortti",
|
||||
srcs = if_android([":mobile_srcs"]),
|
||||
copts = tf_copts(android_optimization_level_override = None) + tf_opts_nortti_if_android(),
|
||||
defines = [
|
||||
"SUPPORT_SELECTIVE_REGISTRATION",
|
||||
] + tf_defines_nortti_if_android(),
|
||||
linkopts = ["-lz"],
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
],
|
||||
alias(
|
||||
name = "android_tensorflow_lib_lite",
|
||||
actual = ":portable_tensorflow_lib_lite",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "android_tensorflow_lib_lite_nortti",
|
||||
actual = ":portable_tensorflow_lib_lite",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "android_tensorflow_lib_lite_nortti_lite_protos",
|
||||
actual = ":portable_tensorflow_lib_lite",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = tf_portable_deps_no_runtime(),
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@ -1417,14 +1427,14 @@ cc_library(
|
||||
cc_library(
|
||||
name = "ios_tensorflow_lib",
|
||||
srcs = if_ios([
|
||||
":android_op_registrations_and_gradients",
|
||||
":portable_op_registrations_and_gradients",
|
||||
"//tensorflow/core/kernels:android_core_ops",
|
||||
"//tensorflow/core/kernels:android_extended_ops",
|
||||
]),
|
||||
copts = tf_copts() + ["-Os"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":ios_tensorflow_lib_lite",
|
||||
":portable_tensorflow_lib_lite",
|
||||
":protos_all_cc_impl",
|
||||
"//third_party/eigen3",
|
||||
"//third_party/fft2d:fft2d_headers",
|
||||
@ -1435,13 +1445,10 @@ cc_library(
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
alias(
|
||||
name = "ios_tensorflow_lib_lite",
|
||||
srcs = if_ios([":mobile_srcs"]),
|
||||
copts = tf_copts() + ["-Os"],
|
||||
actual = ":portable_tensorflow_lib_lite",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = tf_portable_deps_no_runtime(),
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@ -1455,8 +1462,8 @@ cc_library(
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":android_test_proto_lib",
|
||||
":ios_tensorflow_lib",
|
||||
":portable_test_proto_lib",
|
||||
"//tensorflow/core/platform/default/build_config:gtest",
|
||||
"//third_party/eigen3",
|
||||
],
|
||||
@ -1464,27 +1471,40 @@ cc_library(
|
||||
|
||||
# Full TensorFlow library with operator support. Use this unless reducing
|
||||
# binary size (by packaging a reduced operator set) is a concern.
|
||||
cc_library(
|
||||
alias(
|
||||
name = "android_tensorflow_lib",
|
||||
srcs = if_android([":android_op_registrations_and_gradients"]),
|
||||
copts = tf_copts(),
|
||||
actual = ":portable_tensorflow_lib",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "portable_tensorflow_lib",
|
||||
srcs = if_mobile([":portable_op_registrations_and_gradients"]),
|
||||
copts = tf_copts() + tf_opts_nortti_if_lite_protos(),
|
||||
features = tf_features_nomodules_if_mobile(),
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":android_tensorflow_lib_lite",
|
||||
":portable_tensorflow_lib_lite",
|
||||
":protos_all_cc_impl",
|
||||
"//tensorflow/core/kernels:android_tensorflow_kernels",
|
||||
"//tensorflow/core/kernels:portable_tensorflow_kernels",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_protobuf//:protobuf",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
filegroup(
|
||||
alias(
|
||||
name = "android_op_registrations_and_gradients",
|
||||
actual = ":portable_op_registrations_and_gradients",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "portable_op_registrations_and_gradients",
|
||||
srcs = ["//tensorflow/c/kernels:android_all_ops"] + glob(
|
||||
[
|
||||
"ops/**/*.cc",
|
||||
@ -1506,12 +1526,20 @@ filegroup(
|
||||
testonly = 1,
|
||||
# TODO(andrewharp/nhua):
|
||||
# make more test-related sources portable e.g. "//tensorflow/core/platform:test.cc",
|
||||
srcs = [
|
||||
"//tensorflow/core/framework:android_test_hdrs",
|
||||
"//tensorflow/core/framework:android_test_srcs",
|
||||
"//tensorflow/core/platform:android_test_srcs",
|
||||
"//tensorflow/core/util:android_test_srcs",
|
||||
],
|
||||
srcs = tf_portable_full_lite_protos(
|
||||
full = [
|
||||
"//tensorflow/core/framework:android_test_hdrs",
|
||||
"//tensorflow/core/framework:android_test_srcs",
|
||||
"//tensorflow/core/platform:android_test_srcs",
|
||||
"//tensorflow/core/util:android_test_srcs",
|
||||
],
|
||||
lite = [
|
||||
"//tensorflow/core/framework:android_test_hdrs",
|
||||
"//tensorflow/core/framework:android_test_srcs_no_core",
|
||||
"//tensorflow/core/platform:android_test_srcs",
|
||||
"//tensorflow/core/util:android_test_srcs",
|
||||
],
|
||||
),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@ -1529,23 +1557,33 @@ filegroup(
|
||||
)
|
||||
|
||||
# Portable library providing testing functionality for TensorFlow.
|
||||
cc_library(
|
||||
alias(
|
||||
name = "android_tensorflow_test_lib",
|
||||
actual = ":portable_tensorflow_test_lib",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "portable_tensorflow_test_lib",
|
||||
testonly = 1,
|
||||
srcs = if_android([":android_test_srcs"]),
|
||||
srcs = if_mobile([
|
||||
":android_test_srcs_no_core",
|
||||
]),
|
||||
hdrs = [
|
||||
"//tensorflow/core/framework:android_test_hdrs",
|
||||
"//tensorflow/core/util:android_test_hdrs",
|
||||
],
|
||||
copts = tf_copts(android_optimization_level_override = None),
|
||||
features = tf_features_nomodules_if_mobile() + tf_opts_nortti_if_lite_protos(),
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":android_tensorflow_lib",
|
||||
":portable_tensorflow_lib",
|
||||
":protos_all_cc",
|
||||
"//tensorflow/core/kernels:portable_tensorflow_kernels",
|
||||
"//tensorflow/core/platform/default/build_config:gtest",
|
||||
"//third_party/eigen3",
|
||||
],
|
||||
|
@ -4,6 +4,7 @@ load(
|
||||
"cc_header_only_library",
|
||||
"if_android",
|
||||
"if_cuda_or_rocm",
|
||||
"if_mobile",
|
||||
"if_not_windows",
|
||||
"tf_cc_binary",
|
||||
"tf_cc_shared_object",
|
||||
@ -14,12 +15,20 @@ load(
|
||||
"tf_cuda_library",
|
||||
"tf_kernel_library",
|
||||
"tf_mkl_kernel_library",
|
||||
"tf_opts_nortti_if_android",
|
||||
"tf_opts_nortti_if_lite_protos",
|
||||
)
|
||||
load("@local_config_sycl//sycl:build_defs.bzl", "if_sycl")
|
||||
|
||||
# buildifier: disable=same-origin-load
|
||||
load("//tensorflow:tensorflow.bzl", "if_nccl")
|
||||
|
||||
# buildifier: disable=same-origin-load
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cuda_cc_test")
|
||||
|
||||
# buildifier: disable=same-origin-load
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cuda_cc_tests")
|
||||
|
||||
# For platform specific build config
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_kernel_tests_linkstatic",
|
||||
@ -6864,29 +6873,27 @@ filegroup(
|
||||
)
|
||||
# LINT.ThenChange(//tensorflow/contrib/makefile/tf_op_files.txt)
|
||||
|
||||
cc_library(
|
||||
alias(
|
||||
name = "android_tensorflow_kernels",
|
||||
srcs = select({
|
||||
"//tensorflow:android": [
|
||||
"//tensorflow/core/kernels:android_core_ops",
|
||||
"//tensorflow/core/kernels:android_extended_ops",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = tf_copts(),
|
||||
linkopts = select({
|
||||
"//tensorflow:android": [
|
||||
"-ldl",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
actual = ":portable_tensorflow_kernels",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "portable_tensorflow_kernels",
|
||||
srcs = if_mobile([
|
||||
"//tensorflow/core/kernels:android_core_ops",
|
||||
"//tensorflow/core/kernels:android_extended_ops",
|
||||
]),
|
||||
copts = tf_copts() + tf_opts_nortti_if_lite_protos(),
|
||||
linkopts = if_android(["-ldl"]),
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//tensorflow/core:android_tensorflow_lib_lite",
|
||||
"//tensorflow/core:portable_tensorflow_lib_lite",
|
||||
"//tensorflow/core:protos_all_cc_impl",
|
||||
"//third_party/eigen3",
|
||||
"//third_party/fft2d:fft2d_headers",
|
||||
|
@ -44,6 +44,7 @@ load(
|
||||
"tf_cc_tests",
|
||||
"tf_copts", # @unused
|
||||
"tf_cuda_library",
|
||||
"tf_portable_full_lite_protos",
|
||||
)
|
||||
load(
|
||||
"@local_config_rocm//rocm:build_defs.bzl",
|
||||
@ -449,10 +450,10 @@ cc_library(
|
||||
"protobuf_util.cc",
|
||||
],
|
||||
hdrs = ["protobuf.h"],
|
||||
defines = select({
|
||||
"//tensorflow:android": ["TENSORFLOW_LITE_PROTOS"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
defines = tf_portable_full_lite_protos(
|
||||
full = [],
|
||||
lite = ["TENSORFLOW_LITE_PROTOS"],
|
||||
),
|
||||
deps = [
|
||||
":platform",
|
||||
":types",
|
||||
|
@ -33,6 +33,8 @@ load(
|
||||
_tf_proto_library_py = "tf_proto_library_py",
|
||||
_tf_protobuf_compiler_deps = "tf_protobuf_compiler_deps",
|
||||
_tf_protobuf_deps = "tf_protobuf_deps",
|
||||
_tf_protobuf_full_deps = "tf_protobuf_full_deps",
|
||||
_tf_protobuf_lite_deps = "tf_protobuf_lite_deps",
|
||||
_tf_protos_all = "tf_protos_all",
|
||||
_tf_protos_all_impl = "tf_protos_all_impl",
|
||||
_tf_protos_grappler = "tf_protos_grappler",
|
||||
@ -43,6 +45,7 @@ load(
|
||||
_tf_windows_aware_platform_deps = "tf_windows_aware_platform_deps",
|
||||
)
|
||||
|
||||
if_llvm_aarch64_available = _if_llvm_aarch64_available
|
||||
pyx_library = _pyx_library
|
||||
tf_additional_all_protos = _tf_additional_all_protos
|
||||
tf_additional_binary_deps = _tf_additional_binary_deps
|
||||
@ -73,6 +76,8 @@ tf_proto_library_cc = _tf_proto_library_cc
|
||||
tf_proto_library_py = _tf_proto_library_py
|
||||
tf_protobuf_compiler_deps = _tf_protobuf_compiler_deps
|
||||
tf_protobuf_deps = _tf_protobuf_deps
|
||||
tf_protobuf_full_deps = _tf_protobuf_full_deps
|
||||
tf_protobuf_lite_deps = _tf_protobuf_lite_deps
|
||||
tf_protos_all = _tf_protos_all
|
||||
tf_protos_all_impl = _tf_protos_all_impl
|
||||
tf_protos_grappler = _tf_protos_grappler
|
||||
@ -81,4 +86,3 @@ tf_protos_profiler_impl = _tf_protos_profiler_impl
|
||||
tf_py_clif_cc = _tf_py_clif_cc
|
||||
tf_pyclif_proto_library = _tf_pyclif_proto_library
|
||||
tf_windows_aware_platform_deps = _tf_windows_aware_platform_deps
|
||||
if_llvm_aarch64_available = _if_llvm_aarch64_available
|
||||
|
@ -715,8 +715,13 @@ def tf_fingerprint_deps():
|
||||
"@farmhash_archive//:farmhash",
|
||||
]
|
||||
|
||||
def tf_protobuf_deps(use_lite_protos = False):
|
||||
_ignore = use_lite_protos
|
||||
def tf_protobuf_full_deps():
|
||||
return tf_protobuf_deps()
|
||||
|
||||
def tf_protobuf_lite_deps():
|
||||
return tf_protobuf_deps()
|
||||
|
||||
def tf_protobuf_deps():
|
||||
return if_static(
|
||||
[
|
||||
clean_dep("@com_google_protobuf//:protobuf"),
|
||||
@ -754,17 +759,14 @@ def tf_logging_deps():
|
||||
def tf_monitoring_deps():
|
||||
return ["//tensorflow/core/platform/default:monitoring"]
|
||||
|
||||
def tf_portable_deps_no_runtime(use_lite_protos = False):
|
||||
def tf_portable_deps_no_runtime():
|
||||
return [
|
||||
"//third_party/eigen3",
|
||||
"@double_conversion//:double-conversion",
|
||||
"@nsync//:nsync_cpp",
|
||||
"//tensorflow/core/util:stats_calculator_portable",
|
||||
"//tensorflow/core:mobile_additional_lib_deps",
|
||||
"//tensorflow/core:protos_all_cc_impl",
|
||||
"@com_googlesource_code_re2//:re2",
|
||||
"@farmhash_archive//:farmhash",
|
||||
] + tf_protobuf_deps(use_lite_protos)
|
||||
] + tf_protobuf_deps()
|
||||
|
||||
def tf_google_mobile_srcs_no_runtime():
|
||||
return []
|
||||
|
@ -122,6 +122,15 @@ def tf_portable_proto_library(name, proto_deps, deps = [], **kwargs):
|
||||
_ignore = [kwargs]
|
||||
cc_library(name = name, deps = deps + [dep + "_cc" for dep in proto_deps])
|
||||
|
||||
def tf_portable_full_lite_protos(full, lite):
|
||||
return select({
|
||||
"//tensorflow:mobile_lite_protos": lite,
|
||||
"//tensorflow:mobile_full_protos": full,
|
||||
# The default should probably be lite runtime, but since most clients
|
||||
# seem to use the non-lite version, let's make that the default for now.
|
||||
"//conditions:default": full,
|
||||
})
|
||||
|
||||
def if_android_x86(a):
|
||||
return select({
|
||||
clean_dep("//tensorflow:android_x86"): a,
|
||||
@ -198,19 +207,13 @@ def if_ios_x86_64(a):
|
||||
|
||||
def if_mobile(a):
|
||||
return select({
|
||||
clean_dep("//tensorflow:android"): a,
|
||||
clean_dep("//tensorflow:chromiumos"): a,
|
||||
clean_dep("//tensorflow:emscripten"): a,
|
||||
clean_dep("//tensorflow:ios"): a,
|
||||
clean_dep("//tensorflow:mobile"): a,
|
||||
"//conditions:default": [],
|
||||
})
|
||||
|
||||
def if_not_mobile(a):
|
||||
return select({
|
||||
clean_dep("//tensorflow:android"): [],
|
||||
clean_dep("//tensorflow:chromiumos"): [],
|
||||
clean_dep("//tensorflow:emscripten"): [],
|
||||
clean_dep("//tensorflow:ios"): [],
|
||||
clean_dep("//tensorflow:mobile"): [],
|
||||
"//conditions:default": a,
|
||||
})
|
||||
|
||||
@ -341,22 +344,46 @@ def tfe_xla_copts():
|
||||
"//conditions:default": [],
|
||||
})
|
||||
|
||||
def tf_opts_nortti_if_android():
|
||||
return if_android([
|
||||
def tf_opts_nortti():
|
||||
return [
|
||||
"-fno-rtti",
|
||||
"-DGOOGLE_PROTOBUF_NO_RTTI",
|
||||
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
|
||||
])
|
||||
]
|
||||
|
||||
def tf_defines_nortti_if_android():
|
||||
return if_android([
|
||||
def tf_opts_nortti_if_android():
|
||||
return if_android(tf_opts_nortti())
|
||||
|
||||
def tf_opts_nortti_if_mobile():
|
||||
return if_mobile(tf_opts_nortti())
|
||||
|
||||
def tf_defines_nortti():
|
||||
return [
|
||||
"GOOGLE_PROTOBUF_NO_RTTI",
|
||||
"GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
|
||||
])
|
||||
]
|
||||
|
||||
def tf_defines_nortti_if_android():
|
||||
return if_android(tf_defines_nortti())
|
||||
|
||||
def tf_features_nomodules_if_android():
|
||||
return if_android(["-use_header_modules"])
|
||||
|
||||
def tf_features_nomodules_if_mobile():
|
||||
return if_mobile(["-use_header_modules"])
|
||||
|
||||
def tf_opts_nortti_if_lite_protos():
|
||||
return tf_portable_full_lite_protos(
|
||||
full = [],
|
||||
lite = tf_opts_nortti(),
|
||||
)
|
||||
|
||||
def tf_defines_nortti_if_lite_protos():
|
||||
return tf_portable_full_lite_protos(
|
||||
full = [],
|
||||
lite = tf_defines_nortti(),
|
||||
)
|
||||
|
||||
# Given a list of "op_lib_names" (a list of files in the ops directory
|
||||
# without their .cc extensions), generate a library for that file.
|
||||
def tf_gen_op_libs(op_lib_names, deps = None, is_external = True):
|
||||
|
Loading…
Reference in New Issue
Block a user