Skip to content

Commit

Permalink
Merge pull request #46 from thewh1teagle/fix/shared-lib-load
Browse files Browse the repository at this point in the history
Fix/shared lib load
  • Loading branch information
abdeladim-s committed Aug 29, 2024
2 parents d452d8b + d28b8aa commit 3ee9803
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pywhispercpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@

lib_dir = os.path.join(os.path.dirname(__file__), 'lib/*')

# Append lib dir to PATH
os.add_dll_directory(os.path.join(os.path.dirname(__file__), 'lib'))

for file in glob(lib_dir):
ctypes.CDLL(os.path.join(os.path.dirname(__file__), 'lib', file))
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def copy_extensions_to_source(self):
extdir = ext_fullpath.parent.resolve()
so_files = os.path.join(extdir, '*.so')
pyd_files = os.path.join(extdir, '*.pyd')
dll_files = os.path.join(self.build_temp, 'bin', 'Release', '*.dll')
cfg = "Debug" if self.debug else "Release"
dll_files = os.path.join(self.build_temp, '_pywhispercpp', 'bin', cfg, "*.dll")
shared_libs = glob(so_files) + glob(dll_files) + glob(pyd_files)
dest_folder = Path.cwd() / 'pywhispercpp' / 'lib'
if(not dest_folder.resolve().exists()):
Expand Down Expand Up @@ -164,7 +165,7 @@ def copy_extensions_to_source(self):
packages=find_packages('.'),
package_dir={'': '.'},
include_package_data=True,
package_data={'': ['./lib/*']},
package_data={'pywhispercpp': ['lib/*']},
long_description_content_type="text/markdown",
license='MIT',
entry_points={
Expand Down

0 comments on commit 3ee9803

Please sign in to comment.