mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-10-17 11:45:38 +02:00
cmake : update semver handling to be consistent with ggml/llama.cpp
This commit modifies the semantic version handling to be consistent with how llama.cpp and ggml handle semver. This commit introdues a new example named test-cmake which is intended to be used to test the cmake configuration and installation.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
whisper-build-install
|
||||
install
|
||||
build
|
||||
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(whisper-simple)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# request a version that is satisfied by both dev (1.9.2-dev) and release (1.9.2) installs
|
||||
# (find_package does not accept a pre-release version as an argument)
|
||||
find_package(whisper 1.9.2 REQUIRED)
|
||||
|
||||
add_executable(test-cmake test-cmake.cpp)
|
||||
|
||||
target_link_libraries(test-cmake PRIVATE whisper)
|
||||
|
||||
target_compile_definitions(test-cmake PRIVATE
|
||||
WHISPER_BUILD_NUMBER=${WHISPER_BUILD_NUMBER}
|
||||
WHISPER_BUILD_COMMIT="${WHISPER_BUILD_COMMIT}"
|
||||
)
|
||||
@@ -0,0 +1,40 @@
|
||||
## cmake-test
|
||||
|
||||
This is just for manually testing/developing of a whisper.cpp installation to
|
||||
enable troubleshooting issues and exploration. The idea is that this can be used
|
||||
after making changes to whisper.cpp installation cmake configuration and then
|
||||
verify it locally.
|
||||
|
||||
### Usage
|
||||
The following will configure, build, and install whisper.cpp
|
||||
|
||||
Configuring/build/install:
|
||||
```console
|
||||
./build-install.sh
|
||||
```
|
||||
The above command will create a directory named `install` in the current directory
|
||||
which will have the following files in its lib directory:
|
||||
```console
|
||||
$ ls install/lib/
|
||||
cmake libggml-base.so libggml.so libparakeet.so libwhisper.so
|
||||
libggml-base.so.0 libggml-base.so.0.20.0 libggml.so.0 libparakeet.so.1 libwhisper.so.1
|
||||
libggml-cpu.so libggml.so.0.20.0 libggml.so.0.20.0 libparakeet.so.1.9.2 libwhisper.so.1.9.2
|
||||
libggml-cpu.so.0 pkgconfig libparakeet.so libwhisper.so
|
||||
```
|
||||
|
||||
Build/run this project using the installation created above:
|
||||
```console
|
||||
$ ./build.sh
|
||||
-- The C compiler identification is GNU 13.3.0
|
||||
-- The CXX compiler identification is GNU 13.3.0
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Detecting CXX compiler ABI info - done
|
||||
-- Detecting CXX compile features - done
|
||||
-- Configuring done (0.1s)
|
||||
-- Generating done (0.0s)
|
||||
-- Build files have been written to: /path/to/whisper.cpp/examples/test-cmake/build
|
||||
[ 50%] Building CXX object CMakeFiles/test-cmake.dir/test-cmake.cpp.o
|
||||
[100%] Linking CXX executable test-cmake
|
||||
[100%] Built target test-cmake
|
||||
[test-cmake] version: 1.9.2-dev, build: 4925 (1fe009ca)
|
||||
```
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
build_dir=whisper-build-install
|
||||
install_dir=install
|
||||
|
||||
rm -rf ${build_dir} ${install_dir}
|
||||
|
||||
cmake -S ../../. -B ${build_dir} -DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DWHISPER_BUILD_TESTS=OFF \
|
||||
-DWHISPER_BUILD_EXAMPLES=OFF \
|
||||
-DWHISPER_BUILD_SERVER=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/${install_dir}"
|
||||
|
||||
cmake --build ${build_dir} --parallel 12
|
||||
cmake --install ${build_dir}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cmake -S . -B build -DCMAKE_PREFIX_PATH="${PWD}/install"
|
||||
cmake --build build
|
||||
|
||||
LD_LIBRARY_PATH="${PWD}/install/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" ./build/test-cmake
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "whisper.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
int main(void) {
|
||||
printf("[test-cmake] version: %s, build: %d (%s)\n",
|
||||
whisper_version(), WHISPER_BUILD_NUMBER, WHISPER_BUILD_COMMIT);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user