diff options
author | Herman Semenov <GermanAizek@yandex.ru> | 2024-01-20 08:11:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-20 10:11:31 +0200 |
commit | 77bc1bbd05f0c31cb45773eb5eb59b9ff2b07e1b (patch) | |
tree | 435dd470dd8c4966ce6cbd50024425758b816ff6 | |
parent | 48e2b1337257bb77573bf76cfffcff3a5efa8704 (diff) |
cmake : add support for ccache (#5002)
* Added support ccache for speedup recompilation
* cmake : option to disable ccache
---------
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fc65eaf..6b3b1396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ option(BUILD_SHARED_LIBS "build shared libraries" option(LLAMA_STATIC "llama: static link libraries" OFF) option(LLAMA_NATIVE "llama: enable -march=native flag" ON) option(LLAMA_LTO "llama: enable link time optimization" OFF) +option(LLAMA_CCACHE "llama: use ccache if available" ON) # debug option(LLAMA_ALL_WARNINGS "llama: enable all compiler warnings" ON) @@ -561,6 +562,17 @@ if (LLAMA_LTO) endif() endif() +if (LLAMA_CCACHE) + find_program(LLAMA_CCACHE_FOUND ccache) + if (LLAMA_CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set(ENV{CCACHE_SLOPPINESS} time_macros) + message(STATUS "Using ccache") + else() + message(STATUS "Warning: ccache not found - consider installing it or use LLAMA_CCACHE=OFF") + endif () +endif() + # this version of Apple ld64 is buggy execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_EXE_LINKER_FLAGS} -Wl,-v |