From 158cd6220231fcf758a45c2dcd40d93cd0aec9e0 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 11 Jul 2018 11:09:16 -0700 Subject: Split out lib/png into a separate library from the rest of TensorFlow to avoid unnecessary transitive dependencies. PiperOrigin-RevId: 204154526 --- tensorflow/contrib/tensorboard/db/BUILD | 1 + tensorflow/core/BUILD | 36 ++++++++++++++++++++++ tensorflow/core/kernels/BUILD | 3 +- .../core/platform/default/build_config/BUILD | 12 ++++++-- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/tensorflow/contrib/tensorboard/db/BUILD b/tensorflow/contrib/tensorboard/db/BUILD index 3f6b4cdc9a..6507546ee9 100644 --- a/tensorflow/contrib/tensorboard/db/BUILD +++ b/tensorflow/contrib/tensorboard/db/BUILD @@ -106,6 +106,7 @@ cc_library( "//tensorflow/core:framework", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", + "//tensorflow/core:png_internal", "//tensorflow/core:protos_all_cc", ], ) diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index 9d4f7092fa..dbe87a6dbb 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -1952,8 +1952,10 @@ LIB_INTERNAL_PRIVATE_HEADERS = ["framework/resource_handle.h"] + glob( "**/*test*", "lib/gif/**/*", "lib/jpeg/**/*", + "lib/png/**/*", "platform/gif.h", "platform/jpeg.h", + "platform/png.h", "platform/**/cuda.h", "platform/**/stream_executor.h", ], @@ -2048,6 +2050,7 @@ cc_library( "lib/hash/crc32c_accelerate.cc", "lib/gif/**/*", "lib/jpeg/**/*", + "lib/png/**/*", "platform/**/env_time.cc", "platform/**/cuda_libdevice_path.cc", "platform/**/device_tracer.cc", @@ -2143,6 +2146,39 @@ cc_library( ], ) +cc_library( + name = "png_internal", + srcs = ["lib/png/png_io.cc"], + hdrs = [ + "lib/bfloat16/bfloat16.h", + "lib/core/casts.h", + "lib/core/stringpiece.h", + "lib/png/png_io.h", + "platform/byte_order.h", + "platform/cpu_info.h", + "platform/default/integral_types.h", + "platform/default/logging.h", + "platform/logging.h", + "platform/macros.h", + "platform/platform.h", + "platform/png.h", + "platform/types.h", + ], + copts = tf_copts(), + linkopts = select({ + "//tensorflow:freebsd": [], + "//tensorflow:windows": [], + "//tensorflow:windows_msvc": [], + "//conditions:default": ["-ldl"], + }), + deps = [ + ":lib", + ":lib_internal", + "//tensorflow/core/platform/default/build_config:png", + "@zlib_archive//:zlib", + ], +) + cc_library( name = "tflite_portable_logging", srcs = [], diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index 3b3e1af2d5..3426ea8aa2 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -2086,6 +2086,7 @@ IMAGE_DEPS = [ "//tensorflow/core:jpeg_internal", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", + "//tensorflow/core:png_internal", "//tensorflow/core:protos_all_cc", ] @@ -2660,7 +2661,7 @@ tf_kernel_library( tf_kernel_library( name = "summary_image_op", prefix = "summary_image_op", - deps = LOGGING_DEPS, + deps = LOGGING_DEPS + ["//tensorflow/core:png_internal"], ) tf_kernel_library( diff --git a/tensorflow/core/platform/default/build_config/BUILD b/tensorflow/core/platform/default/build_config/BUILD index c17e4810d5..da1f66dc67 100644 --- a/tensorflow/core/platform/default/build_config/BUILD +++ b/tensorflow/core/platform/default/build_config/BUILD @@ -146,7 +146,6 @@ cc_library( "@farmhash_archive//:farmhash", "@fft2d", "@highwayhash//:sip_hash", - "@png_archive//:png", ], ) @@ -161,7 +160,7 @@ cc_library( "@farmhash_archive//:farmhash", "@fft2d", "@highwayhash//:sip_hash", - "@png_archive//:png", + "@zlib_archive//:zlib", ], ) @@ -186,6 +185,15 @@ cc_library( ], ) +cc_library( + name = "png", + copts = tf_copts(), + deps = [ + "@png_archive//:png", + "@zlib_archive//:zlib", + ], +) + cc_library( name = "protos_cc_impl", copts = tf_copts(), -- cgit v1.2.3