diff --git a/.github/workflows/build-cmake-pkg.yml b/.github/workflows/build-cmake-pkg.yml index 5becff09c1..a958870de3 100644 --- a/.github/workflows/build-cmake-pkg.yml +++ b/.github/workflows/build-cmake-pkg.yml @@ -21,6 +21,7 @@ jobs: -DLLAMA_BUILD_TOOLS=OFF \ -DLLAMA_BUILD_EXAMPLES=OFF \ -DLLAMA_BUILD_APP=OFF \ + -DLLAMA_BUILD_IS_DEV=OFF \ -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release cmake --install build --prefix "$PREFIX" --config Release @@ -29,7 +30,12 @@ jobs: tclsh <<'EOF' set build(commit) [string trim [exec git rev-parse --short HEAD]] set build(number) [string trim [exec git rev-list --count HEAD]] - set build(version) "0.0.$build(number)" + + set cmakelists [read [open "CMakeLists.txt" r]] + regexp {set\(LLAMA_VERSION_MAJOR\s+(\d+)\)} $cmakelists -> major + regexp {set\(LLAMA_VERSION_MINOR\s+(\d+)\)} $cmakelists -> minor + regexp {set\(LLAMA_VERSION_PATCH\s+(\d+)\)} $cmakelists -> patch + set build(version) "$major.$minor.$patch" set llamaconfig [read [open "$env(LLAMA_CONFIG)" r]] set checks [list "set\\(LLAMA_VERSION \\s+$build(version)\\)" \ diff --git a/.github/workflows/build-cpu.yml b/.github/workflows/build-cpu.yml index 30b07ce788..57622e1d45 100644 --- a/.github/workflows/build-cpu.yml +++ b/.github/workflows/build-cpu.yml @@ -95,7 +95,8 @@ jobs: run: | cmake -B build \ -DLLAMA_FATAL_WARNINGS=ON \ - -DGGML_RPC=ON + -DGGML_RPC=ON \ + -DGGML_NATIVE=OFF time cmake --build build --config Release -j $(nproc) - name: Test diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml new file mode 100644 index 0000000000..fed9c877c7 --- /dev/null +++ b/.github/workflows/make-release.yml @@ -0,0 +1,46 @@ +name: Make Release + +on: + workflow_dispatch: + inputs: + dry_run: + description: 'Dry run - validate without creating the tag' + required: true + type: boolean + default: true + +env: + GH_TOKEN: ${{ github.token }} + +permissions: + contents: write + +jobs: + make-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Run release checks + id: checks + run: bash scripts/make-release-checks.sh ${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }} + env: + GITHUB_REPOSITORY: ${{ github.repository }} + + - name: Create release tag + if: ${{ github.event.inputs.dry_run == 'false' }} + run: | + VERSION="${{ steps.checks.outputs.version }}" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "${VERSION}" -m "Release ${VERSION}" + git push origin "${VERSION}" + echo "Created and pushed tag ${VERSION}" + + - name: Dry run summary + if: ${{ github.event.inputs.dry_run == 'true' }} + run: | + echo "Dry run complete - all checks passed." + echo "Would have created tag: ${{ steps.checks.outputs.version }}" diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 69e24f9400..c0a814f3ad 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -19,6 +19,8 @@ jobs: run: | cargo binstall komac@2.16.0 -y + # TODO: This should later be updated to publish releases instead of + # development release builds. - name: Find latest release id: find_latest_release uses: actions/github-script@v8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3df1d82dbe..b2092d12dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,26 @@ cmake_minimum_required(VERSION 3.14...3.28) # for add_link_options and implicit project("llama.cpp" C CXX) include(CheckIncludeFileCXX) +### llama.cpp version +set(LLAMA_VERSION_MAJOR 0) +set(LLAMA_VERSION_MINOR 1) +set(LLAMA_VERSION_PATCH 0) +set(LLAMA_VERSION_BASE "${LLAMA_VERSION_MAJOR}.${LLAMA_VERSION_MINOR}.${LLAMA_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(LLAMA_BUILD_IS_DEV "llama: dev build" ON) + +if (LLAMA_BUILD_IS_DEV) + set(LLAMA_VERSION "${LLAMA_VERSION_BASE}-dev") +else() + # TODO: check that the current commit is tagged correctly according to the version specified above + set(LLAMA_VERSION "${LLAMA_VERSION_BASE}") +endif() + +message(STATUS "llama.cpp version: ${LLAMA_VERSION}") + #set(CMAKE_WARN_DEPRECATED YES) set(CMAKE_WARN_UNUSED_CLI YES) @@ -24,9 +44,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(LLAMA_STANDALONE ON) include(git-vars) - - # configure project version - # TODO else() set(LLAMA_STANDALONE OFF) endif() @@ -139,7 +156,6 @@ endif() if (NOT DEFINED LLAMA_BUILD_COMMIT) set(LLAMA_BUILD_COMMIT ${BUILD_COMMIT}) endif() -set(LLAMA_INSTALL_VERSION 0.0.${LLAMA_BUILD_NUMBER}) # override ggml options set(GGML_ALL_WARNINGS ${LLAMA_ALL_WARNINGS}) @@ -275,12 +291,12 @@ configure_package_config_file( LLAMA_BIN_INSTALL_DIR ) write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/llama-version.cmake - VERSION ${LLAMA_INSTALL_VERSION} + ${CMAKE_CURRENT_BINARY_DIR}/llama-config-version.cmake + VERSION ${LLAMA_VERSION} COMPATIBILITY SameMajorVersion) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/llama-config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/llama-version.cmake + ${CMAKE_CURRENT_BINARY_DIR}/llama-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/llama) configure_file(cmake/llama.pc.in diff --git a/README.md b/README.md index fc7633a7c5..1b341e7fbc 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ The `llama.cpp` project is build on top of the [ggml](https://github.com/ggml-or - [XCFramework](docs/xcframework.md) - [Completions](docs/completions.md) - [Models](docs/models.md) +- [Release process](docs/release.md) ## Contributing diff --git a/app/llama.cpp b/app/llama.cpp index 2cf1aa876c..3b7e46f20d 100644 --- a/app/llama.cpp +++ b/app/llama.cpp @@ -1,5 +1,7 @@ #include "build-info.h" +#include "llama.h" + #include #include #include @@ -77,12 +79,12 @@ static const command cmds[] = { #undef UPDATE_HIDDEN -static int version(int argc, char ** argv) { - printf("%s\n", llama_build_info()); +static int version(int /*argc*/, char ** /*argv*/) { + llama_print_build_info(llama_version()); return 0; } -static int licenses(int argc, char ** argv) { +static int licenses(int /*argc*/, char ** /*argv*/) { for (int i = 0; LICENSES[i]; ++i) { printf("%s\n", LICENSES[i]); } diff --git a/cmake/llama-config.cmake.in b/cmake/llama-config.cmake.in index b4defc76ff..6db73577ae 100644 --- a/cmake/llama-config.cmake.in +++ b/cmake/llama-config.cmake.in @@ -1,4 +1,4 @@ -set(LLAMA_VERSION @LLAMA_INSTALL_VERSION@) +set(LLAMA_VERSION @LLAMA_VERSION@) set(LLAMA_BUILD_COMMIT @LLAMA_BUILD_COMMIT@) set(LLAMA_BUILD_NUMBER @LLAMA_BUILD_NUMBER@) set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@) diff --git a/cmake/llama.pc.in b/cmake/llama.pc.in index 6fb58b5f68..31b043c0e3 100644 --- a/cmake/llama.pc.in +++ b/cmake/llama.pc.in @@ -5,6 +5,6 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: llama Description: Port of Facebook's LLaMA model in C/C++ -Version: @LLAMA_INSTALL_VERSION@ +Version: @LLAMA_VERSION@ Libs: -L${libdir} -lggml -lggml-base -lllama Cflags: -I${includedir} diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 799d227519..d6cfc9a008 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -121,8 +121,8 @@ add_library(${TARGET} ) set_target_properties(${TARGET} PROPERTIES - VERSION ${LLAMA_INSTALL_VERSION} - SOVERSION 0 + VERSION ${LLAMA_VERSION_BASE} + SOVERSION ${LLAMA_VERSION_MAJOR} MACHO_CURRENT_VERSION 0 # keep macOS linker from seeing oversized version number ) diff --git a/common/arg.cpp b/common/arg.cpp index cb314eee70..b2fddfe5f2 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -1390,8 +1390,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex {"--version"}, "show version and build info", [](common_params &) { - fprintf(stderr, "version: %d (%s)\n", llama_build_number(), llama_commit()); - fprintf(stderr, "built with %s for %s\n", llama_compiler(), llama_build_target()); + llama_print_build_info(llama_version()); exit(0); } )); diff --git a/common/build-info.cpp.in b/common/build-info.cpp.in index f888fd079f..4ec3397081 100644 --- a/common/build-info.cpp.in +++ b/common/build-info.cpp.in @@ -29,7 +29,7 @@ const char * llama_build_info(void) { return s.c_str(); } -void llama_print_build_info(void) { - fprintf(stderr, "%s: build = %d (%s)\n", __func__, llama_build_number(), llama_commit()); - fprintf(stderr, "%s: built with %s for %s\n", __func__, llama_compiler(), llama_build_target()); +void llama_print_build_info(const char * llama_version) { + fprintf(stderr, "version: %s (build %d, commit %s)\n", llama_version, llama_build_number(), llama_commit()); + fprintf(stderr, "built with %s for %s\n", llama_compiler(), llama_build_target()); } diff --git a/common/build-info.h b/common/build-info.h index 382cfa7850..1e564591a6 100644 --- a/common/build-info.h +++ b/common/build-info.h @@ -8,4 +8,4 @@ const char * llama_compiler(void); const char * llama_build_target(void); const char * llama_build_info(void); -void llama_print_build_info(void); +void llama_print_build_info(const char *); diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 0000000000..4335ef9d42 --- /dev/null +++ b/docs/release.md @@ -0,0 +1,49 @@ +# Release process + +llama.cpp uses [semantic versioning](https://semver.org) (`MAJOR.MINOR.PATCH`). + +## Version bump guidelines + +| Change type | Version component | +|---|---| +| Breaking change to the public C API (`include/llama.h`) | `MAJOR` | +| Backward-compatible features, model support, or API addition | `MINOR` | +| Bug fix with no API change | `PATCH` | + +The version is set in the three variables at the top of the root `CMakeLists.txt`: + +```cmake +set(LLAMA_VERSION_MAJOR 0) +set(LLAMA_VERSION_MINOR 1) +set(LLAMA_VERSION_PATCH 0) +``` + +_A version bump should be included in the PR that introduces the change, or in a +dedicated bump commit merged before the release is cut._ + +_TODO: add PR labels (`semver: patch`, `semver: minor`, `semver: major`) to help +identify which PRs require a version bump before cutting a release._ + +## Making a release + +Releases are created by running the [make-release](.github/workflows/make-release.yml) +which is a manual workflow. + +The workflow creates an annotated git tag (e.g. `v0.1.0`) and pushes it to the +remote. No GitHub Release object is created, the tag is the release artifact. + +## Building a release + +By default, `LLAMA_BUILD_IS_DEV=ON` which appends a `-dev` suffix to `LLAMA_VERSION`, +marking the build as a nightly/development build. Distributors building from a +release tag must pass `-DLLAMA_BUILD_IS_DEV=OFF` to produce a clean version string +(e.g. `0.1.0` instead of `0.1.0-dev`). + +## How releases reach users +Currently releases are not published to github releases, only nightly/development +builds are available there. The way users can access releases are using the following +channels: + +- **llama-install.sh** — downloads pre-built binaries built from the release tag. +- **Package managers** — consume the git tag directly. +- **Build from source** — users clone the repo and check out the tag. diff --git a/examples/test-cmake/.gitignore b/examples/test-cmake/.gitignore new file mode 100644 index 0000000000..0ddff317a4 --- /dev/null +++ b/examples/test-cmake/.gitignore @@ -0,0 +1,3 @@ +llama-build-install +install +build diff --git a/examples/test-cmake/CMakeLists.txt b/examples/test-cmake/CMakeLists.txt new file mode 100644 index 0000000000..ed5cb1f3c2 --- /dev/null +++ b/examples/test-cmake/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.14) +project(llama-simple) + +set(CMAKE_CXX_STANDARD 17) + +find_package(llama 0.1.0 REQUIRED) + +add_executable(test-cmake test-cmake.cpp) +target_link_libraries(test-cmake PRIVATE llama) +target_compile_definitions(test-cmake PRIVATE + LLAMA_BUILD_NUMBER=${LLAMA_BUILD_NUMBER} + LLAMA_BUILD_COMMIT="${LLAMA_BUILD_COMMIT}" +) diff --git a/examples/test-cmake/README.md b/examples/test-cmake/README.md new file mode 100644 index 0000000000..21e5eb9607 --- /dev/null +++ b/examples/test-cmake/README.md @@ -0,0 +1,36 @@ +## cmake-test + +This is just for manually testing/developing of a llama.cpp installation to +enable troubleshooting issues and exploration. The idea is that this can be used +after making changes to llama.cpp installation cmake configuration and then +verify it locally. + +### Usage +The following will configure, build, and install llama.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 follwing files in its lib directory: +```console +(venv) $ ls install/lib/ +cmake libggml.so libllama-common.so.0 libllama.so.0.1.0 llama.cpp +libggml-base.so libggml.so.0 libllama-common.so.0.1.0 libmtmd.so pkgconfig +libggml-base.so.0 libggml.so.0.19.0 libllama.so libmtmd.so.0 +libggml-base.so.0.19.0 libllama-common.so libllama.so.0 libmtmd.so.0.1.0 +``` + +Build/run this project using the installation created above: +```console +(venv) $ ./build.sh +-- Configuring done (0.0s) +-- Generating done (0.0s) +-- Build files have been written to: /home/danbev/work/ai/llama.cpp/examples/test-cmake/build +[100%] Built target test-cmake +[test-cmake] Using llama.cpp version 0.1.0-dev-b10335 +[test-cmake] Initializing backend... +load_backend: loaded CPU backend from /home/danbev/work/ai/llama.cpp/examples/test-cmake/install/lib/llama.cpp/libggml-cpu-alderlake.so +[test-cmake] Backend initialized. +``` diff --git a/examples/test-cmake/build-install.sh b/examples/test-cmake/build-install.sh new file mode 100755 index 0000000000..77a6713d67 --- /dev/null +++ b/examples/test-cmake/build-install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +rm -rf llama-build-install install + +cmake --fresh -S ../../. -B llama-build-install -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ + -DLLAMA_TESTS_INSTALL=OFF \ + -DCMAKE_INSTALL_PREFIX="${PWD}/install" \ + -DGGML_BACKEND_DIR="${PWD}/install/lib/llama.cpp" \ + -DGGML_LIB_INSTALL_DIR="${PWD}/install/lib/llama.cpp" \ + -DLLAMA_LIB_INSTALL_DIR="${PWD}/install/lib/llama.cpp" \ + -DLLAMA_TOOLS_INSTALL=OFF + +cmake --build llama-build-install --parallel 12 +cmake --install llama-build-install diff --git a/examples/test-cmake/build.sh b/examples/test-cmake/build.sh new file mode 100755 index 0000000000..a212732b89 --- /dev/null +++ b/examples/test-cmake/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cmake -S . -B build -DCMAKE_PREFIX_PATH="${PWD}/install" +cmake --build build +LD_LIBRARY_PATH="${PWD}/install/lib/llama.cpp:${PWD}/install/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" ./build/test-cmake diff --git a/examples/test-cmake/test-cmake.cpp b/examples/test-cmake/test-cmake.cpp new file mode 100644 index 0000000000..c5c4765b43 --- /dev/null +++ b/examples/test-cmake/test-cmake.cpp @@ -0,0 +1,12 @@ +#include "llama.h" +#include + +int main(void) { + printf("[test-cmake] version: %s, build: %d (%s)\n", + llama_version(), LLAMA_BUILD_NUMBER, LLAMA_BUILD_COMMIT); + printf("[test-cmake] Initializing backend...\n"); + llama_backend_init(); + printf("[test-cmake] Backend initialized.\n"); + llama_backend_free(); + return 0; +} diff --git a/include/llama.h b/include/llama.h index ef278c9c32..177fc10a91 100644 --- a/include/llama.h +++ b/include/llama.h @@ -457,6 +457,8 @@ extern "C" { // lora adapter struct llama_adapter_lora; + LLAMA_API const char * llama_version(void); + // Helpers for getting default parameters // TODO: update API to start accepting pointers to params structs (https://github.com/ggml-org/llama.cpp/discussions/9172) LLAMA_API struct llama_model_params llama_model_default_params(void); diff --git a/scripts/make-release-checks.sh b/scripts/make-release-checks.sh new file mode 100755 index 0000000000..c8c6322841 --- /dev/null +++ b/scripts/make-release-checks.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Run all pre-release checks and determine the release version. +# +# Usage: make-release-checks.sh [--dry-run] +# --dry-run: warn on failures instead of aborting +# +# Env (when running in GitHub Actions): GH_TOKEN, GITHUB_REPOSITORY, GITHUB_OUTPUT +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +DRY_RUN=false +for arg in "$@"; do + case "$arg" in + --dry-run) DRY_RUN=true ;; + *) echo "Unknown argument: $arg"; exit 1 ;; + esac +done + +MAJOR=$(grep "set(LLAMA_VERSION_MAJOR" "$REPO_ROOT/CMakeLists.txt" | grep -oP '\d+') +MINOR=$(grep "set(LLAMA_VERSION_MINOR" "$REPO_ROOT/CMakeLists.txt" | grep -oP '\d+') +PATCH=$(grep "set(LLAMA_VERSION_PATCH" "$REPO_ROOT/CMakeLists.txt" | grep -oP '\d+') +VERSION="v${MAJOR}.${MINOR}.${PATCH}" +echo "Determined version: ${VERSION}" +if [[ -n "${GITHUB_OUTPUT:-}" ]]; then + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" +fi + +echo "Checking that tag ${VERSION} does not already exist..." +if git ls-remote --tags origin "${VERSION}" | grep -q "${VERSION}"; then + echo "Error: tag ${VERSION} already exists on remote" + exit 1 +fi +echo "Tag ${VERSION} does not exist on remote - OK" + +SHA=$(git rev-parse HEAD) +echo "Checking release.yml status for commit ${SHA}..." +if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then + echo "Warning: GITHUB_REPOSITORY not set - skipping CI check (local run)" +else + RUNS=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/release.yml/runs" \ + --jq "[.workflow_runs[] | select(.head_sha == \"${SHA}\" and .conclusion == \"success\")] | length") + if [[ "$RUNS" -eq 0 ]]; then + if [[ "$DRY_RUN" == "true" ]]; then + echo "Warning: no successful release.yml run found for HEAD (${SHA}) (dry run, continuing)." + else + echo "Error: no successful release.yml run found for HEAD (${SHA})" + echo "The nightly build must complete successfully before making a release." + exit 1 + fi + else + echo "Found successful release.yml run for HEAD." + fi +fi + +MAJOR=$(grep "set(GGML_VERSION_MAJOR" "$REPO_ROOT/ggml/CMakeLists.txt" | grep -oP '\d+') +MINOR=$(grep "set(GGML_VERSION_MINOR" "$REPO_ROOT/ggml/CMakeLists.txt" | grep -oP '\d+') +PATCH=$(grep "set(GGML_VERSION_PATCH" "$REPO_ROOT/ggml/CMakeLists.txt" | grep -oP '\d+') +GGML_VERSION="v${MAJOR}.${MINOR}.${PATCH}" +echo "Local ggml version: ${GGML_VERSION}" + +if ! git clone --depth 1 --branch "${GGML_VERSION}" https://github.com/ggml-org/ggml.git upstream-ggml 2>/dev/null; then + echo "Warning: tag ${GGML_VERSION} not found in upstream ggml - skipping comparison" +else + echo "Comparing local ggml/ src and include with upstream ${GGML_VERSION}..." + DIFF=$(diff -rq "$REPO_ROOT/ggml/src" upstream-ggml/src 2>&1 || true) + DIFF+=$(diff -rq "$REPO_ROOT/ggml/include" upstream-ggml/include 2>&1 || true) + DIFF+=$(diff "$REPO_ROOT/ggml/CMakeLists.txt" upstream-ggml/CMakeLists.txt 2>&1 || true) + rm -rf upstream-ggml + if [[ -n "$DIFF" ]]; then + echo "local ggml/ differs from upstream ${GGML_VERSION}:" + echo "$DIFF" + if [[ "$DRY_RUN" == "true" ]]; then + echo "Warning: would abort release due to ggml mismatch (dry run, continuing)." + else + echo "Error: ggml must match upstream before making a release." + exit 1 + fi + else + echo "local ggml/ matches upstream ${GGML_VERSION}" + fi +fi diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 24f05cc916..39ba3061f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,11 +45,16 @@ add_library(llama ) set_target_properties(llama PROPERTIES - VERSION ${LLAMA_INSTALL_VERSION} - SOVERSION 0 + VERSION ${LLAMA_VERSION_BASE} + SOVERSION ${LLAMA_VERSION_MAJOR} MACHO_CURRENT_VERSION 0 # keep macOS linker from seeing oversized version number ) +target_compile_definitions(llama PRIVATE + LLAMA_VERSION="${LLAMA_VERSION}" + LLAMA_COMMIT="${LLAMA_BUILD_COMMIT}" +) + target_include_directories(llama PRIVATE .) target_include_directories(llama PUBLIC ../include) target_compile_features (llama PRIVATE cxx_std_17) # don't bump diff --git a/src/llama.cpp b/src/llama.cpp index 94c8f60e0c..9ff1902fc1 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -114,6 +114,10 @@ bool llama_supports_rpc(void) { return ggml_backend_reg_by_name("RPC") != nullptr; } +const char * llama_version(void) { + return LLAMA_VERSION; +} + void llama_backend_init(void) { ggml_time_init(); diff --git a/tests/test-quantize-stats.cpp b/tests/test-quantize-stats.cpp index c655575340..e07d75b7e7 100644 --- a/tests/test-quantize-stats.cpp +++ b/tests/test-quantize-stats.cpp @@ -301,7 +301,7 @@ int main(int argc, char ** argv) { return 1; } - llama_print_build_info(); + llama_print_build_info(llama_version()); // load the model fprintf(stderr, "Loading model\n"); diff --git a/tools/cvector-generator/cvector-generator.cpp b/tools/cvector-generator/cvector-generator.cpp index 8c6b3d868d..558c37e612 100644 --- a/tools/cvector-generator/cvector-generator.cpp +++ b/tools/cvector-generator/cvector-generator.cpp @@ -421,7 +421,7 @@ int main(int argc, char ** argv) { params.cb_eval_user_data = &cb_data; params.warmup = false; - llama_print_build_info(); + llama_print_build_info(llama_version()); llama_backend_init(); llama_numa_init(params.numa); diff --git a/tools/gguf-split/gguf-split.cpp b/tools/gguf-split/gguf-split.cpp index 5cafcc9aa9..c6cdbb98e2 100644 --- a/tools/gguf-split/gguf-split.cpp +++ b/tools/gguf-split/gguf-split.cpp @@ -106,7 +106,7 @@ static void split_params_parse_ex(int argc, const char ** argv, split_params & p split_print_usage(argv[0]); exit(0); } else if (arg == "--version") { - fprintf(stderr, "version: %d (%s)\n", llama_build_number(), llama_commit()); + fprintf(stderr, "version: %s (build %d, commit %s)\n", llama_version(), llama_build_number(), llama_commit()); fprintf(stderr, "built with %s for %s\n", llama_compiler(), llama_build_target()); exit(0); } else if (arg == "--dry-run") { diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt index 3f4a6c670d..769a44e0b7 100644 --- a/tools/mtmd/CMakeLists.txt +++ b/tools/mtmd/CMakeLists.txt @@ -72,8 +72,8 @@ add_library(mtmd ) set_target_properties(mtmd PROPERTIES - VERSION ${LLAMA_INSTALL_VERSION} - SOVERSION 0 + VERSION ${LLAMA_VERSION_BASE} + SOVERSION ${LLAMA_VERSION_MAJOR} MACHO_CURRENT_VERSION 0 # keep macOS linker from seeing oversized version number ) diff --git a/tools/quantize/quantize.cpp b/tools/quantize/quantize.cpp index 15ef64c4b0..8d03c8fcd4 100644 --- a/tools/quantize/quantize.cpp +++ b/tools/quantize/quantize.cpp @@ -611,7 +611,7 @@ int llama_quantize(int argc, char ** argv) { } } - llama_print_build_info(); + llama_print_build_info(llama_version()); if (params.dry_run) { fprintf(stderr, "%s: calculating quantization size for '%s' as %s", __func__, fname_inp.c_str(), ftype_str.c_str());