llama.cpp/examples/test-cmake
Daniel Bevenius b1b770d90d
examples : remove explict version from test-cmake (#32191)
This commit removes the llama version test-cmake and instead uses the
version that is supplied by CMAKE_PREFIX_PATH.

The motivation for this is to avoid issues when bumping major versions.
2026-11-13 11:09:55 +02:00
..
.gitignore cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00
build-install.sh cmake : introduce semantic versioning (#26839) 2026-08-12 14:15:03 +02:00
build.sh cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00
CMakeLists.txt examples : remove explict version from test-cmake (#32191) 2026-11-13 11:09:55 +02:00
README.md cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00
test-cmake.cpp cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00

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.

find_package

The following will configure, build, and install llama.cpp, and the build a project that uses find_package to use the installation.

Configuring/build/install:

./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:

$ 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:

$ ./build.sh
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /path/to/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 /path/to/llama.cpp/examples/test-cmake/install/lib/llama.cpp/libggml-cpu-alderlake.so
[test-cmake] Backend initialized.

add_subdirectory

The following will use add_subdirectory to include llama.cpp in a cmake project and is intended to simulate projects that build llama.cpp in this way.

$ USE_SUBDIR=ON ./build.sh