diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-04-02 20:50:39 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-04-02 20:53:09 -0700 |
commit | 38e0139329482d8e44629dea2e87853808eacd0d (patch) | |
tree | ffe852a504bee857821eac9f05f5ca8f939929f2 /tensorflow/tensorflow.bzl | |
parent | fa2e70d7fae8466c4006bd29334a3cc440ee6d3a (diff) |
Windows: Enable tensorflow/contrib in Bazel build (Second try)
This reverts commit 4e108ef30d7cd7ae5e1c550ec5ae27e79b8c6e39.
PiperOrigin-RevId: 191391075
Diffstat (limited to 'tensorflow/tensorflow.bzl')
-rw-r--r-- | tensorflow/tensorflow.bzl | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index fcc57d506e..e9d2f279cd 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -342,6 +342,22 @@ register_extension_info( label_regex_for_dep = "{extension_name}.*", ) +# A simple wrap around native.cc_binary rule. +# When using this rule, you should realize it doesn't link to any tensorflow +# dependencies by default. +def tf_native_cc_binary(name, + copts=tf_copts(), + **kwargs): + native.cc_binary( + name=name, + copts=copts, + **kwargs) + +register_extension_info( + extension_name = "tf_native_cc_binary", + label_regex_for_dep = "{extension_name}.*", +) + def tf_gen_op_wrapper_cc(name, out_ops_file, pkg="", @@ -1178,6 +1194,20 @@ def tf_custom_op_library_additional_deps(): "@protobuf_archive//:protobuf_headers", clean_dep("//third_party/eigen3"), clean_dep("//tensorflow/core:framework_headers_lib"), + ] + if_windows(["//tensorflow/python:pywrap_tensorflow_import_lib"]) + +# A list of targets that contains the implemenation of +# tf_custom_op_library_additional_deps. It's used to generate a DEF file for +# exporting symbols from _pywrap_tensorflow.dll on Windows. +def tf_custom_op_library_additional_deps_impl(): + return [ + "@protobuf_archive//:protobuf", + "@nsync//:nsync_cpp", + # for //third_party/eigen3 + clean_dep("//third_party/eigen3"), + # for //tensorflow/core:framework_headers_lib + clean_dep("//tensorflow/core:framework"), + clean_dep("//tensorflow/core:reader_base"), ] # Traverse the dependency graph along the "deps" attribute of the @@ -1264,6 +1294,7 @@ def tf_custom_op_library(name, srcs=[], gpu_srcs=[], deps=[], linkopts=[]): deps=deps + if_cuda(cuda_deps), data=[name + "_check_deps"], copts=tf_copts(is_external=True), + features = ["windows_export_all_symbols"], linkopts=linkopts + select({ "//conditions:default": [ "-lm", @@ -1410,7 +1441,8 @@ def tf_py_wrap_cc(name, ]) + tf_extension_copts()), linkopts=tf_extension_linkopts() + extra_linkopts, linkstatic=1, - deps=deps + extra_deps) + deps=deps + extra_deps, + **kwargs) native.genrule( name="gen_" + cc_library_pyd_name, srcs=[":" + cc_library_name], |