Skip to content

Commit 43a5ee4

Browse files
GermanAizekggerganov
authored andcommitted
cmake : add support for ccache (ggml-org#5002)
* Added support ccache for speedup recompilation * cmake : option to disable ccache --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent f26755c commit 43a5ee4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ option(BUILD_SHARED_LIBS "build shared libraries"
4747
option(LLAMA_STATIC "llama: static link libraries" OFF)
4848
option(LLAMA_NATIVE "llama: enable -march=native flag" ON)
4949
option(LLAMA_LTO "llama: enable link time optimization" OFF)
50+
option(LLAMA_CCACHE "llama: use ccache if available" ON)
5051

5152
# debug
5253
option(LLAMA_ALL_WARNINGS "llama: enable all compiler warnings" ON)
@@ -561,6 +562,17 @@ if (LLAMA_LTO)
561562
endif()
562563
endif()
563564

565+
if (LLAMA_CCACHE)
566+
find_program(LLAMA_CCACHE_FOUND ccache)
567+
if (LLAMA_CCACHE_FOUND)
568+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
569+
set(ENV{CCACHE_SLOPPINESS} time_macros)
570+
message(STATUS "Using ccache")
571+
else()
572+
message(STATUS "Warning: ccache not found - consider installing it or use LLAMA_CCACHE=OFF")
573+
endif ()
574+
endif()
575+
564576
# this version of Apple ld64 is buggy
565577
execute_process(
566578
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_EXE_LINKER_FLAGS} -Wl,-v

0 commit comments

Comments
 (0)