[PATCH] D38057: Try again to fix libcxx CMake so that it doesn't break when no LLVM source tree is available

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 15:27:57 PDT 2017


zturner created this revision.
Herald added a subscriber: mgorny.

This removes the configure step from libcxx CMake so it doesn't generate the output script.

I can probably get this added back later, but for now I'm just trying to get things green.

Note that libcxx CMake //already// depends on LLVM sources for running the test suite via a check target.  It has been this way for some time and I didn't introduce this.  These bots that broke, however, do not do that.  They instead download `lit` and run it manually.

With this patch, that workflow should be supported again.  Runing `bin/llvm-lit -sv <libcxx-source-tree>` isn't, but but the old workflow of using `lit.py -sv <libcxx-source-tree>` should still work.

If one of you at Apple + Eric could please try this I would appreciate.


https://reviews.llvm.org/D38057

Files:
  libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1198,7 +1198,12 @@
   cmake_parse_arguments(ARG "ALLOW_EXTERNAL" "" "" ${ARGN})
 
   if (ARG_ALLOW_EXTERNAL)
+    set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_EXTERNAL_LIT}")
     set (LLVM_EXTERNAL_LIT "" CACHE STRING "Command used to spawn lit")
+    if ("${LLVM_EXTERNAL_LIT}" STREQUAL "")
+      set(LLVM_EXTERNAL_LIT "${LLVM_DEFAULT_EXTERNAL_LIT}")
+    endif()
+
     if (NOT "${LLVM_EXTERNAL_LIT}" STREQUAL "")
       if (EXISTS ${LLVM_EXTERNAL_LIT})
         get_filename_component(LIT_FILE_NAME ${LLVM_EXTERNAL_LIT} NAME)
@@ -1230,9 +1235,7 @@
   elseif(NOT "${LLVM_RUNTIME_OUTPUT_INTDIR}" STREQUAL "")
     set(LLVM_LIT_BASE_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
   else()
-    message(WARNING "Could not find suitable output location for llvm-lit."
-                    "Using default ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit")
-    set(LLVM_LIT_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
+    set(LLVM_LIT_BASE_DIR "")
   endif()
 
   # Cache this so we don't have to do it again and have subsequent calls
Index: libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
===================================================================
--- libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -111,14 +111,17 @@
   # the configurator should write the script into.
   set(LLVM_LIT_OUTPUT_DIR "${libcxx_BINARY_DIR}/bin")
 
-  # Required LIT Configuration ------------------------------------------------
-  # Define the default arguments to use with 'lit', and an option for the user
-  # to override.
-  set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
-  if (MSVC OR XCODE)
-    set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
+  if (LLVM_INCLUDE_TESTS)
+    # Required LIT Configuration ------------------------------------------------
+    # Define the default arguments to use with 'lit', and an option for the user
+    # to override.
+    set(LLVM_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py")
+    set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
+    if (MSVC OR XCODE)
+      set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
+    endif()
+    set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
   endif()
-  set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
 
   # Required doc configuration
   if (LLVM_ENABLE_SPHINX)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38057.115909.patch
Type: text/x-patch
Size: 2571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/b5533334/attachment.bin>


More information about the llvm-commits mailing list