@@ -47,52 +47,6 @@ if (BUILD_SHARED_LIBS)
4747 set_target_properties (${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON )
4848endif ()
4949
50- #
51- # inline chat templates
52- #
53- # Built-in Jinja chat templates for model architectures whose GGUF files ship
54- # without an embedded chat_template. The header is generated from the manifest
55- # common/chat-inline-templates.h.in into the build directory and included by
56- # common/chat.cpp (a quoted include resolves to the generated copy because no
57- # chat-inline-templates.h exists next to chat.cpp).
58-
59- set (CHAT_INLINE_TEMPLATES_MANIFEST ${CMAKE_CURRENT_SOURCE_DIR } /chat-inline-templates.h.in)
60- set (CHAT_INLINE_TEMPLATES_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR } /generated)
61- set (CHAT_INLINE_TEMPLATES_HEADER ${CHAT_INLINE_TEMPLATES_GEN_DIR} /chat-inline-templates.h)
62- set (CHAT_INLINE_TEMPLATES_SCRIPT ${PROJECT_SOURCE_DIR } /scripts/gen-chat-inline-templates.py)
63-
64- # every template the manifest may reference, so the header regenerates on edits
65- file (GLOB CHAT_INLINE_TEMPLATE_FILES ${PROJECT_SOURCE_DIR } /models/templates/*.jinja )
66-
67- find_package (Python3 COMPONENTS Interpreter QUIET )
68-
69- if (Python3_FOUND)
70- add_custom_command (
71- OUTPUT ${CHAT_INLINE_TEMPLATES_HEADER}
72- COMMAND ${CMAKE_COMMAND } -E make_directory ${CHAT_INLINE_TEMPLATES_GEN_DIR}
73- COMMAND ${Python3_EXECUTABLE} ${CHAT_INLINE_TEMPLATES_SCRIPT}
74- --manifest ${CHAT_INLINE_TEMPLATES_MANIFEST}
75- --repo-root ${PROJECT_SOURCE_DIR }
76- --output ${CHAT_INLINE_TEMPLATES_HEADER}
77- DEPENDS ${CHAT_INLINE_TEMPLATES_MANIFEST}
78- ${CHAT_INLINE_TEMPLATES_SCRIPT}
79- ${CHAT_INLINE_TEMPLATE_FILES}
80- COMMENT "Generating chat-inline-templates.h"
81- VERBATIM
82- )
83- else ()
84- message (WARNING "Python3 not found: inline chat templates disabled (generating empty chat-inline-templates.h)" )
85- file (MAKE_DIRECTORY ${CHAT_INLINE_TEMPLATES_GEN_DIR} )
86- file (WRITE ${CHAT_INLINE_TEMPLATES_HEADER}
87- "// AUTO-GENERATED fallback (Python3 not found) - no inline templates available.
88- #pragma once
89- #include <cstddef>
90- struct common_chat_inline_template_entry { const char * arch; const char * tmpl; };
91- static const common_chat_inline_template_entry COMMON_CHAT_INLINE_TEMPLATES[] = { { nullptr, nullptr } };
92- static const size_t COMMON_CHAT_INLINE_TEMPLATES_COUNT = 0;
93- " )
94- endif ()
95-
9650#
9751# llama-common
9852#
@@ -174,7 +128,6 @@ set_target_properties(${TARGET} PROPERTIES
174128)
175129
176130target_include_directories (${TARGET} PUBLIC . ../vendor )
177- target_include_directories (${TARGET} PRIVATE ${CHAT_INLINE_TEMPLATES_GEN_DIR} )
178131target_compile_features (${TARGET} PUBLIC cxx_std_17 )
179132
180133if (BUILD_SHARED_LIBS )
0 commit comments