[PATCH] D121215: [cmake] Add LLVM_THINLTO_CACHE_PATH
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 07:20:01 PST 2022
thieta created this revision.
thieta added a reviewer: phosek.
Herald added subscribers: inglorion, mgorny.
Herald added a project: All.
thieta requested review of this revision.
Herald added a project: LLVM.
This allows you to set a custom path to the ThinLTO cache so that
it can be shared when building in several different build directories.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121215
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1082,6 +1082,8 @@
message(FATAL_ERROR "LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE cannot both be specified")
endif()
+set(LLVM_THINLTO_CACHE_PATH "${PROJECT_BINARY_DIR}/lto.cache" CACHE STRING "Set ThinLTO cache path. This can be used when building LLVM from several different directiories.")
+
if(LLVM_ENABLE_LTO AND LLVM_ON_WIN32 AND NOT LINKER_IS_LLD_LINK AND NOT MINGW)
message(FATAL_ERROR "When compiling for Windows, LLVM_ENABLE_LTO requires using lld as the linker (point CMAKE_LINKER at lld-link.exe)")
endif()
@@ -1095,16 +1097,16 @@
# improves incremental build time.
# FIXME: We should move all this logic into the clang driver.
if(APPLE)
- append("-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
+ append("-Wl,-cache_path_lto,${LLVM_THINLTO_CACHE_PATH}"
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
elseif((UNIX OR MINGW) AND LLVM_USE_LINKER STREQUAL "lld")
- append("-Wl,--thinlto-cache-dir=${PROJECT_BINARY_DIR}/lto.cache"
+ append("-Wl,--thinlto-cache-dir=${LLVM_THINLTO_CACHE_PATH}"
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
elseif(LLVM_USE_LINKER STREQUAL "gold")
- append("-Wl,--plugin-opt,cache-dir=${PROJECT_BINARY_DIR}/lto.cache"
+ append("-Wl,--plugin-opt,cache-dir=${LLVM_THINLTO_CACHE_PATH}"
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
elseif(LINKER_IS_LLD_LINK)
- append("/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"
+ append("/lldltocache:${LLVM_THINLTO_CACHE_PATH}"
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
endif()
elseif(uppercase_LLVM_ENABLE_LTO STREQUAL "FULL")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121215.413798.patch
Type: text/x-patch
Size: 1865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220308/56b7bfbd/attachment.bin>
More information about the llvm-commits
mailing list