This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 967d2bb807 [Build] Fix find_include_path when using TVM python package 
(#14007)
967d2bb807 is described below

commit 967d2bb807b9957ec68c1073681ddb7c4737853b
Author: Hongyi Jin <[email protected]>
AuthorDate: Thu Feb 16 02:11:16 2023 -0500

    [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.
---
 python/tvm/_ffi/libinfo.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/python/tvm/_ffi/libinfo.py b/python/tvm/_ffi/libinfo.py
index fdd888a470..b27d4247fd 100644
--- a/python/tvm/_ffi/libinfo.py
+++ b/python/tvm/_ffi/libinfo.py
@@ -165,9 +165,11 @@ def find_include_path(name=None, search_path=None, 
optional=False):
     include_path : list(string)
         List of all found paths to header files.
     """
-    ffi_dir = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
-    source_dir = os.path.join(ffi_dir, "..", "..", "..")
-
+    if os.environ.get("TVM_HOME", None):
+        source_dir = os.environ["TVM_HOME"]
+    else:
+        ffi_dir = 
os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
+        source_dir = os.path.join(ffi_dir, "..", "..", "..")
     third_party_dir = os.path.join(source_dir, "3rdparty")
 
     header_path = []

Reply via email to