[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
Wed Jun 5 04:28:56 PDT 2019
sgraenitz updated this revision to Diff 203121.
sgraenitz added a comment.
Polishing
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)
+ foreach(config_type ${CMAKE_CONFIGURATION_TYPES})
+ # In paths to our 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}")
+
+ # Remaining ones must be paths to the provided LLVM build-tree.
+ if(${config_type} IN_LIST LLVM_CONFIGURATION_TYPES)
+ # Multi-configuration generator like Xcode (with a matching config).
+ 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,6 +1,7 @@
# Test runner infrastructure for LLDB. This configures the LLDB test trees
# for use by Lit, and delegates to LLVM's lit test handlers.
+# LLVM_BUILD_MODE is used in lit.site.cfg
if (CMAKE_CFG_INTDIR STREQUAL ".")
set(LLVM_BUILD_MODE ".")
else ()
@@ -12,10 +13,35 @@
endif()
get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
+set(dotest_args_replacement ${LLVM_BUILD_MODE})
+if(LLDB_BUILT_STANDALONE)
+ # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our configuration name placeholder.
+ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+ string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+
+ # Remaining ones must be paths to the provided LLVM build-tree.
+ if(LLVM_CONFIGURATION_TYPES)
+ # LLDB uses single-config; LLVM multi-config; pick one and prefer Release types.
+ # Otherwise, if both use multi-config the default is fine.
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+ if(RelWithDebInfo IN_LIST LLVM_CONFIGURATION_TYPES)
+ set(dotest_args_replacement RelWithDebInfo)
+ elseif(Release IN_LIST LLVM_CONFIGURATION_TYPES)
+ set(dotest_args_replacement Release)
+ else()
+ list(GET LLVM_CONFIGURATION_TYPES 0 dotest_args_replacement)
+ endif()
+ endif()
+ else()
+ # Common case: LLVM used a single-configuration generator like Ninja.
+ set(dotest_args_replacement ".")
+ endif()
+endif()
+
+string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
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}")
list(APPEND LLDB_TEST_DEPS
LLDBUnitTests
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62859.203121.patch
Type: text/x-patch
Size: 3894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190605/53a77389/attachment.bin>
More information about the lldb-commits
mailing list