Skip to content

add tf-c-header rule #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensorflow_io/core/plugins/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cc_library(
linkstatic = True,
deps = [
"@local_config_tf//:libtensorflow_framework",
"@local_config_tf//:tf_header_lib",
"@local_config_tf//:tf_c_header_lib",
],
alwayslink = 1,
)
Expand Down
2 changes: 2 additions & 0 deletions tensorflow_io/core/plugins/hdfs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ cc_library(
linkstatic = True,
deps = [
"//tensorflow_io/core/plugins:plugins_header",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization",
"@hadoop",
],
alwayslink = 1,
Expand Down
11 changes: 10 additions & 1 deletion third_party/toolchains/tf/BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ cc_library(
visibility = ["//visibility:public"],
)

cc_library(
name = "tf_c_header_lib",
hdrs = [":tf_c_header_include"],
include_prefix = "tensorflow/c",
strip_include_prefix = "include_c",
visibility = ["//visibility:public"],
)
Comment on lines +10 to +16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add

deps = [
        "@local_config_tf//:libtensorflow_framework",
    ],

here since they always go with each other ?


cc_library(
name = "libtensorflow_framework",
srcs = [":libtensorflow_framework.so"],
Expand All @@ -15,4 +23,5 @@ cc_library(
)

%{TF_HEADER_GENRULE}
%{TF_SHARED_LIBRARY_GENRULE}
%{TF_C_HEADER_GENRULE}
%{TF_SHARED_LIBRARY_GENRULE}
7 changes: 7 additions & 0 deletions third_party/toolchains/tf/tf_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def _tf_pip_impl(repository_ctx):
"tf_header_include",
tf_pip_dir_rename_pair = ["tensorflow_core", "tensorflow"],
)
tf_c_header_rule = _symlink_genrule_for_dir(
repository_ctx,
tf_header_dir + "/tensorflow/c/",
"include_c",
"tf_c_header_include",
)

tf_shared_library_dir = repository_ctx.os.environ[_TF_SHARED_LIBRARY_DIR]
tf_shared_library_name = repository_ctx.os.environ[_TF_SHARED_LIBRARY_NAME]
Expand All @@ -192,6 +198,7 @@ def _tf_pip_impl(repository_ctx):

_tpl(repository_ctx, "BUILD", {
"%{TF_HEADER_GENRULE}": tf_header_rule,
"%{TF_C_HEADER_GENRULE}": tf_c_header_rule,
"%{TF_SHARED_LIBRARY_GENRULE}": tf_shared_library_rule,
})

Expand Down