@@ -464,84 +464,91 @@ def run(self):
464
464
if self ._ran_build :
465
465
return
466
466
467
- try :
468
- from backends .qualcomm .scripts .download_qnn_sdk import (
469
- _download_qnn_sdk ,
470
- LLVM_VERSION ,
471
- SDK_DIR ,
472
- stage_libcxx ,
473
- )
474
-
475
- # qnn sdk setup
476
- print (
477
- "SDK_DIR: " ,
478
- SDK_DIR ,
479
- "type: " ,
480
- type (SDK_DIR ),
481
- "exists: " ,
482
- os .path .exists (SDK_DIR ),
483
- )
484
- _download_qnn_sdk ()
485
-
486
- sdk_path = Path (SDK_DIR ).resolve () # full absolute path
487
-
488
- sdk_path = Path (SDK_DIR ).resolve () # full absolute path
489
- print ("sdk_path: " , sdk_path )
490
- if not sdk_path :
491
- raise RuntimeError ("Qualcomm SDK not found, cannot build backend" )
492
-
493
- # # Determine paths
494
- prj_root = Path (__file__ ).parent .resolve ()
495
- print ("prj_root: " , prj_root )
496
- build_sh = prj_root / "backends/qualcomm/scripts/build.sh"
497
- build_root = prj_root / "build-x86"
498
-
499
- if not build_sh .exists ():
500
- raise FileNotFoundError (f"{ build_sh } not found" )
501
-
502
- # Run build.sh with SDK path exported
503
- env = dict (** os .environ )
504
- print ("str(sdk_path): " , str (sdk_path ))
505
- env ["QNN_SDK_ROOT" ] = str (sdk_path )
506
- subprocess .check_call ([str (build_sh ), "--skip_aarch64" ], env = env )
507
-
508
- # Copy the main .so into the wheel package
509
- so_src = build_root / "backends/qualcomm/libqnn_executorch_backend.so"
510
- so_dst = Path (
511
- self .get_ext_fullpath ("executorch.backends.qualcomm.qnn_backend" )
512
- )
513
- self .mkpath (so_dst .parent ) # ensure destination exists
514
- self .copy_file (str (so_src ), str (so_dst ))
515
- print (f"Copied Qualcomm backend: { so_src } -> { so_dst } " )
516
-
517
- # Remove Qualcomm SDK completely so it doesn’t get packaged
518
- if os .path .exists (SDK_DIR ):
519
- try :
520
- shutil .rmtree (SDK_DIR )
521
- print (f"Removed Qualcomm SDK folder: { SDK_DIR } " )
522
- except Exception as e :
523
- print (f"Failed to remove SDK_DIR { SDK_DIR } : { e } " )
524
-
525
- so_files = [
526
- (
527
- "executorch.backends.qualcomm.python.PyQnnManagerAdaptor" ,
528
- prj_root
529
- / "backends/qualcomm/python/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so" ,
530
- ),
531
- (
532
- "executorch.backends.qualcomm.python.PyQnnWrapperAdaptor" ,
533
- prj_root
534
- / "backends/qualcomm/python/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so" ,
535
- ),
536
- ]
537
-
538
- for module_name , so_src in so_files :
539
- so_dst = Path (self .get_ext_fullpath (module_name ))
540
- self .mkpath (str (so_dst .parent ))
541
- self .copy_file (str (so_src ), str (so_dst ))
542
- print (f"Copied Qualcomm backend: { so_src } -> { so_dst } " )
543
- except ImportError :
544
- print ("Import error: " , sys .exc_info ()[0 ])
467
+ # try:
468
+ # from backends.qualcomm.scripts.download_qnn_sdk import (
469
+ # _download_qnn_sdk,
470
+ # LLVM_VERSION,
471
+ # SDK_DIR,
472
+ # )
473
+
474
+ # qnn sdk setup
475
+ # print(
476
+ # "SDK_DIR: ",
477
+ # SDK_DIR,
478
+ # "type: ",
479
+ # type(SDK_DIR),
480
+ # "exists: ",
481
+ # os.path.exists(SDK_DIR),
482
+ # )
483
+ # _download_qnn_sdk()
484
+
485
+ # sdk_path = Path(SDK_DIR).resolve() # full absolute path
486
+ # print("sdk_path: ", sdk_path)
487
+ # if not sdk_path:
488
+ # raise RuntimeError("Qualcomm SDK not found, cannot build backend")
489
+
490
+ # # Determine paths
491
+ # prj_root = Path(__file__).parent.resolve()
492
+ # print("prj_root: ", prj_root)
493
+ # build_sh = prj_root / "backends/qualcomm/scripts/build.sh"
494
+ # build_root = prj_root / "build-x86"
495
+
496
+ # if not build_sh.exists():
497
+ # raise FileNotFoundError(f"{build_sh} not found")
498
+
499
+ # # Run build.sh with SDK path exported
500
+ # env = dict(**os.environ)
501
+ # print("str(sdk_path): ", str(sdk_path))
502
+ # env["QNN_SDK_ROOT"] = str(sdk_path)
503
+ # subprocess.check_call([str(build_sh), "--skip_aarch64"], env=env)
504
+
505
+ # # Copy the main .so into the wheel package
506
+ # so_src = build_root / "backends/qualcomm/libqnn_executorch_backend.so"
507
+ # so_dst = Path(
508
+ # self.get_ext_fullpath("executorch.backends.qualcomm.qnn_backend")
509
+ # )
510
+ # self.mkpath(so_dst.parent) # ensure destination exists
511
+ # self.copy_file(str(so_src), str(so_dst))
512
+ # print(f"Copied Qualcomm backend: {so_src} -> {so_dst}")
513
+
514
+ # # --- CLEANUP SECTION ---
515
+ # # 1. Remove Qualcomm SDK staging folder so it doesn’t get packaged
516
+ # if os.path.exists(SDK_DIR):
517
+ # try:
518
+ # shutil.rmtree(SDK_DIR)
519
+ # print(f"Removed Qualcomm SDK folder: {SDK_DIR}")
520
+ # except Exception as e:
521
+ # print(f"Failed to remove SDK_DIR {SDK_DIR}: {e}")
522
+
523
+ # # 2. Also remove the entire packaged SDK tree
524
+ # pkg_sdk_dir = prj_root / "backends/qualcomm/sdk"
525
+ # if pkg_sdk_dir.exists():
526
+ # try:
527
+ # shutil.rmtree(pkg_sdk_dir)
528
+ # print(f"Removed packaged Qualcomm SDK: {pkg_sdk_dir}")
529
+ # except Exception as e:
530
+ # print(f"Failed to remove packaged SDK dir {pkg_sdk_dir}: {e}")
531
+
532
+ # so_files = [
533
+ # (
534
+ # "executorch.backends.qualcomm.python.PyQnnManagerAdaptor",
535
+ # prj_root
536
+ # / "backends/qualcomm/python/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so",
537
+ # ),
538
+ # (
539
+ # "executorch.backends.qualcomm.python.PyQnnWrapperAdaptor",
540
+ # prj_root
541
+ # / "backends/qualcomm/python/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so",
542
+ # ),
543
+ # ]
544
+
545
+ # for module_name, so_src in so_files:
546
+ # so_dst = Path(self.get_ext_fullpath(module_name))
547
+ # self.mkpath(str(so_dst.parent))
548
+ # self.copy_file(str(so_src), str(so_dst))
549
+ # print(f"Copied Qualcomm backend: {so_src} -> {so_dst}")
550
+ # except ImportError:
551
+ # print("Import error: ", sys.exc_info()[0])
545
552
546
553
if self .editable_mode :
547
554
self ._ran_build = True
@@ -663,14 +670,14 @@ def run(self):
663
670
"share/cmake/executorch-config.cmake" ,
664
671
),
665
672
]
666
- # Pick up all .so files automatically
667
- ext_suffixes = importlib .machinery .EXTENSION_SUFFIXES
668
- for suffix in ext_suffixes :
669
- for so_file in Path ("backends/qualcomm/python" ).glob (f"*{ suffix } " ):
670
- rel_dst = os .path .join (
671
- "executorch/backends/qualcomm/python" , so_file .name
672
- )
673
- src_to_dst .append ((str (so_file ), rel_dst ))
673
+ # # Pick up all .so files automatically
674
+ # ext_suffixes = importlib.machinery.EXTENSION_SUFFIXES
675
+ # for suffix in ext_suffixes:
676
+ # for so_file in Path("backends/qualcomm/python").glob(f"*{suffix}"):
677
+ # rel_dst = os.path.join(
678
+ # "executorch/backends/qualcomm/python", so_file.name
679
+ # )
680
+ # src_to_dst.append((str(so_file), rel_dst))
674
681
# Copy all the necessary headers into include/executorch/ so that they can
675
682
# be found in the pip package. This is the subset of headers that are
676
683
# essential for building custom ops extensions.
0 commit comments