-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from locaal-ai/roy.async_whisper
Async whisper
- Loading branch information
Showing
11 changed files
with
802 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,46 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(whisper_cpp_wrapper) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
# Find Python | ||
find_package(Python ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development NumPy REQUIRED) | ||
|
||
# Fetch pybind11 | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
pybind11 | ||
GIT_REPOSITORY https://github.com/pybind/pybind11.git | ||
GIT_TAG v2.13.6 # Specify a version/tag here | ||
) | ||
FetchContent_MakeAvailable(pybind11) | ||
|
||
include(cmake/BuildWhispercpp.cmake) | ||
|
||
# Include directories | ||
include_directories(${Python_INCLUDE_DIRS}) | ||
include_directories(${Python_NumPy_INCLUDE_DIRS}) | ||
|
||
# Create the extension module | ||
pybind11_add_module(_whisper_cpp src/whisper_wrapper.cpp) | ||
target_link_libraries(_whisper_cpp PRIVATE Whispercpp) | ||
|
||
# Set the output directory for the built module | ||
set_target_properties(_whisper_cpp PROPERTIES | ||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/simpler_whisper | ||
) | ||
|
||
# Copy the DLL to the output directory on Windows | ||
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_ADDITIONAL_FILE}" | ||
$<TARGET_FILE_DIR:_whisper_cpp> | ||
) | ||
endforeach() | ||
endif() | ||
cmake_minimum_required(VERSION 3.15) | ||
project(whisper_cpp_wrapper) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
# Find Python | ||
find_package( | ||
Python ${PYTHON_VERSION} EXACT | ||
COMPONENTS Interpreter Development | ||
REQUIRED) | ||
|
||
# Fetch pybind11 | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
pybind11 | ||
GIT_REPOSITORY https://github.com/pybind/pybind11.git | ||
GIT_TAG v2.13.6 # Specify a version/tag here | ||
) | ||
FetchContent_MakeAvailable(pybind11) | ||
|
||
include(cmake/BuildWhispercpp.cmake) | ||
|
||
# Include directories | ||
include_directories(${Python_INCLUDE_DIRS}) | ||
include_directories(${Python_NumPy_INCLUDE_DIRS}) | ||
|
||
# Create the extension module | ||
pybind11_add_module(_whisper_cpp src/whisper_wrapper.cpp) | ||
target_link_libraries(_whisper_cpp PRIVATE Whispercpp) | ||
|
||
# Set the output directory for the built module | ||
set_target_properties( | ||
_whisper_cpp PROPERTIES LIBRARY_OUTPUT_DIRECTORY | ||
${CMAKE_CURRENT_SOURCE_DIR}/simpler_whisper) | ||
|
||
# Copy the DLL to the output directory on Windows | ||
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_ADDITIONAL_FILE}" $<TARGET_FILE_DIR:_whisper_cpp>) | ||
endforeach() | ||
endif() |
Oops, something went wrong.