[Lldb-commits] [PATCH] D62859: [CMake] Add special case for processing LLDB_DOTEST_ARGS

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 4 13:54:54 PDT 2019


sgraenitz updated this revision to Diff 203016.
sgraenitz added a comment.

Chose the replacement for remaining matches of CMAKE_CFG_INTDIR depdending on LLVM_CONFIGURATION_TYPES


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62859/new/

https://reviews.llvm.org/D62859

Files:
  lldb/lit/CMakeLists.txt
  lldb/utils/lldb-dotest/CMakeLists.txt


Index: lldb/utils/lldb-dotest/CMakeLists.txt
===================================================================
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -5,8 +5,28 @@
 
 get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
 
-# Generate wrapper for each build mode.
-if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+# Generate lldb-dotest Python driver script for each build mode.
+if(LLDB_BUILT_STANDALONE AND ${CMAKE_GENERATOR} STREQUAL "Xcode")
+  foreach(config_type ${CMAKE_CONFIGURATION_TYPES})
+    # For standalone build-tree: replace CMAKE_CFG_INTDIR with our actual configuration names
+    string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+    string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+
+    # Replace remaining ones matching the generator used for the provided LLVM build-tree.
+    if(config_type IN_LIST LLVM_CONFIGURATION_TYPES)
+      # Multi-configuration generator like Xcode with a matching configuration.
+      string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+    else()
+      # Single-configuration generator like Ninja.
+      string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+    endif()
+
+    configure_file(
+      lldb-dotest.in
+      ${config_runtime_output_dir}/lldb-dotest @ONLY
+    )
+  endforeach()
+elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
     string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
     string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
Index: lldb/lit/CMakeLists.txt
===================================================================
--- lldb/lit/CMakeLists.txt
+++ lldb/lit/CMakeLists.txt
@@ -1,21 +1,36 @@
 # Test runner infrastructure for LLDB. This configures the LLDB test trees
 # for use by Lit, and delegates to LLVM's lit test handlers.
 
-if (CMAKE_CFG_INTDIR STREQUAL ".")
-  set(LLVM_BUILD_MODE ".")
-else ()
+get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
+
+if(LLDB_BUILT_STANDALONE AND ${CMAKE_GENERATOR} STREQUAL "Xcode")
+  foreach(config_type ${CMAKE_CONFIGURATION_TYPES})
+    # For standalone build-tree: replace CMAKE_CFG_INTDIR with our actual configuration names
+    string(REPLACE ${CMAKE_CFG_INTDIR} "%(build_mode)s" config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+    string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+
+    # Replace the remaining CMAKE_CFG_INTDIR with ".", assuming the provided
+    # LLVM build-tree used a single-configuration generator like Ninja.
+    string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+  endforeach()
+
   set(LLVM_BUILD_MODE "%(build_mode)s")
-endif ()
+else()
+  if (CMAKE_CFG_INTDIR STREQUAL ".")
+    set(LLVM_BUILD_MODE ".")
+  else ()
+    set(LLVM_BUILD_MODE "%(build_mode)s")
+  endif ()
 
-if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-  set(LLDB_IS_64_BITS 1)
+  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
 endif()
 
-get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
-
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+
+if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+  set(LLDB_IS_64_BITS 1)
+endif()
 
 list(APPEND LLDB_TEST_DEPS
   LLDBUnitTests


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62859.203016.patch
Type: text/x-patch
Size: 3828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190604/b1ed5646/attachment.bin>


More information about the lldb-commits mailing list