diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2022-10-26 12:07:22 -0700 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2022-10-26 12:07:22 -0700 |
commit | cb0eb9d8dd5a74ed33d5dd5c62686fb6342b10bc (patch) | |
tree | 8874fcaf4a05a2f6d246470a1a90040c8c6f1e91 /lldb/utils | |
parent | b56e65d31825fe4a1ae02fdcbad58bb7993d63a7 (diff) | |
download | llvm-cb0eb9d8dd5a74ed33d5dd5c62686fb6342b10bc.zip llvm-cb0eb9d8dd5a74ed33d5dd5c62686fb6342b10bc.tar.gz llvm-cb0eb9d8dd5a74ed33d5dd5c62686fb6342b10bc.tar.bz2 |
[test] Fix LLDB tests with just-built libcxx when using a target directory.
In certain configurations, libc++ headers all exist in the same directory, and libc++ binaries exist in the same directory as lldb libs. When `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is enabled (*and* the host is not Apple, which is why I assume this wasn't caught by others?), this is not the case: most headers will exist in the usual `include/c++/v1` directory, but `__config_site` exists in `include/$TRIPLE/c++/v1`. Likewise, the libc++.so binary exists in `lib/$TRIPLE/`, not `lib/` (where LLDB libraries reside).
This also adds the just-built-libcxx functionality to the lldb-dotest tool.
The `LIBCXX_` cmake config is borrowed from `libcxx/CMakeLists.txt`. I could not figure out a way to share the cmake config; ideally we would reuse the same config instead of copy/paste.
Reviewed By: JDevlieghere, fdeazeve
Differential Revision: https://reviews.llvm.org/D133973
Diffstat (limited to 'lldb/utils')
-rw-r--r-- | lldb/utils/lldb-dotest/CMakeLists.txt | 18 | ||||
-rwxr-xr-x | lldb/utils/lldb-dotest/lldb-dotest.in | 9 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lldb/utils/lldb-dotest/CMakeLists.txt b/lldb/utils/lldb-dotest/CMakeLists.txt index 9be57f6..09f41db 100644 --- a/lldb/utils/lldb-dotest/CMakeLists.txt +++ b/lldb/utils/lldb-dotest/CMakeLists.txt @@ -9,8 +9,21 @@ set(LLDB_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}") llvm_canonicalize_cmake_booleans( LLDB_BUILD_INTEL_PT + LLDB_HAS_LIBCXX ) +if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES) + set(LLDB_HAS_LIBCXX ON) + if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) + set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) + set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") + set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1") + else() + set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1") + endif() +endif() + set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}") set(vars LLDB_TEST_COMMON_ARGS @@ -23,8 +36,13 @@ set(vars LLDB_TEST_DSYMUTIL LLDB_LIBS_DIR LLVM_TOOLS_DIR + LIBCXX_LIBRARY_DIR + LIBCXX_GENERATED_INCLUDE_DIR + LIBCXX_GENERATED_INCLUDE_TARGET_DIR ) +llvm_canonicalize_cmake_booleans(LLDB_HAS_LIBCXX) + # Generate lldb-dotest Python driver script for each build mode. if(LLDB_BUILT_STANDALONE) set(config_types ".") diff --git a/lldb/utils/lldb-dotest/lldb-dotest.in b/lldb/utils/lldb-dotest/lldb-dotest.in index 896cc13..5cd49d2 100755 --- a/lldb/utils/lldb-dotest/lldb-dotest.in +++ b/lldb/utils/lldb-dotest/lldb-dotest.in @@ -13,6 +13,10 @@ lldb_build_intel_pt = "@LLDB_BUILD_INTEL_PT@" lldb_framework_dir = "@LLDB_FRAMEWORK_DIR_CONFIGURED@" lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@" llvm_tools_dir = "@LLVM_TOOLS_DIR_CONFIGURED@" +has_libcxx = @LLDB_HAS_LIBCXX@ +libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@" +libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@" +libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@" if __name__ == '__main__': wrapper_args = sys.argv[1:] @@ -31,6 +35,11 @@ if __name__ == '__main__': cmd.extend(['--dsymutil', dsymutil]) cmd.extend(['--lldb-libs-dir', lldb_libs_dir]) cmd.extend(['--llvm-tools-dir', llvm_tools_dir]) + if has_libcxx: + cmd.extend(['--libcxx-include-dir', libcxx_include_dir]) + if libcxx_include_target_dir: + cmd.extend(['--libcxx-include-target-dir', libcxx_include_target_dir]) + cmd.extend(['--libcxx-library-dir', libcxx_libs_dir]) if lldb_framework_dir: cmd.extend(['--framework', lldb_framework_dir]) if lldb_build_intel_pt == "1": |