diff --git a/.github/scripts/.Aptfile b/.github/scripts/.Aptfile index 09efc11..285d03a 100644 --- a/.github/scripts/.Aptfile +++ b/.github/scripts/.Aptfile @@ -4,3 +4,4 @@ package 'git' package 'jq' package 'ninja-build', bin: 'ninja' package 'pkg-config' +package 'libopenblas-dev' diff --git a/cmake/BuildWhispercpp.cmake b/cmake/BuildWhispercpp.cmake index 80977b7..aa09027 100644 --- a/cmake/BuildWhispercpp.cmake +++ b/cmake/BuildWhispercpp.cmake @@ -11,9 +11,9 @@ endif() # On linux add the `-fPIC` flag to the compiler if(UNIX AND NOT APPLE) set(WHISPER_EXTRA_CXX_FLAGS "-fPIC") + set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF -DWHISPER_BLAS_VENDOR=OpenBLAS) endif() -# if on Windows - download OpenBLAS prebuilt binaries if(WIN32) if(LOCALVOCAL_WITH_CUDA) # Build with CUDA Check that CUDA_TOOLKIT_ROOT_DIR is set @@ -24,7 +24,7 @@ if(WIN32) set(WHISPER_ADDITIONAL_ENV "CUDAToolkit_ROOT=${CUDA_TOOLKIT_ROOT_DIR}") set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_CUBLAS=ON -DCMAKE_GENERATOR_TOOLSET=cuda=${CUDA_TOOLKIT_ROOT_DIR}) - else(LOCALVOCAL_WITH_CUDA) + else() # Build with OpenBLAS set(OpenBLAS_URL "https://github.com/xianyi/OpenBLAS/releases/download/v0.3.24/OpenBLAS-0.3.24-x64.zip") set(OpenBLAS_SHA256 "6335128ee7117ea2dd2f5f96f76dafc17256c85992637189a2d5f6da0c608163") @@ -39,8 +39,8 @@ if(WIN32) ExternalProject_Get_Property(OpenBLAS INSTALL_DIR) set(OpenBLAS_DIR ${INSTALL_DIR}) set(WHISPER_ADDITIONAL_ENV "OPENBLAS_PATH=${OpenBLAS_DIR}") - set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF) - endif(LOCALVOCAL_WITH_CUDA) + set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF) + endif() ExternalProject_Add( Whispercpp_Build @@ -78,12 +78,12 @@ else() CMAKE_GENERATOR ${CMAKE_GENERATOR} INSTALL_COMMAND ${CMAKE_COMMAND} --install --config ${Whispercpp_BUILD_TYPE} CONFIGURE_COMMAND - ${CMAKE_COMMAND} -E env OPENBLAS_PATH=${OpenBLAS_DIR} ${CMAKE_COMMAND} -B -G + ${CMAKE_COMMAND} -E env ${WHISPER_ADDITIONAL_ENV} ${CMAKE_COMMAND} -B -G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=${Whispercpp_BUILD_TYPE} -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_} -DCMAKE_CXX_FLAGS=${WHISPER_EXTRA_CXX_FLAGS} -DCMAKE_C_FLAGS=${WHISPER_EXTRA_CXX_FLAGS} -DBUILD_SHARED_LIBS=OFF -DWHISPER_BUILD_TESTS=OFF - -DWHISPER_BUILD_EXAMPLES=OFF -DWHISPER_BLAS=OFF) + -DWHISPER_BUILD_EXAMPLES=OFF ${WHISPER_ADDITIONAL_CMAKE_ARGS}) endif(WIN32) ExternalProject_Get_Property(Whispercpp_Build INSTALL_DIR)