Skip to content

Commit

Permalink
[MLIR:Python] Make MLIR Python targets buildable when LLVM is importe…
Browse files Browse the repository at this point in the history
…d as an external dependency of TensorFlow.

Map @python_runtime to @local_config_python, and alias :runtime to :python_runtime in that package.

PiperOrigin-RevId: 407574863
Change-Id: I268bf205dce1ca50f30da7161e73145f25bec3c2
  • Loading branch information
hawkinsp authored and tensorflower-gardener committed Nov 4, 2021
1 parent cb47cb6 commit cdb361d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion third_party/llvm/setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ def llvm_setup(name):
llvm_disable_optional_support_deps()

# Build @llvm-project from @llvm-raw using overlays.
llvm_configure(name = name)
llvm_configure(
name = name,
repo_mapping = {"@python_runtime": "@local_config_python"},
)
9 changes: 9 additions & 0 deletions third_party/py/BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ cc_library(
includes = ["python_include"],
)

# This alias is exists for the use of targets in the @llvm-project dependency,
# which expect a python_headers target called @python_runtime//:headers. We use
# a repo_mapping to alias python_runtime to this package, and an alias to create
# the correct target.
alias(
name = "headers",
actual = ":python_headers",
)

cc_library(
name = "numpy_headers",
hdrs = [":numpy_include"],
Expand Down

0 comments on commit cdb361d

Please sign in to comment.