Commit f3a184b15 for llama.cpp
commit f3a184b1534e6f4162fe88a030e9bc8dce24af33
Author: Daniel Bevenius <daniel.bevenius@gmail.com>
Date: Mon Sep 14 16:07:28 2026 +0200
cmake : remove precompiled headers (#28892)
This commit removes the precompiled headers that I added in Commit
3bcfeb700 ("cmake : add PCH and unity build to improve build times
(#28091)").
The motivation for this is that this looked good when developing this
but has caused multiple issues that I had taken into consideration and
we have decided to remove it and only keep the unity builds from the
above commit.
Refs: https://github.com/ggml-org/llama.cpp/pull/28882#issuecomment-5662272126
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 38dab96ab..2b307c59d 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -136,8 +136,6 @@ set_target_properties(${TARGET} PROPERTIES
target_include_directories(${TARGET} PUBLIC .)
target_link_libraries (${TARGET} PUBLIC vendor::nlohmann vendor::sheredom)
target_compile_features (${TARGET} PUBLIC cxx_std_17)
-target_precompile_headers (${TARGET} PRIVATE common.h)
-target_precompile_headers (${TARGET} PRIVATE chat.h)
if (LLAMA_SUBPROCESS)
target_compile_definitions(${TARGET} PUBLIC LLAMA_SUBPROCESS)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bc922b6a7..afdaddc79 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -67,7 +67,6 @@ configure_file(llama-version.h.in ${CMAKE_CURRENT_BINARY_DIR}/llama-version.h @O
target_include_directories(llama PRIVATE . ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(llama PUBLIC ../include)
target_compile_features (llama PRIVATE cxx_std_17) # don't bump
-target_precompile_headers (llama PRIVATE models/models.h)
target_link_libraries(llama PUBLIC ggml)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2c05c0c93..cca90ef30 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -275,8 +275,6 @@ llama_build_and_test(
peg-parser/test-unicode.cpp
peg-parser/tests.h
)
-target_precompile_headers(test-peg-parser PRIVATE peg-parser/tests.h)
-
if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "s390x")
set(MODEL_NAME "tinyllamas/stories15M-q4_0.gguf")
diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt
index 176eb1505..907468e87 100644
--- a/tools/mtmd/CMakeLists.txt
+++ b/tools/mtmd/CMakeLists.txt
@@ -84,13 +84,6 @@ target_link_libraries (mtmd PUBLIC ggml llama)
target_link_libraries (mtmd PRIVATE Threads::Threads vendor::hash vendor::miniaudio vendor::stb vendor::sheredom)
target_include_directories(mtmd PUBLIC .)
target_compile_features (mtmd PRIVATE cxx_std_17)
-target_precompile_headers (mtmd PRIVATE models/models.h)
-
-set_source_files_properties(
- mtmd-helper.cpp
- mtmd-helper-gen.cpp
- PROPERTIES SKIP_PRECOMPILE_HEADERS ON
-)
if (MTMD_VIDEO)
target_compile_definitions(mtmd PRIVATE MTMD_VIDEO)
diff --git a/tools/server/CMakeLists.txt b/tools/server/CMakeLists.txt
index 02607c838..43c245633 100644
--- a/tools/server/CMakeLists.txt
+++ b/tools/server/CMakeLists.txt
@@ -1,13 +1,5 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-# MSVC emits a PCH bookkeeping symbol that WINDOWS_EXPORT_ALL_SYMBOLS exports as an ambiguous "__"
-
-set(LLAMA_SERVER_PCH ON)
-
-if (BUILD_SHARED_LIBS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- set(LLAMA_SERVER_PCH OFF)
-endif()
-
# server-context containing the core server logic, used by llama-server and CLI
set(TARGET server-context)
@@ -41,10 +33,6 @@ target_include_directories(${TARGET} PRIVATE ../mtmd)
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(${TARGET} PUBLIC llama-common mtmd ${CMAKE_THREAD_LIBS_INIT})
-if (LLAMA_SERVER_PCH)
- target_precompile_headers(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/common/common.h)
-endif()
-
# llama-server-impl: server logic, reusable by app
set(TARGET llama-server-impl)
@@ -62,10 +50,6 @@ target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${TARGET} PRIVATE ../mtmd ${CMAKE_SOURCE_DIR})
target_link_libraries(${TARGET} PUBLIC server-context llama-ui cpp-httplib ${CMAKE_THREAD_LIBS_INIT})
-if (LLAMA_SERVER_PCH)
- target_precompile_headers(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/common/common.h)
-endif()
-
add_dependencies(${TARGET} llama-ui-assets)
if(LLAMA_TOOLS_INSTALL)