150
|
1 add_custom_target(LLDBUnitTests)
|
|
2 set_target_properties(LLDBUnitTests PROPERTIES FOLDER "lldb tests")
|
207
|
3
|
|
4 add_dependencies(lldb-unit-test-deps LLDBUnitTests)
|
150
|
5
|
|
6 include_directories(${LLDB_SOURCE_ROOT})
|
|
7 include_directories(${LLDB_PROJECT_ROOT}/unittests)
|
|
8
|
207
|
9 if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
|
|
10 add_compile_options("-Wno-suggest-override")
|
|
11 endif()
|
|
12
|
150
|
13 set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/gtest_common.h)
|
|
14 if (MSVC)
|
|
15 list(APPEND LLVM_COMPILE_FLAGS /FI ${LLDB_GTEST_COMMON_INCLUDE})
|
|
16 else ()
|
|
17 list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE})
|
|
18 endif ()
|
|
19
|
|
20 if (LLDB_BUILT_STANDALONE)
|
|
21 # Build the gtest library needed for unittests, if we have LLVM sources
|
|
22 # handy.
|
|
23 if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
|
|
24 add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
|
|
25 endif()
|
|
26 # LLVMTestingSupport library is needed for Process/gdb-remote.
|
|
27 if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
|
|
28 AND NOT TARGET LLVMTestingSupport)
|
|
29 add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
|
|
30 lib/Testing/Support)
|
|
31 endif()
|
|
32 endif()
|
|
33
|
|
34 function(add_lldb_unittest test_name)
|
|
35 cmake_parse_arguments(ARG
|
|
36 ""
|
|
37 ""
|
|
38 "LINK_LIBS;LINK_COMPONENTS"
|
|
39 ${ARGN})
|
|
40
|
207
|
41 if (NOT ${test_name} MATCHES "Tests$")
|
|
42 message(FATAL_ERROR "Unit test name must end with 'Tests' for lit to find it.")
|
|
43 endif()
|
|
44
|
150
|
45 list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
|
|
46
|
|
47 add_unittest(LLDBUnitTests
|
|
48 ${test_name}
|
|
49 ${ARG_UNPARSED_ARGUMENTS}
|
|
50 )
|
|
51
|
|
52 add_custom_command(
|
|
53 TARGET ${test_name}
|
|
54 POST_BUILD
|
|
55 COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs)
|
|
56
|
|
57 target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS})
|
|
58 endfunction()
|
|
59
|
|
60 function(add_unittest_inputs test_name inputs)
|
|
61 foreach (INPUT ${inputs})
|
|
62 add_custom_command(
|
|
63 TARGET ${test_name}
|
|
64 POST_BUILD
|
|
65 COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Inputs/${INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs
|
|
66 COMMENT "Copying ${INPUT} to binary directory.")
|
|
67 endforeach()
|
|
68 endfunction()
|
|
69
|
|
70 add_subdirectory(TestingSupport)
|
173
|
71 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
72 # FIXME: APITests.exe is not a valid googletest binary.
|
|
73 add_subdirectory(API)
|
|
74 endif()
|
150
|
75 add_subdirectory(Breakpoint)
|
|
76 add_subdirectory(Core)
|
|
77 add_subdirectory(DataFormatter)
|
|
78 add_subdirectory(Disassembler)
|
|
79 add_subdirectory(Editline)
|
|
80 add_subdirectory(Expression)
|
|
81 add_subdirectory(Host)
|
|
82 add_subdirectory(Interpreter)
|
207
|
83 add_subdirectory(Instruction)
|
150
|
84 add_subdirectory(Language)
|
|
85 add_subdirectory(ObjectFile)
|
|
86 add_subdirectory(Platform)
|
|
87 add_subdirectory(Process)
|
|
88 add_subdirectory(ScriptInterpreter)
|
|
89 add_subdirectory(Signals)
|
|
90 add_subdirectory(Symbol)
|
|
91 add_subdirectory(SymbolFile)
|
|
92 add_subdirectory(Target)
|
|
93 add_subdirectory(tools)
|
|
94 add_subdirectory(UnwindAssembly)
|
|
95 add_subdirectory(Utility)
|
207
|
96 add_subdirectory(Thread)
|
150
|
97
|
|
98 if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
|
|
99 add_subdirectory(debugserver)
|
|
100 endif()
|