[Lldb-commits] [lldb] ff8fc5b - [lldb][cmake] Add clang resource dir to LLDB shell tests config (#136761)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 30 10:10:09 PDT 2025
Author: Chelsea Cassanova
Date: 2025-04-30T10:10:05-07:00
New Revision: ff8fc5bc45c166d686e485b306fdcdadd5b02637
URL: https://github.com/llvm/llvm-project/commit/ff8fc5bc45c166d686e485b306fdcdadd5b02637
DIFF: https://github.com/llvm/llvm-project/commit/ff8fc5bc45c166d686e485b306fdcdadd5b02637.diff
LOG: [lldb][cmake] Add clang resource dir to LLDB shell tests config (#136761)
We want to be able to access the Clang resources directory in LLDB shell
tests, this commit adds the ability to do this by populating the
`CLANG_RESOURCE_DIR` variable in LLDBConfig.cmake.
Added:
Modified:
lldb/cmake/modules/LLDBConfig.cmake
lldb/test/Shell/lit.site.cfg.py.in
Removed:
################################################################################
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 9df71edd8b359..cfd626c9358a1 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -181,6 +181,17 @@ else ()
endif ()
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
+if(LLDB_BUILT_STANDALONE)
+ if (TARGET clang-resource-headers)
+ get_target_property(CLANG_RESOURCE_DIR clang-resource-headers INTERFACE_INCLUDE_DIRECTORIES)
+ set(CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}/..")
+ else()
+ set(CLANG_RESOURCE_DIR "${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}")
+ endif()
+else()
+ get_clang_resource_dir(CLANG_RESOURCE_DIR PREFIX "${CMAKE_BINARY_DIR}")
+endif()
+
# GCC silently accepts any -Wno-<foo> option, but warns about those options
# being unrecognized only if the compilation triggers other warnings to be
# printed. Therefore, check for whether the compiler supports options in the
diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in
index 31a6d68618b77..7e03938b12b23 100644
--- a/lldb/test/Shell/lit.site.cfg.py.in
+++ b/lldb/test/Shell/lit.site.cfg.py.in
@@ -35,6 +35,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
# The shell tests use their own module caches.
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell")
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell")
+config.clang_resource_dir = os.path.join("@CLANG_RESOURCE_DIR@")
import lit.llvm
lit.llvm.initialize(lit_config, config)
More information about the lldb-commits
mailing list