Add c_api to Android/mobile builds

This change is a prerequisite for introducing C Ops and Kernels into Android
and iOS builds.

PiperOrigin-RevId: 236432247
This commit is contained in:
James Ring 2019-03-01 23:38:17 -08:00 committed by TensorFlower Gardener
parent f832595165
commit f2d54e9490
5 changed files with 32 additions and 14 deletions

View File

@ -39,14 +39,19 @@ filegroup(
"python_api.h", "python_api.h",
"*test*", "*test*",
], ],
), ) + [
"//tensorflow/cc:srcs",
"//tensorflow/core/distributed_runtime:server_lib.h",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
tf_cuda_library( tf_cuda_library(
name = "c_api_internal", name = "c_api_internal",
srcs = ["c_api.h"], hdrs = [
hdrs = ["c_api_internal.h"], "c_api.h",
"c_api_internal.h",
],
visibility = [ visibility = [
"//tensorflow:internal", "//tensorflow:internal",
"//tensorflow/c:__subpackages__", "//tensorflow/c:__subpackages__",
@ -68,7 +73,9 @@ tf_cuda_library(
tf_cuda_library( tf_cuda_library(
name = "c_api", name = "c_api",
hdrs = ["c_api.h"], hdrs = [
"c_api.h",
],
copts = tf_copts(), copts = tf_copts(),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
@ -89,9 +96,7 @@ tf_cuda_library(
"c_api.cc", "c_api.cc",
"c_api_function.cc", "c_api_function.cc",
], ],
hdrs = [ hdrs = ["c_api.h"],
"c_api.h",
],
copts = tf_copts(), copts = tf_copts(),
visibility = ["//tensorflow/c:__subpackages__"], visibility = ["//tensorflow/c:__subpackages__"],
deps = [":c_api_internal"] + select({ deps = [":c_api_internal"] + select({

View File

@ -8,6 +8,19 @@ package(
licenses(["notice"]) # Apache 2.0 licenses(["notice"]) # Apache 2.0
filegroup(
name = "srcs",
srcs = [
"framework/gradients.h",
"framework/ops.h",
"framework/scope.h",
"framework/scope_internal.h",
"ops/array_ops.h",
"ops/while_loop.h",
"//tensorflow/cc/saved_model:loader.h",
],
)
load( load(
"//tensorflow:tensorflow.bzl", "//tensorflow:tensorflow.bzl",
"cc_library_with_android_deps", "cc_library_with_android_deps",
@ -606,16 +619,13 @@ tf_gen_op_wrappers_cc(
visibility = ["//tensorflow:internal"], visibility = ["//tensorflow:internal"],
) )
cc_library_with_android_deps( cc_library(
name = "cc_op_gen_main", name = "cc_op_gen_main",
srcs = [ srcs = [
"framework/cc_op_gen.cc", "framework/cc_op_gen.cc",
"framework/cc_op_gen.h", "framework/cc_op_gen.h",
"framework/cc_op_gen_main.cc", "framework/cc_op_gen_main.cc",
], ],
android_deps = [
"//tensorflow/core:android_tensorflow_lib",
],
copts = tf_copts(), copts = tf_copts(),
data = [ data = [
"//tensorflow/core/api_def:base_api_def", "//tensorflow/core/api_def:base_api_def",

View File

@ -629,6 +629,9 @@ BENCHMARK_NAME := $(BINDIR)benchmark
CORE_CC_ALL_SRCS := \ CORE_CC_ALL_SRCS := \
$(ABSL_CC_SRCS) \ $(ABSL_CC_SRCS) \
tensorflow/c/c_api.cc \
tensorflow/c/kernels.cc \
tensorflow/c/tf_status_helper.cc \
$(wildcard tensorflow/core/*.cc) \ $(wildcard tensorflow/core/*.cc) \
$(wildcard tensorflow/core/common_runtime/*.cc) \ $(wildcard tensorflow/core/common_runtime/*.cc) \
$(wildcard tensorflow/core/framework/*.cc) \ $(wildcard tensorflow/core/framework/*.cc) \

View File

@ -1671,6 +1671,7 @@ filegroup(
":protos_all_proto_text_srcs", ":protos_all_proto_text_srcs",
":error_codes_proto_text_srcs", ":error_codes_proto_text_srcs",
"//tensorflow/core/platform/default/build_config:android_srcs", "//tensorflow/core/platform/default/build_config:android_srcs",
"//tensorflow/c:srcs",
] + glob( ] + glob(
[ [
"client/**/*.cc", "client/**/*.cc",

View File

@ -33,13 +33,12 @@ tf_cuda_library(
"//tensorflow:android": [], "//tensorflow:android": [],
"//conditions:default": ["."], "//conditions:default": ["."],
}), }),
deps = [ deps = select({
"//tensorflow/c:c_api",
] + select({
"//tensorflow:android": [ "//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib", "//tensorflow/core:android_tensorflow_lib",
], ],
"//conditions:default": [ "//conditions:default": [
"//tensorflow/c:c_api",
"//tensorflow/core:all_kernels", "//tensorflow/core:all_kernels",
"//tensorflow/core:direct_session", "//tensorflow/core:direct_session",
"//tensorflow/core:ops", "//tensorflow/core:ops",