[PATCH] D77110: [CMAKE] Provide default location for llvm-lit for out-of-tree users.
Stephen Neuendorffer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 18:03:08 PDT 2020
stephenneuendorffer created this revision.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
Several external build users contain some heuristics for finding llvm-lit.
There are several cases we need to worry about:
- External builds against a build tree (with LLVM_BUILD_UTILS)
- External builds against an install tree (with LLMV_BUILD_UTIL and LLVM_INSTALL_UTILS)
- External builds against some location which doesn't have an llvm-lit, but llvm-lit is available through some other means, such as an available source tree, or a packager provided llvm-lit.
For the third case, LLVM_EXTERNAL_LIT suffices, but in other cases
there's no standard way to find llvm-lit. It seems like each user
cooks their own heuristics:
- clang tries to look in the LLVM source tree, and failing that falls back to looking for a packaged llvm-lit.
- libcxx tries to look in the LLVM source tree, which might come from llvm-config or be explicitly specified.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77110
Files:
llvm/cmake/modules/CMakeLists.txt
llvm/cmake/modules/LLVMConfig.cmake.in
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===================================================================
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -93,6 +93,7 @@
set(LLVM_BINARY_DIR "@LLVM_CONFIG_BINARY_DIR@")
set(LLVM_TOOLS_BINARY_DIR "@LLVM_CONFIG_TOOLS_BINARY_DIR@")
set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
+set(LLVM_DEFAULT_EXTERNAL_LIT "@LLVM_CONFIG_DEFAULT_EXTERNAL_LIT@")
set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@)
Index: llvm/cmake/modules/CMakeLists.txt
===================================================================
--- llvm/cmake/modules/CMakeLists.txt
+++ llvm/cmake/modules/CMakeLists.txt
@@ -54,6 +54,11 @@
set(LLVM_CONFIG_BINARY_DIR "${LLVM_BINARY_DIR}")
set(LLVM_CONFIG_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
+# Generate a default location for lit
+if (LLVM_BUILD_UTILS)
+ set(LLVM_CONFIG_DEFAULT_EXTERNAL_LIT "${LLVM_CONFIG_TOOLS_BINARY_DIR}/llvm-lit")
+endif()
+
if (LLVM_LINK_LLVM_DYLIB)
set(LLVM_CONFIG_LINK_LLVM_DYLIB
"set(LLVM_LINK_LLVM_DYLIB ${LLVM_LINK_LLVM_DYLIB})")
@@ -103,6 +108,12 @@
set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
+
+# Generate a default location for lit
+if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
+ set(LLVM_CONFIG_DEFAULT_EXTERNAL_LIT "${LLVM_CONFIG_TOOLS_BINARY_DIR}/llvm-lit")
+endif()
+
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
configure_file(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77110.253752.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200331/1c03acf4/attachment-0001.bin>
More information about the llvm-commits
mailing list