Fix main-cmake-pkg compilation

This commit is contained in:
andrijdavid 2023-12-28 14:15:22 +01:00 committed by GitHub
parent f6793491b5
commit 35157e4c0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,9 @@ find_package(Llama 0.0.1 REQUIRED)
# using the relocatable Llama package should be outside of the # using the relocatable Llama package should be outside of the
# source tree, main-cmake-pkg pretends the dependencies are built-in. # source tree, main-cmake-pkg pretends the dependencies are built-in.
# WARNING: because build-info.cpp is auto-generated, it will only
# be available after the user has built the llama.cpp sources.
set(_common_path "${CMAKE_CURRENT_LIST_DIR}/../../common") set(_common_path "${CMAKE_CURRENT_LIST_DIR}/../../common")
add_library(common OBJECT add_library(common OBJECT
${_common_path}/common.h ${_common_path}/common.h
@ -18,18 +21,9 @@ add_library(common OBJECT
${_common_path}/grammar-parser.cpp ${_common_path}/grammar-parser.cpp
${_common_path}/sampling.h ${_common_path}/sampling.h
${_common_path}/sampling.cpp ${_common_path}/sampling.cpp
${_common_path}/build-info.cpp
) )
# WARNING: because build-info.h is auto-generated, it will only
# be available after the user has built the llama.cpp sources.
#
configure_file(${_common_path}/../build-info.h
${CMAKE_CURRENT_BINARY_DIR}/build-info.h
COPYONLY)
target_include_directories(common PUBLIC ${LLAMA_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
# If the common project was part of "main-cmake-pkg" the transient # If the common project was part of "main-cmake-pkg" the transient
# defines would automatically be attached. Because the common func- # defines would automatically be attached. Because the common func-
# tionality is separate, but dependent upon the defines, it must be # tionality is separate, but dependent upon the defines, it must be