webassembly003 whisper.cpp的main项目-3 whispercpp_simple

        whispercpp执行cpu推理的最小依赖。

webassembly003 whisper.cpp的main项目-3 whispercpp_simple_第1张图片

(base) pdd@pdd-Dell-G15-5511:~/le/whispercpp_simple1$ tree
.
├── CMakeLists.txt
├── README.md
├── src
│   └── main.cpp
└── third_party
    ├── common.cpp
    ├── common-ggml.cpp
    ├── common-ggml.h
    ├── common.h
    ├── dr_wav.h
    ├── ggml.h
    ├── grammar-parser.cpp
    ├── grammar-parser.h
    ├── libwhisper.so
    ├── whisper.cpp
    └── whisper.h
cmake_minimum_required(VERSION 3.15)
project(whispercpp_simple)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party)

add_library(common STATIC
        ${CMAKE_CURRENT_SOURCE_DIR}/third_party/common.h
        ${CMAKE_CURRENT_SOURCE_DIR}/third_party/common.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/third_party/common-ggml.h
        ${CMAKE_CURRENT_SOURCE_DIR}/third_party/common-ggml.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/third_party/grammar-parser.cpp) # + dr_wav.h


file(GLOB SRC src/*.h src/*.cpp )
add_executable(${PROJECT_NAME} ${SRC})

target_link_libraries(${PROJECT_NAME}
    common
    whisper
)

  • main.cpp 拷贝自 https://github.com/ggerganov/whisper.cpp/blob/v1.5.0/examples/main/main.cpp

cg

// https://zhuanlan.zhihu.com/p/669249302
whispercpp_starter
    - whisper.cpp-v1.5.0
    - src
      |- main.cpp
    - CMakeLists.txt
  • CMakeLists.txt
cmake_minimum_required(VERSION 3.15)

# this only works for unix, xapian source code not support compile in windows yet

project(whispercpp_starter)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_subdirectory(whisper.cpp-v1.5.0)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/whisper.cpp-v1.5.0
    ${CMAKE_CURRENT_SOURCE_DIR}/whisper.cpp-v1.5.0/examples
)

file(GLOB SRC
    src/*.h
    src/*.cpp
)

add_executable(${PROJECT_NAME} ${SRC})

target_link_libraries(${PROJECT_NAME}
    common
    whisper # remember to copy dll or so to bin folder
)
  • https://stackoverflow.com/questions/364209/variable-or-field-declared-void
  • https://github.com/tazz4843/whisper-rs

你可能感兴趣的:(移动端,whisper)