Findllamacpp.cmake 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. # Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
  4. # our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
  5. # from 3rd parties that we should not alter. Therefore, in addition to
  6. # changing the `cmake_minimum_required()`, we should also add a configuration
  7. # here that is compatible with earlier versions.
  8. set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
  9. include(FetchContent)
  10. set(LLAMA_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/llama.cpp")
  11. if(EXISTS ${LLAMA_SOURCE_DIR})
  12. message("Use existed source code under ${LLAMA_SOURCE_DIR}")
  13. FetchContent_Declare(
  14. llamacpp
  15. SOURCE_DIR ${LLAMA_SOURCE_DIR}
  16. )
  17. else()
  18. message("download source code and store it at ${LLAMA_SOURCE_DIR}")
  19. FetchContent_Declare(
  20. llamacpp
  21. GIT_REPOSITORY https://github.com/ggerganov/llama.cpp.git
  22. GIT_TAG b3573
  23. SOURCE_DIR ${LLAMA_SOURCE_DIR}
  24. )
  25. endif()
  26. set(LLAMA_BUILD_TESTS OFF)
  27. set(LLAMA_BUILD_EXAMPLES OFF)
  28. set(LLAMA_BUILD_SERVER OFF)
  29. FetchContent_MakeAvailable(llamacpp)