|
1 | 1 | cmake_minimum_required(VERSION 3.23)
|
2 | 2 | project(whisper_cpp_server)
|
3 | 3 |
|
4 |
| -set(CMAKE_CXX_STANDARD 14) |
| 4 | +set(CMAKE_CXX_STANDARD 17) |
| 5 | +# 查找 uWebSockets 的头文件路径 |
| 6 | +find_path(UWEBSOCKETS_INCLUDE_DIRS "uwebsockets/App.h") |
| 7 | +# 查找 zlib 库 |
| 8 | +find_package(ZLIB REQUIRED) |
| 9 | + |
| 10 | +# 查找 libuv 库 |
| 11 | +find_package(libuv CONFIG REQUIRED) |
| 12 | +# 查找 uSockets 库 |
| 13 | +find_library(USOCKETS_LIBRARY uSockets) |
| 14 | + |
5 | 15 | # find SDL2 library
|
6 | 16 | find_package(SDL2 CONFIG REQUIRED)
|
7 | 17 | message(STATUS "SDL2 include directories: ${SDL2_INCLUDE_DIRS}")
|
@@ -37,9 +47,28 @@ target_link_libraries(simplest whisper)
|
37 | 47 | add_executable(stream_local common.cpp common-sdl.cpp stream_local.cpp
|
38 | 48 | stream_components_service.cpp stream_components_audio.cpp
|
39 | 49 | stream_components_output.cpp
|
40 |
| - ) |
| 50 | + whisper_server_base_on_uwebsockets.cpp |
| 51 | +) |
41 | 52 | target_link_libraries(stream_local whisper ${SDL2_LIBRARIES})
|
42 | 53 |
|
43 | 54 | add_executable(whisper_http_server_base_httplib whisper_http_server_base_httplib.cpp common.cpp httplib.h json.hpp inference_handler.cpp whisper_params.cpp)
|
44 |
| -target_link_libraries(server whisper) |
| 55 | +target_link_libraries(whisper_http_server_base_httplib whisper) |
| 56 | + |
| 57 | +# 链接 uWebSockets、zlib、libuv 和 uSockets 库 |
| 58 | +add_executable(whisper_server_base_on_uwebsockets whisper_server_base_on_uwebsockets.cpp) |
| 59 | +#添加头文件 |
| 60 | +target_include_directories(whisper_server_base_on_uwebsockets PRIVATE ${UWEBSOCKETS_INCLUDE_DIRS}) |
| 61 | +# 链接 uWebSockets、zlib、libuv 和 uSockets 库 |
| 62 | +# 检测操作系统 |
| 63 | +if(WIN32) |
| 64 | + # 如果是 Windows |
| 65 | + target_link_libraries(whisper_server_base_on_uwebsockets PRIVATE whisper ZLIB::ZLIB libuv::uv ${USOCKETS_LIBRARY}) |
| 66 | +elseif(APPLE) |
| 67 | + # 如果是 MacOS |
| 68 | + target_link_libraries(whisper_server_base_on_uwebsockets PRIVATE whisper ZLIB::ZLIB libuv::uv_a ${USOCKETS_LIBRARY}) |
| 69 | +else() |
| 70 | + # 对于其他系统,比如 Linux |
| 71 | + target_link_libraries(whisper_server_base_on_uwebsockets PRIVATE whisper ZLIB::ZLIB libuv::uv ${USOCKETS_LIBRARY}) |
| 72 | +endif() |
| 73 | + |
45 | 74 |
|
0 commit comments