[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 07:51:45 PDT 2019
sgraenitz created this revision.
sgraenitz added reviewers: JDevlieghere, jingham, xiaobai, stella.stamenova.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.
Allow to run the test suite when building LLDB Standalone with Xcode against a provided LLVM build-tree that used a single-configuration generator like Ninja.
So far both test drivers, lit-based `check-lldb` as well as `lldb-dotest`, were looking for test dependencies (clang/dsymutil/etc.) in a subdirectory with the configuration name (Debug/Release/etc.). It was implicitly assuming that the provided LLVM build-tree was also built with a multi-configuration generator (Xcode/VisualStudio). In practice, however, the opposite is more common: build the dependencies with Ninja and LLDB with Xcode for development. With this patch it becomes the default.
I think this will also work with Visual Studio, but kept the Xcode restriction because I didn't test it. I am happy to relax the condition, once someone can confirm it works.
If necessary I can add an option to enable this feature, like `LLDB_PROVIDED_NINJA_BUILD_TREE=On`. What do you think?
Otherwise, is there any other use-case I missed or you want to be considered?
Once this is sound, I'm planning the following steps:
- add stage to the lldb-cmake-standalone bot <http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/> to build and test it
- update the `Building LLDB with Xcode` section in the docs
- bring the same mechanism to swift-lldb
- fade out the manually maintained Xcode project
On macOS build and test like this:
$ git clone https://github.com/llvm/llvm-project.git /path/to/llvm-project
$ cd /path/to/lldb-dev-deps
$ cmake -GNinja -C/path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" /path/to/llvm-project/llvm
$ ninja
$ cd /path/to/lldb-dev-xcode
$ cmake -GXcode -C/path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake -DLLVM_DIR=/path/to/lldb-dev-deps/lib/cmake/llvm -DClang_DIR=/path/to/lldb-dev-deps/lib/cmake/clang /path/to/llvm-project/lldb
$ xcodebuild -configuration Debug -target check-lldb
$ xcodebuild -configuration Debug -target lldb-dotest
$ ./Debug/bin/lldb-dotest
Repository:
rG LLVM Github Monorepo
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,23 @@
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 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}")
+
+ 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.202941.patch
Type: text/x-patch
Size: 3576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190604/42b6c0d8/attachment-0001.bin>
More information about the lldb-commits
mailing list