-
Notifications
You must be signed in to change notification settings - Fork 35
/
CMakeLists.txt
51 lines (40 loc) · 1.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
cmake_minimum_required(VERSION 3.12)
project(ChatLLM.cpp VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE STRING "")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE STRING "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE STRING "")
set(CMAKE_CXX_STANDARD 20)
if (MSVC)
add_compile_options("/utf-8")
add_compile_options("/D_CRT_SECURE_NO_WARNINGS")
add_compile_options("/wd4996")
add_compile_options("/wd4722")
endif ()
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall")
endif ()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
# third-party libraries
include_directories(ggml/include/ggml ggml/src)
add_subdirectory(ggml)
#if (GGML_CUBLAS)
# add_compile_definitions(GGML_USE_CUBLAS)
#endif ()
if (GGML_CLBLAST)
add_compile_definitions(GGML_USE_CLBLAST)
endif ()
if (GGML_PERF)
add_compile_definitions(GGML_PERF)
endif ()
add_library(libchatllm SHARED EXCLUDE_FROM_ALL src/main.cpp src/backend.cpp src/chat.cpp src/vectorstore.cpp src/layers.cpp src/tokenizer.cpp src/models.cpp src/unicode.cpp src/unicode-data.cpp)
target_link_libraries(libchatllm PRIVATE ggml)
target_compile_definitions(libchatllm PUBLIC CHATLLM_SHARED_LIB)
SET_TARGET_PROPERTIES(libchatllm PROPERTIES PREFIX "")
set_target_properties(libchatllm
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "../bindings"
)
add_executable(main src/main.cpp src/chat.cpp src/backend.cpp src/vectorstore.cpp src/layers.cpp src/tokenizer.cpp src/models.cpp src/unicode.cpp src/unicode-data.cpp)
target_link_libraries(main PRIVATE ggml)