[Lldb-commits] [PATCH] D150954: [lldb][cmake] Allow specifying custom libcxx for tests in standalone builds
Michael Buch via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 19 03:16:56 PDT 2023
Michael137 created this revision.
Michael137 added reviewers: aprantl, bulbazord, JDevlieghere.
Herald added a subscriber: ekilmer.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Standalone builds currently do not set the `LLDB_HAS_LIBCXX`,
`LIBCXX_LIBRARY_DIR`, `LIBCXX_GENERATED_INCLUDE_DIR`.
These are necessary for API tests with `USE_LIBCPP` to run against
a custom built libcxx. Thus on all buildbots using standalone builds
(most notably the public swift-ci), the API tests always run against
the libcxx headers in the system SDK.
This patch introduces a new cmake variable `LLDB_TEST_LIBCXX_ROOT_DIR`
that allows us to point the tests in standalone builds to a custom
libcxx directory.
Since the user can control the libcxx location we can hard error if
no such custom libcxx build exists.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D150954
Files:
lldb/test/CMakeLists.txt
Index: lldb/test/CMakeLists.txt
===================================================================
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -139,6 +139,9 @@
)
endif()
+set(LLDB_TEST_LIBCXX_ROOT_DIR "${LLVM_BINARY_DIR}" CACHE PATH
+ "The build root for libcxx. Used in standalone builds to point the API tests to a custom build of libcxx.")
+
# Add dependencies if we test with the in-tree clang.
# This works with standalone builds as they import the clang target.
if(TARGET clang)
@@ -169,9 +172,18 @@
# FIXME: Standalone builds should import the cxx target as well.
if(LLDB_BUILT_STANDALONE)
# For now check that the include directory exists.
- set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
- if(NOT EXISTS ${cxx_dir})
- message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
+ set(cxx_dir "${LLDB_TEST_LIBCXX_ROOT_DIR}/include/c++")
+ if(EXISTS ${cxx_dir})
+ # These variables make sure the API tests can run against a custom
+ # build of libcxx even for standalone builds.
+ set(LLDB_HAS_LIBCXX ON)
+ set(LIBCXX_LIBRARY_DIR "${LLDB_TEST_LIBCXX_ROOT_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}")
+ set(LIBCXX_GENERATED_INCLUDE_DIR "${LLDB_TEST_LIBCXX_ROOT_DIR}/include/c++/v1")
+ else()
+ message(FATAL_ERROR
+ "Couldn't find libcxx build in '${LLDB_TEST_LIBCXX_ROOT_DIR}'. To run the "
+ "test-suite for a standalone LLDB build please build libcxx and point "
+ "LLDB_TEST_LIBCXX_ROOT_DIR to it.")
endif()
else()
# We require libcxx for the test suite, so if we aren't building it,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150954.523714.patch
Type: text/x-patch
Size: 1715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230519/db40c297/attachment.bin>
More information about the lldb-commits
mailing list