Skip to content

Commit

Permalink
Refactor build.yaml workflow: Update CMakeLists.txt, MANIFEST.in, Bui…
Browse files Browse the repository at this point in the history
…ldWhispercpp.cmake, and pyproject.toml
  • Loading branch information
royshil committed Oct 18, 2024
1 parent a1ed9be commit 0255a10
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
$<TARGET_FILE_DIR:_whisper_cpp>
)
endforeach()
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include simpler_whisper/Release/*.dll
include simpler_whisper/Release/*.pyd
recursive-include simpler_whisper *.so
recursive-include simpler_whisper *.py
recursive-include simpler_whisper *.py
recursive-include simpler_whisper *.metal
3 changes: 2 additions & 1 deletion cmake/BuildWhispercpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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`")
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -34,4 +33,4 @@ dependencies = [
packages = ["simpler_whisper"]

[tool.setuptools.package-data]
simpler_whisper = ["*.dll", "*.pyd", "*.so"]
simpler_whisper = ["*.dll", "*.pyd", "*.so", "*.metal"]

0 comments on commit 0255a10

Please sign in to comment.