@@ -17,6 +17,94 @@ endif ()
17
17
string (REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR} )
18
18
string (REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR} )
19
19
20
+ # Create a custom target to track test dependencies.
21
+ add_custom_target (lldb-test-deps )
22
+ set_target_properties (lldb-test-deps PROPERTIES FOLDER "lldb misc" )
23
+
24
+ function (add_lldb_test_dependency )
25
+ foreach (dependency ${ARGN} )
26
+ add_dependencies (lldb-test-deps ${dependency} )
27
+ endforeach ()
28
+ endfunction (add_lldb_test_dependency )
29
+
30
+ # lldb itself and lldb-test is an hard dependency for the testsuites.
31
+ add_lldb_test_dependency (lldb )
32
+ add_lldb_test_dependency (lldb-test )
33
+
34
+ # On Darwin, darwin-debug is an hard dependency for the testsuites.
35
+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
36
+ add_lldb_test_dependency (darwin-debug )
37
+ endif ()
38
+
39
+ if (TARGET lldb-server )
40
+ add_lldb_test_dependency (lldb-server )
41
+ endif ()
42
+
43
+ if (TARGET lldb-vscode )
44
+ add_lldb_test_dependency (lldb-vscode )
45
+ endif ()
46
+
47
+ if (TARGET lldb-instr )
48
+ add_lldb_test_dependency (lldb-instr )
49
+ endif ()
50
+
51
+ if (TARGET liblldb )
52
+ add_lldb_test_dependency (liblldb )
53
+ endif ()
54
+
55
+ if (TARGET lldb-framework )
56
+ add_lldb_test_dependency (lldb-framework )
57
+ endif ()
58
+
59
+ # Add dependencies that are not exported targets when building standalone.
60
+ if (NOT LLDB_BUILT_STANDALONE )
61
+ add_lldb_test_dependency (
62
+ FileCheck
63
+ count
64
+ dsymutil
65
+ llvm-strip
66
+ not
67
+ yaml2obj
68
+ )
69
+ endif ()
70
+
71
+ # Add dependencies if we test with the in-tree clang.
72
+ # This works with standalone builds as they import the clang target.
73
+ if (TARGET clang )
74
+ add_lldb_test_dependency (clang )
75
+ if (APPLE )
76
+ # If we build clang, we should build libcxx.
77
+ # FIXME: Standalone builds should import the cxx target as well.
78
+ if (LLDB_BUILT_STANDALONE )
79
+ # For now check that the include directory exists.
80
+ set (cxx_dir "${LLVM_BINARY_DIR} /include/c++" )
81
+ if (NOT EXISTS ${cxx_dir} )
82
+ message (WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir} " )
83
+ endif ()
84
+ else ()
85
+ # We require libcxx for the test suite, so if we aren't building it,
86
+ # try to provide a helpful error about how to resolve the situation.
87
+ if (NOT TARGET cxx )
88
+ if (LLVM_ENABLE_PROJECTS STREQUAL "" )
89
+ # If `LLVM_ENABLE_PROJECTS` is not being used (implying that we are
90
+ # using the old layout), suggest checking it out.
91
+ message (FATAL_ERROR
92
+ "LLDB test suite requires libc++, but it is currently disabled. "
93
+ "Please checkout `libcxx` in `llvm/projects` or disable tests "
94
+ "via `LLDB_INCLUDE_TESTS=OFF`." )
95
+ else ()
96
+ # If `LLVM_ENABLE_PROJECTS` is being used, suggest adding it.
97
+ message (FATAL_ERROR
98
+ "LLDB test suite requires libc++, but it is currently disabled. "
99
+ "Please add `libcxx` to `LLVM_ENABLE_PROJECTS` or disable tests "
100
+ "via `LLDB_INCLUDE_TESTS=OFF`." )
101
+ endif ()
102
+ endif ()
103
+ add_lldb_test_dependency (cxx )
104
+ endif ()
105
+ endif ()
106
+ endif ()
107
+
20
108
add_lldb_test_dependency (
21
109
lit-cpuid
22
110
llc
@@ -29,17 +117,6 @@ add_lldb_test_dependency(
29
117
llvm-readobj
30
118
)
31
119
32
- if (NOT LLDB_BUILT_STANDALONE )
33
- # Since llvm-strip is a symlink created by add_custom_target, it doesn't
34
- # expose an export target when building standalone.
35
- add_lldb_test_dependency (
36
- llvm-strip
37
- FileCheck
38
- count
39
- not
40
- )
41
- endif ()
42
-
43
120
if (TARGET lld )
44
121
add_lldb_test_dependency (lld )
45
122
else ()
0 commit comments