cmake : update semver and release process [no ci] (#3996)

* 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.

* ci : update release workflow to be consistent with llama.cpp

work in progress...

* ci : fix if statement in release.yml

* ci : comment out all but one build in release.yml

This is just for testing and this commit should not be included in the
main PR later.

* ci : use DEPLOY_KEY_RELEASE

This commit updates the release and make-release workflows to use the
DEPLOY_KEY_RELEASE secret. Two github ruleset have been imported.

* ci : add github rulesets for releases

These were retrived from llama.cpp and then imported into my fork for
testing. If all works well they will be imported into whisper.cpp
upstream as well.

* fix move artifacts step

* examples : use FetchContent for llama.cpp in talk-llama

This commit updated the example talk-llama to remove the vendored
llama.cpp and instead use FetchContent to pull it in from the
upstream repo.

* ci: add GGML_NATIVE=OFF to build-clang.yml

This commit disables native CPU instructions from the ubuntu-22-clang
job.

The motivation for this is that currently it is possible that the
running compiling llama.cpp (via ccache) might have support for cpu
instructions that are not available on the target runner.

Refs: https://github.com/ggml-org/whisper.cpp/actions/runs/32224048267/job/95980031403?pr=3996

* ci : add missing GGML_NATIVE=OFF to jobs

* ci : add attestation for signed release artifacts

This commit add attenstions of artifacts to the release workflow.

After building the artifacts can be verified with the following command:
```console
$ curl -sSL -o whisper-bin-ubuntu-x64.tar.gz \
    https://github.com/danbev/whisper.cpp/releases/download/b4947/whisper-bin-ubuntu-x64.tar.gz

$ gh attestation verify --repo danbev/whisper.cpp whisper-bin-ubuntu-x64.tar.gz
Loaded digest sha256:722a6812263195d7ee2192b57fc64a6d6b09a6cdf2f55a152f793db27a651e31 for file://whisper-bin-ubuntu-x64.tar.gz
Loaded 1 attestation from GitHub API

The following policy criteria will be enforced:
- Predicate type must match:................ https://slsa.dev/provenance/v1
- Source Repository Owner URI must match:... https://github.com/danbev
- Source Repository URI must match:......... https://github.com/danbev/whisper.cpp
- Subject Alternative Name must match regex: (?i)^https://github\.com/danbev/whisper\.cpp/
- OIDC Issuer must match:................... https://token.actions.githubusercontent.com

✓ Verification succeeded!

The following 1 attestation matched the policy criteria

- Attestation #1
  - Build repo:..... danbev/whisper.cpp
  - Build workflow:. .github/workflows/release.yml@refs/heads/master
  - Signer repo:.... danbev/whisper.cpp
  - Signer workflow: .github/workflows/release.yml@refs/heads/master
```

* cmake : add WHISPER_USE_SYSTEM_LLAMA option [no ci]

This commit adds a new CMake option WHISPER_USE_SYSTEM_LLAMA that allows
the talk-llama example to use a system-installed llama.cpp library.

Setting this will automatically also set WHISPER_USE_SYSTEM_GGML to ON
and the system ggml library will be used in addition to the system
llama.cpp.

* ci : remove unused ccache step

* Revert "ci : comment out all but one build in release.yml"

This reverts commit 24b56776e1.

* ci : set WHISPER_BUILD_IS_DEV=OFF in release.yml
This commit is contained in:
Daniel Bevenius
2026-08-20 09:34:27 +02:00
committed by GitHub
parent 4834a2327d
commit 81c190560a
236 changed files with 594 additions and 93634 deletions
+41 -15
View File
@@ -1,9 +1,26 @@
cmake_minimum_required(VERSION 3.5) # for add_link_options and implicit target directories.
project("whisper.cpp" C CXX)
project("whisper.cpp" VERSION 1.9.2)
include(CheckIncludeFileCXX)
set(SOVERSION 1)
### whisper.cpp version
set(WHISPER_VERSION_MAJOR 1)
set(WHISPER_VERSION_MINOR 9)
set(WHISPER_VERSION_PATCH 2)
set(WHISPER_VERSION_BASE "${WHISPER_VERSION_MAJOR}.${WHISPER_VERSION_MINOR}.${WHISPER_VERSION_PATCH}")
# whether this is a development/nightly build
# set this to OFF when making a release from a release tag (vX.Y.Z)
# ref: https://github.com/ggml-org/ggml/discussions/1579
option(WHISPER_BUILD_IS_DEV "whisper: dev build" ON)
if (WHISPER_BUILD_IS_DEV)
set(WHISPER_VERSION "${WHISPER_VERSION_BASE}-dev")
else()
# TODO: check that the current commit is tagged correctly according to the version specified above
set(WHISPER_VERSION "${WHISPER_VERSION_BASE}")
endif()
message(STATUS "whisper.cpp version: ${WHISPER_VERSION}")
#set(CMAKE_WARN_DEPRECATED YES)
set(CMAKE_WARN_UNUSED_CLI YES)
@@ -68,8 +85,14 @@ option(WHISPER_ALL_WARNINGS "whisper: enable all compiler warnings"
option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF)
# build
option(WHISPER_FATAL_WARNINGS "whisper: enable -Werror flag" OFF)
option(WHISPER_USE_SYSTEM_GGML "whisper: use system-installed GGML library" OFF)
option(WHISPER_FATAL_WARNINGS "whisper: enable -Werror flag" OFF)
option(WHISPER_USE_SYSTEM_GGML "whisper: use system-installed GGML library" OFF)
option(WHISPER_USE_SYSTEM_LLAMA "whisper: use system-installed llama.cpp library" OFF)
if (WHISPER_USE_SYSTEM_LLAMA AND NOT WHISPER_USE_SYSTEM_GGML)
message(STATUS "WHISPER_USE_SYSTEM_LLAMA=ON: setting WHISPER_USE_SYSTEM_GGML=ON")
set(WHISPER_USE_SYSTEM_GGML ON CACHE BOOL "" FORCE)
endif()
# sanitizers
option(WHISPER_SANITIZE_THREAD "whisper: enable thread sanitizer" OFF)
@@ -170,9 +193,12 @@ add_subdirectory(src)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(WHISPER_BUILD_NUMBER ${BUILD_NUMBER})
set(WHISPER_BUILD_COMMIT ${BUILD_COMMIT})
set(WHISPER_INSTALL_VERSION ${CMAKE_PROJECT_VERSION})
if (NOT DEFINED WHISPER_BUILD_NUMBER)
set(WHISPER_BUILD_NUMBER ${BUILD_NUMBER})
endif()
if (NOT DEFINED WHISPER_BUILD_COMMIT)
set(WHISPER_BUILD_COMMIT ${BUILD_COMMIT})
endif()
set(WHISPER_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
set(WHISPER_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
@@ -185,14 +211,14 @@ set_target_properties(whisper PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DI
install(TARGETS whisper LIBRARY PUBLIC_HEADER)
target_compile_definitions(whisper PRIVATE
WHISPER_VERSION="${PROJECT_VERSION}"
WHISPER_VERSION="${WHISPER_VERSION}"
)
set_target_properties(parakeet PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/include/parakeet.h)
install(TARGETS parakeet LIBRARY PUBLIC_HEADER)
target_compile_definitions(parakeet PRIVATE
PARAKEET_VERSION="${PROJECT_VERSION}"
PARAKEET_VERSION="${WHISPER_VERSION}"
)
configure_package_config_file(
@@ -205,12 +231,12 @@ configure_package_config_file(
WHISPER_BIN_INSTALL_DIR )
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/whisper-version.cmake
VERSION ${WHISPER_INSTALL_VERSION}
${CMAKE_CURRENT_BINARY_DIR}/whisper-config-version.cmake
VERSION ${WHISPER_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/whisper-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/whisper-version.cmake
${CMAKE_CURRENT_BINARY_DIR}/whisper-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/whisper)
configure_file(cmake/whisper.pc.in
@@ -234,12 +260,12 @@ configure_package_config_file(
PARAKEET_BIN_INSTALL_DIR)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/parakeet-version.cmake
VERSION ${WHISPER_INSTALL_VERSION}
${CMAKE_CURRENT_BINARY_DIR}/parakeet-config-version.cmake
VERSION ${WHISPER_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/parakeet-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/parakeet-version.cmake
${CMAKE_CURRENT_BINARY_DIR}/parakeet-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/parakeet)
configure_file(cmake/parakeet.pc.in