From 0255a10dbf37bc930f86834d9e4f862ff0742604 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Fri, 18 Oct 2024 19:17:30 -0400 Subject: [PATCH] Refactor build.yaml workflow: Update CMakeLists.txt, MANIFEST.in, BuildWhispercpp.cmake, and pyproject.toml --- CMakeLists.txt | 6 +++--- MANIFEST.in | 3 ++- cmake/BuildWhispercpp.cmake | 3 ++- pyproject.toml | 11 +++++------ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce0903a..0fb5f0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,11 +32,11 @@ set_target_properties(_whisper_cpp PROPERTIES ) # Copy the DLL to the output directory on Windows -if(WIN32) - foreach(WHISPER_DLL ${WHISPER_DLLS}) +if(WIN32 OR APPLE) + foreach(WHISPER_ADDITIONAL_FILE ${WHISPER_ADDITIONAL_FILES}) add_custom_command(TARGET _whisper_cpp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${WHISPER_DLL}" + "${WHISPER_ADDITIONAL_FILE}" $ ) endforeach() diff --git a/MANIFEST.in b/MANIFEST.in index 24c3592..a8e3b7f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include simpler_whisper/Release/*.dll include simpler_whisper/Release/*.pyd recursive-include simpler_whisper *.so -recursive-include simpler_whisper *.py \ No newline at end of file +recursive-include simpler_whisper *.py +recursive-include simpler_whisper *.metal \ No newline at end of file diff --git a/cmake/BuildWhispercpp.cmake b/cmake/BuildWhispercpp.cmake index da5ed57..0043a28 100644 --- a/cmake/BuildWhispercpp.cmake +++ b/cmake/BuildWhispercpp.cmake @@ -45,6 +45,7 @@ if(APPLE) IMPORTED_LOCATION ${whispercpp_fetch_SOURCE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}whisper.coreml${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(WHISPER_ADDITIONAL_FILES ${whispercpp_fetch_SOURCE_DIR}/bin/ggml-metal.metal) elseif(WIN32) if(NOT DEFINED ACCELERATION) message(FATAL_ERROR "ACCELERATION is not set. Please set it to either `cpu`, `cuda`, `vulkan` or `hipblas`") @@ -108,7 +109,7 @@ elseif(WIN32) endif() # glob all dlls in the bin directory and install them - file(GLOB WHISPER_DLLS ${whispercpp_fetch_SOURCE_DIR}/bin/*.dll) + file(GLOB WHISPER_ADDITIONAL_FILES ${whispercpp_fetch_SOURCE_DIR}/bin/*.dll) else() if(${CMAKE_BUILD_TYPE} STREQUAL Release OR ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo) set(Whispercpp_BUILD_TYPE Release) diff --git a/pyproject.toml b/pyproject.toml index b890fa8..61cfc82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,17 +10,16 @@ authors = [ ] description = "A simple Python wrapper for whisper.cpp" readme = "README.md" -requires-python = ">=3.6" +requires-python = ">=3.10" classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] dependencies = [ "numpy", @@ -34,4 +33,4 @@ dependencies = [ packages = ["simpler_whisper"] [tool.setuptools.package-data] -simpler_whisper = ["*.dll", "*.pyd", "*.so"] \ No newline at end of file +simpler_whisper = ["*.dll", "*.pyd", "*.so", "*.metal"] \ No newline at end of file