Skip to content

Commit 967d2bb

Browse files
authored
[Build] Fix find_include_path when using TVM python package (#14007)
When we are using TVM python package instead of building TVM from source, we are not able to find 3rdparty directory under python's site-package directory, so we cannot build module using 3rdparty in that situation. A fix is to let the user clone a TVM repo as TVM_HOME and find include path in that clone.
1 parent a6f4694 commit 967d2bb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

python/tvm/_ffi/libinfo.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ def find_include_path(name=None, search_path=None, optional=False):
165165
include_path : list(string)
166166
List of all found paths to header files.
167167
"""
168-
ffi_dir = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
169-
source_dir = os.path.join(ffi_dir, "..", "..", "..")
170-
168+
if os.environ.get("TVM_HOME", None):
169+
source_dir = os.environ["TVM_HOME"]
170+
else:
171+
ffi_dir = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
172+
source_dir = os.path.join(ffi_dir, "..", "..", "..")
171173
third_party_dir = os.path.join(source_dir, "3rdparty")
172174

173175
header_path = []

0 commit comments

Comments
 (0)