Skip to content

Commit

Permalink
#441: Enable standalone ttrt build (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
tapspatel authored Aug 19, 2024
1 parent 942bd40 commit 8a7c7b0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions runtime/tools/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup
import shutil
import subprocess

TTMLIR_VERSION_MAJOR = os.getenv("TTMLIR_VERSION_MAJOR", "0")
TTMLIR_VERSION_MINOR = os.getenv("TTMLIR_VERSION_MINOR", "0")
Expand Down Expand Up @@ -62,6 +63,24 @@
f"{metallibdir}/{dylib}",
f"{src_dir}/build/runtime/tools/python/ttrt/runtime",
)
command = [
"patchelf",
"--set-rpath",
"$ORIGIN",
f"{src_dir}/build/runtime/tools/python/ttrt/runtime/{dylib}",
]

try:
result = subprocess.run(
command,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
except subprocess.CalledProcessError as e:
print(f"Command failed with return code {e.returncode}")

ext_modules.append(
Pybind11Extension(
"ttrt.runtime._C",
Expand Down

0 comments on commit 8a7c7b0

Please sign in to comment.