Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: add relocatable Llama package #2960

Merged
merged 11 commits into from
Sep 14, 2023

Conversation

bandoti
Copy link
Collaborator

@bandoti bandoti commented Sep 1, 2023

This change adds support for a relocatable CMake package. This includes several enhancements:

  1. When building/installing llama.cpp with CMake, a cmake package is generated and added to lib/cmake/Llama. This generates the required LlamaConfig.cmake and LlamaConfigVersion.cmake files.
  2. An example application, examples/main-cmake-pkg, for testing/demonstrating these capabilities. This application builds main but using the installed Llama CMake package.

This will enable application developers using CMake a much improved way to add llama as a link target.

@staviq
Copy link
Contributor

staviq commented Sep 1, 2023

Take a look at #2886, it's possibly related.

@bandoti
Copy link
Collaborator Author

bandoti commented Sep 1, 2023

Take a look at #2886, it's possibly related.

These do not (to me at least) seem to be related. The change I have made builds a Llama CMake package, whereas #2886 allows make (not CMake) to override flags.

@bandoti
Copy link
Collaborator Author

bandoti commented Sep 11, 2023

Anyone can merge this please? Thank you!

@ggerganov ggerganov merged commit 990a5e2 into ggerganov:master Sep 14, 2023
@bandoti bandoti deleted the cmake-find-package branch September 15, 2023 01:00
pkrmf pushed a commit to morlockstudios-com/llama.cpp that referenced this pull request Sep 26, 2023
* Keep static libs and headers with install

* Add logic to generate Config package

* Use proper build info

* Add llama as import library

* Prefix target with package name

* Add example project using CMake package

* Update README

* Update README

* Remove trailing whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants