KBaba7/llama.cpp
0
1# llama.cpp/example/simple-cmake-pkg2 3This program builds [simple](../simple) using a relocatable CMake package. It serves as an example of using the `find_package()` CMake command to conveniently include [llama.cpp](https://github.com/ggerganov/llama.cpp) in projects which live outside of the source tree.4 5## Building6 7Because this example is "outside of the source tree", it is important to first build/install llama.cpp using CMake. An example is provided here, but please see the [llama.cpp build instructions](../..) for more detailed build instructions.8 9### Considerations10 11When hardware acceleration libraries are used (e.g. CUDA, Metal, Vulkan, etc.), the appropriate dependencies will be searched for automatically. So, for example, when finding a package12 13### Build llama.cpp and install to llama.cpp/inst14 15```sh16git clone https://github.com/ggerganov/llama.cpp17cd llama.cpp18cmake -S . -B build19cmake --build build20cmake --install build --prefix inst21 22### Build simple-cmake-pkg23 24```sh25cd examples/simple-cmake-pkg26cmake -S . -B build -DCMAKE_PREFIX_PATH=../../inst/lib/cmake27cmake --build build28```29 30### Run simple-cmake-pkg31 32```sh33./build/llama-simple-cmake-pkg -m ./models/llama-7b-v2/ggml-model-f16.gguf "Hello my name is"34```35 