22# C API for TensorFlow, for use by client language bindings.
33
44load ("@bazel_skylib//lib:selects.bzl" , "selects" )
5- load ("//tensorflow/core /platform:rules_cc.bzl" , "cc_library" )
5+ load ("//tensorflow/tsl /platform:rules_cc.bzl" , "cc_library" )
66load (
77 "//tensorflow:tensorflow.bzl" ,
88 "check_deps" ,
@@ -40,6 +40,7 @@ filegroup(
4040 "tf_tensor.h" ,
4141 "tf_tstring.h" ,
4242 "//tensorflow/core/platform:ctstring" ,
43+ "//tensorflow/tsl/c:headers" ,
4344 ] + if_tensorrt ([
4445 "//tensorflow/compiler/tf2tensorrt:headers" ,
4546 ]),
@@ -61,7 +62,8 @@ filegroup(
6162 "*test*" ,
6263 ],
6364 ) + [
64- "//tensorflow/core/platform:ctstring" ,
65+ "//tensorflow/tsl/c:srcs" ,
66+ "//tensorflow/tsl/platform:ctstring" ,
6567 "//tensorflow/cc:srcs_no_runtime" ,
6668 "//tensorflow/core/distributed_runtime:server_lib.h" ,
6769 ],
@@ -80,6 +82,7 @@ cc_library(
8082 "tf_buffer_internal.h" ,
8183 "tf_status_internal.h" ,
8284 "tf_tensor_internal.h" ,
85+ "//tensorflow/tsl/c:tsl_status_internal_headers" ,
8386 ],
8487 visibility = [
8588 "//tensorflow/core:__pkg__" ,
@@ -185,6 +188,7 @@ tf_cuda_library(
185188 ":tf_tensor_internal" ,
186189 ":tf_tstring" ,
187190 "//tensorflow/core/platform:tstring" ,
191+ "//tensorflow/tsl/c:tsl_status" ,
188192 ] + select ({
189193 "//tensorflow:with_xla_support" : [
190194 "//tensorflow/compiler/tf2xla:xla_compiler" ,
@@ -274,6 +278,7 @@ tf_cuda_library(
274278 hdrs = [
275279 "tf_status.h" ,
276280 "tf_status_internal.h" ,
281+ "//tensorflow/tsl/c:tsl_status_internal_headers" ,
277282 ],
278283 visibility = [
279284 "//tensorflow/c:__subpackages__" ,
@@ -286,7 +291,11 @@ tf_cuda_library(
286291 "//tensorflow/compiler/mlir/tensorflow/c:__subpackages__" ,
287292 "//tensorflow/core/transforms:__subpackages__" ,
288293 ],
289- deps = select ({
294+ deps = [
295+ "//tensorflow/tsl/platform:status" ,
296+ "//tensorflow/tsl/c:tsl_status" ,
297+ "//tensorflow/tsl/c:tsl_status_internal" ,
298+ ] + select ({
290299 "//tensorflow:android" : [
291300 "//tensorflow/core:portable_tensorflow_lib_lite" , # TODO(annarev): exclude runtime srcs
292301 ],
@@ -298,7 +307,10 @@ tf_cuda_library(
298307
299308filegroup (
300309 name = "tf_status_internal_headers" ,
301- srcs = ["tf_status_internal.h" ],
310+ srcs = [
311+ "tf_status_internal.h" ,
312+ "//tensorflow/tsl/c:tsl_status_internal_headers" ,
313+ ],
302314 visibility = [
303315 "//tensorflow/python:__subpackages__" ,
304316 ],
@@ -332,9 +344,11 @@ cc_library(
332344 name = "tf_status" ,
333345 srcs = ["tf_status.cc" ],
334346 hdrs = ["tf_status.h" ],
347+ copts = tf_copts (),
335348 visibility = ["//visibility:public" ],
336349 deps = [
337350 ":tf_status_internal" ,
351+ "//tensorflow/tsl/c:tsl_status" ,
338352 ] + select ({
339353 "//tensorflow:android" : [
340354 "//tensorflow/core:portable_tensorflow_lib_lite" , # TODO(annarev): exclude runtime srcs
@@ -345,22 +359,13 @@ cc_library(
345359 }),
346360)
347361
348- tf_cc_test (
349- name = "tf_status_test" ,
350- srcs = ["tf_status_test.cc" ],
351- deps = [
352- ":tf_status" ,
353- ":tf_status_internal" ,
354- "//tensorflow/core:lib" ,
355- "//tensorflow/core:test" ,
356- "//tensorflow/core:test_main" ,
357- ],
358- )
359-
360362cc_library (
361363 name = "tf_status_headers" ,
362364 hdrs = ["tf_status.h" ],
363365 visibility = ["//visibility:public" ],
366+ deps = [
367+ "//tensorflow/tsl/c:tsl_status" ,
368+ ],
364369)
365370
366371cc_library (
@@ -380,6 +385,7 @@ cc_library(
380385 deps = [
381386 "//tensorflow/core/platform:status" ,
382387 "//tensorflow/core/platform:tstring" ,
388+ "//tensorflow/tsl/c:tsl_status" ,
383389 ],
384390)
385391
@@ -425,6 +431,7 @@ cc_library(
425431 name = "tf_tensor" ,
426432 srcs = ["tf_tensor.cc" ],
427433 hdrs = ["tf_tensor.h" ],
434+ copts = tf_copts (),
428435 visibility = ["//visibility:public" ],
429436 deps = [
430437 ":c_api_macros" ,
@@ -574,24 +581,9 @@ tf_cuda_library(
574581 deps = [
575582 ":tf_status" ,
576583 ":tf_status_internal" ,
577- ] + select ({
578- "//tensorflow:android" : [
579- "//tensorflow/core:portable_tensorflow_lib_lite" , # TODO(annarev): exclude runtime srcs
580- ],
581- "//conditions:default" : [
582- "//tensorflow/core:lib" ,
583- ],
584- }),
585- )
586-
587- tf_cc_test (
588- name = "tf_status_helper_test" ,
589- srcs = ["tf_status_helper_test.cc" ],
590- deps = [
591- ":tf_status_helper" ,
592- "//tensorflow/core:lib" ,
593- "//tensorflow/core:test" ,
594- "//tensorflow/core:test_main" ,
584+ "//tensorflow/core/platform:errors" ,
585+ "//tensorflow/core/platform:status" ,
586+ "//tensorflow/tsl/c:tsl_status_helper" ,
595587 ],
596588)
597589
0 commit comments