diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-15 20:49:02 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-15 20:52:18 -0700 |
commit | f7023480452e4b4781d343acf76ae720540b1423 (patch) | |
tree | 73f9ddec764556c40d54fab981875d6852fd9dc2 /tensorflow/core/platform | |
parent | f9663ec81e968cc42aec36a190c56da3143f7d4f (diff) |
Separated protobuf_compiler into a separate BUILD rule.
This prevents most of TensorFlow from needing to depend
on libprotoc.
PiperOrigin-RevId: 208929776
Diffstat (limited to 'tensorflow/core/platform')
-rw-r--r-- | tensorflow/core/platform/default/build_config.bzl | 10 | ||||
-rw-r--r-- | tensorflow/core/platform/default/protobuf.h | 2 | ||||
-rw-r--r-- | tensorflow/core/platform/default/protobuf_compiler.h | 25 | ||||
-rw-r--r-- | tensorflow/core/platform/protobuf_compiler.h | 25 |
4 files changed, 61 insertions, 1 deletions
diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index 6383180e94..7251c6c725 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -513,6 +513,11 @@ def tf_additional_proto_hdrs(): "platform/windows/integral_types.h", ]) +def tf_additional_proto_compiler_hdrs(): + return [ + "platform/default/protobuf_compiler.h" + ] + def tf_additional_proto_srcs(): return [ "platform/default/protobuf.cc", @@ -659,6 +664,11 @@ def tf_lib_proto_parsing_deps(): "//tensorflow/core/platform/default/build_config:proto_parsing", ] +def tf_lib_proto_compiler_deps(): + return [ + "@protobuf_archive//:protoc_lib", + ] + def tf_additional_verbs_lib_defines(): return select({ "//tensorflow:with_verbs_support": ["TENSORFLOW_USE_VERBS"], diff --git a/tensorflow/core/platform/default/protobuf.h b/tensorflow/core/platform/default/protobuf.h index c732c76ff7..bd9d41c62b 100644 --- a/tensorflow/core/platform/default/protobuf.h +++ b/tensorflow/core/platform/default/protobuf.h @@ -20,8 +20,8 @@ limitations under the License. // IWYU pragma: friend third_party/tensorflow/core/platform/protobuf.h #include "google/protobuf/arena.h" -#include "google/protobuf/compiler/importer.h" #include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor.pb.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream.h" diff --git a/tensorflow/core/platform/default/protobuf_compiler.h b/tensorflow/core/platform/default/protobuf_compiler.h new file mode 100644 index 0000000000..a93d7a184b --- /dev/null +++ b/tensorflow/core/platform/default/protobuf_compiler.h @@ -0,0 +1,25 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_PROTOBUF_COMPILER_H_ +#define TENSORFLOW_CORE_PLATFORM_DEFAULT_PROTOBUF_COMPILER_H_ + +// IWYU pragma: private, include "third_party/tensorflow/core/platform/protobuf_compiler.h" +// IWYU pragma: friend third_party/tensorflow/core/platform/protobuf_compiler.h + +#include "google/protobuf/compiler/importer.h" +#include "tensorflow/core/platform/default/protobuf.h" + +#endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_PROTOBUF_H_ diff --git a/tensorflow/core/platform/protobuf_compiler.h b/tensorflow/core/platform/protobuf_compiler.h new file mode 100644 index 0000000000..29679e0089 --- /dev/null +++ b/tensorflow/core/platform/protobuf_compiler.h @@ -0,0 +1,25 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_PLATFORM_PROTOBUF_COMPILER_H_ +#define TENSORFLOW_PLATFORM_PROTOBUF_COMPILER_H_ + +#if defined(PLATFORM_GOOGLE) && !defined(USE_DEFAULT_PROTOBUF) +#include "tensorflow/core/platform/google/protobuf_compiler.h" +#else +#include "tensorflow/core/platform/default/protobuf_compiler.h" +#endif + +#endif // TENSORFLOW_PLATFORM_PROTOBUF_COMPILER_H_ |