2023-04-25 23:16:45 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
|
|
|
if(APPLE)
|
2023-05-08 12:23:00 +00:00
|
|
|
option(BUILD_UNIVERSAL "Build a Universal binary on macOS" ON)
|
2023-04-25 23:16:45 +00:00
|
|
|
if(BUILD_UNIVERSAL)
|
|
|
|
# Build a Universal binary on macOS
|
|
|
|
# This requires that the found Qt library is compiled as Universal binaries.
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
|
|
|
else()
|
|
|
|
# Build for the host architecture on macOS
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE STRING "" FORCE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Include the binary directory for the generated header file
|
|
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
2023-05-10 15:46:40 +00:00
|
|
|
set(LLMODEL_VERSION_MAJOR 0)
|
|
|
|
set(LLMODEL_VERSION_MINOR 1)
|
|
|
|
set(LLMODEL_VERSION_PATCH 0)
|
|
|
|
set(LLMODEL_VERSION "${LLMODEL_VERSION_MAJOR}.${LLMODEL_VERSION_MINOR}.${LLMODEL_VERSION_PATCH}")
|
|
|
|
project(llmodel VERSION ${LLMODEL_VERSION} LANGUAGES CXX C)
|
2023-04-25 23:16:45 +00:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
|
|
set(LLAMA_BUILD_EXAMPLES ON CACHE BOOL "llama: build examples" FORCE)
|
|
|
|
set(BUILD_SHARED_LIBS ON FORCE)
|
|
|
|
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
|
|
if (GPT4ALL_AVX_ONLY)
|
|
|
|
set(LLAMA_AVX2 OFF CACHE BOOL "llama: enable AVX2" FORCE)
|
2023-05-08 12:23:00 +00:00
|
|
|
set(LLAMA_F16C OFF CACHE BOOL "llama: enable F16C" FORCE)
|
|
|
|
set(LLAMA_FMA OFF CACHE BOOL "llama: enable FMA" FORCE)
|
2023-04-25 23:16:45 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_subdirectory(llama.cpp)
|
|
|
|
|
|
|
|
add_library(llmodel
|
|
|
|
gptj.h gptj.cpp
|
|
|
|
llamamodel.h llamamodel.cpp
|
|
|
|
llama.cpp/examples/common.cpp
|
2023-04-27 02:05:56 +00:00
|
|
|
llmodel.h llmodel_c.h llmodel_c.cpp
|
2023-05-05 18:04:32 +00:00
|
|
|
mpt.h mpt.cpp
|
2023-04-25 23:16:45 +00:00
|
|
|
utils.h utils.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(llmodel
|
|
|
|
PRIVATE llama)
|
|
|
|
|
2023-05-10 15:46:40 +00:00
|
|
|
set_target_properties(llmodel PROPERTIES
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${PROJECT_VERSION_MAJOR})
|
|
|
|
|
2023-04-25 23:16:45 +00:00
|
|
|
set(COMPONENT_NAME_MAIN ${PROJECT_NAME})
|
|
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
|