Skip to content

Commit 65731a6

Browse files
committed
whisper : rename binaries + fix build (wip)
1 parent e4e0598 commit 65731a6

File tree

7 files changed

+69
-280
lines changed

7 files changed

+69
-280
lines changed

README.md

Lines changed: 19 additions & 253 deletions
Large diffs are not rendered by default.

examples/CMakeLists.txt

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,52 +97,35 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
9797

9898
if (EMSCRIPTEN)
9999
add_subdirectory(whisper.wasm)
100-
set_target_properties(libmain PROPERTIES FOLDER "libs")
101100
add_subdirectory(stream.wasm)
102-
set_target_properties(libstream PROPERTIES FOLDER "libs")
103101
add_subdirectory(command.wasm)
104-
set_target_properties(libcommand PROPERTIES FOLDER "libs")
105102
#add_subdirectory(talk.wasm)
106-
#set_target_properties(libtalk PROPERTIES FOLDER "libs")
107103
add_subdirectory(bench.wasm)
108-
set_target_properties(libbench PROPERTIES FOLDER "libs")
109104
elseif(CMAKE_JS_VERSION)
110105
add_subdirectory(addon.node)
111-
set_target_properties(addon.node PROPERTIES FOLDER "examples")
112106
else()
113-
add_subdirectory(main)
114-
set_target_properties(main PROPERTIES FOLDER "examples")
107+
add_subdirectory(cli)
115108
if (WHISPER_SDL2)
116109
add_subdirectory(stream)
117-
set_target_properties(stream PROPERTIES FOLDER "examples")
118110
endif (WHISPER_SDL2)
119111
add_subdirectory(server)
120-
set_target_properties(server PROPERTIES FOLDER "examples")
121112
if (WHISPER_SDL2)
122113
add_subdirectory(command)
123-
set_target_properties(command PROPERTIES FOLDER "examples")
124114
endif (WHISPER_SDL2)
125115
add_subdirectory(bench)
126-
set_target_properties(bench PROPERTIES FOLDER "examples")
127116
add_subdirectory(quantize)
128-
set_target_properties(quantize PROPERTIES FOLDER "examples")
129117
if (WHISPER_SDL2)
130118
# TODO: disabled until update
131119
# https://github.com/ggerganov/whisper.cpp/issues/1818
132120
#add_subdirectory(talk)
133-
#set_target_properties(talk PROPERTIES FOLDER "examples")
134121
add_subdirectory(talk-llama)
135-
set_target_properties(talk-llama PROPERTIES FOLDER "examples")
136122
add_subdirectory(lsp)
137-
set_target_properties(lsp PROPERTIES FOLDER "examples")
138123
if (GGML_SYCL)
139124
add_subdirectory(sycl)
140-
set_target_properties(ls-sycl-device PROPERTIES FOLDER "examples")
141125
endif()
142126
endif (WHISPER_SDL2)
143127
endif()
144128

145129
if (WHISPER_SDL2)
146130
add_subdirectory(wchess)
147-
set_target_properties(wchess PROPERTIES FOLDER "examples")
148131
endif (WHISPER_SDL2)

examples/cli/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set(TARGET whisper-cli)
2+
add_executable(${TARGET} cli.cpp)
3+
4+
include(DefaultTargetOptions)
5+
6+
target_link_libraries(${TARGET} PRIVATE common whisper ${FFMPEG_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
7+
8+
install(TARGETS ${TARGET} RUNTIME)
9+
10+
add_executable(main ../deprecation-warning.cpp)
11+
target_compile_features(main PRIVATE cxx_std_11)

examples/main/README.md renamed to examples/cli/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# main
1+
# whisper.cpp/examples/cli
22

33
This is the main example demonstrating most of the functionality of the Whisper model.
44
It can be used as a reference for using the `whisper.cpp` library in other projects.
55

66
```
7-
./main -h
7+
./build/bin/whisper-cli -h
88
9-
usage: ./main [options] file0.wav file1.wav ...
9+
usage: ./whisper-cli [options] file0.wav file1.wav ...
1010
1111
options:
1212
-h, --help [default] show this help message and exit
File renamed without changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Warns users that this filename was deprecated, and provides a link for more information.
2+
3+
#include <cstdio>
4+
#include <string>
5+
#include <unordered_map>
6+
7+
// Main
8+
int main(int argc, char** argv) {
9+
std::string filename = "main";
10+
if (argc >= 1) {
11+
filename = argv[0];
12+
}
13+
14+
// Get only the program name from the full path
15+
auto pos = filename.find_last_of("/\\");
16+
if (pos != std::string::npos) {
17+
filename = filename.substr(pos+1);
18+
}
19+
20+
// Append "llama-" to the beginning of filename to get the replacemnt filename
21+
auto replacement_filename = "llama-" + filename;
22+
23+
// The exception is if the filename is "main", then our replacement filename is "llama-cli"
24+
if (filename == "main") {
25+
replacement_filename = "llama-cli";
26+
}
27+
28+
fprintf(stdout, "\n");
29+
fprintf(stdout, "WARNING: The binary '%s' is deprecated.\n", filename.c_str());
30+
fprintf(stdout, " Please use '%s' instead.\n", replacement_filename.c_str());
31+
fprintf(stdout, " See https://github.com/ggerganov/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.\n");
32+
fprintf(stdout, "\n");
33+
34+
return EXIT_FAILURE;
35+
}

examples/main/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)