|
1 | | -# common |
2 | | - |
3 | 1 | find_package(Threads REQUIRED) |
4 | 2 |
|
5 | 3 | llama_add_compile_flags() |
6 | 4 |
|
| 5 | +# |
| 6 | +# llama-common-base |
| 7 | +# |
| 8 | + |
7 | 9 | # Build info header |
8 | 10 |
|
9 | 11 | if(EXISTS "${PROJECT_SOURCE_DIR}/.git") |
@@ -33,17 +35,25 @@ endif() |
33 | 35 |
|
34 | 36 | set(TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/build-info.cpp.in") |
35 | 37 | set(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/build-info.cpp") |
| 38 | + |
36 | 39 | configure_file(${TEMPLATE_FILE} ${OUTPUT_FILE}) |
37 | 40 |
|
38 | | -set(TARGET build_info) |
39 | | -add_library(${TARGET} OBJECT ${OUTPUT_FILE}) |
| 41 | +set(TARGET llama-common-base) |
| 42 | +add_library(${TARGET} STATIC ${OUTPUT_FILE}) |
| 43 | + |
| 44 | +target_include_directories(${TARGET} PUBLIC .) |
| 45 | + |
40 | 46 | if (BUILD_SHARED_LIBS) |
41 | 47 | set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) |
42 | 48 | endif() |
43 | 49 |
|
44 | | -set(TARGET common) |
| 50 | +# |
| 51 | +# llama-common |
| 52 | +# |
45 | 53 |
|
46 | | -add_library(${TARGET} STATIC |
| 54 | +set(TARGET llama-common) |
| 55 | + |
| 56 | +add_library(${TARGET} |
47 | 57 | arg.cpp |
48 | 58 | arg.h |
49 | 59 | base64.hpp |
@@ -106,17 +116,24 @@ add_library(${TARGET} STATIC |
106 | 116 | jinja/caps.h |
107 | 117 | ) |
108 | 118 |
|
| 119 | +set_target_properties(${TARGET} PROPERTIES |
| 120 | + VERSION ${LLAMA_INSTALL_VERSION} |
| 121 | + SOVERSION 0 |
| 122 | + MACHO_CURRENT_VERSION 0 # keep macOS linker from seeing oversized version number |
| 123 | +) |
| 124 | + |
109 | 125 | target_include_directories(${TARGET} PUBLIC . ../vendor) |
110 | 126 | target_compile_features (${TARGET} PUBLIC cxx_std_17) |
111 | 127 |
|
112 | 128 | if (BUILD_SHARED_LIBS) |
113 | 129 | set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) |
| 130 | + |
| 131 | + # TODO: make fine-grained exports in the future |
| 132 | + set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) |
114 | 133 | endif() |
115 | 134 |
|
116 | | -target_link_libraries(${TARGET} PRIVATE |
117 | | - build_info |
118 | | - cpp-httplib |
119 | | -) |
| 135 | +target_link_libraries(${TARGET} PUBLIC llama-common-base) |
| 136 | +target_link_libraries(${TARGET} PRIVATE cpp-httplib) |
120 | 137 |
|
121 | 138 | if (LLAMA_LLGUIDANCE) |
122 | 139 | include(ExternalProject) |
|
0 commit comments