blob: 0a4541b9443c6bc58efc9f6111fed08a1456ee03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
macro(pythonize_bool var)
if (${var})
set(${var} True)
else()
set(${var} False)
endif()
endmacro()
if (NOT DEFINED LIBCXX_ENABLE_SHARED)
set(LIBCXX_ENABLE_SHARED ON)
endif()
option(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI
"Whether the libc++abi tests should link with the shared libc++abi library"
${LIBCXXABI_ENABLE_SHARED})
option(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX
"Whether the libc++abi tests should link with the shared libc++ library"
${LIBCXX_ENABLE_SHARED})
if(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI AND NOT LIBCXXABI_ENABLE_SHARED)
message(FATAL_ERROR "LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI being ON requires LIBCXXABI_ENABLE_SHARED to be ON")
endif()
if(NOT LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI AND NOT LIBCXXABI_ENABLE_STATIC)
message(FATAL_ERROR "LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI being OFF requires LIBCXXABI_ENABLE_STATIC to be ON")
endif()
if(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX AND NOT LIBCXX_ENABLE_SHARED)
message(FATAL_ERROR "LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX being ON requires LIBCXX_ENABLE_SHARED to be ON")
endif()
if(DEFINED LIBCXX_ENABLE_STATIC
AND NOT LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX
AND NOT LIBCXX_ENABLE_STATIC)
message(FATAL_ERROR "LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX being OFF requires LIBCXX_ENABLE_STATIC to be ON")
endif()
pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_ENABLE_THREADS)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
pythonize_bool(LIBCXXABI_USE_COMPILER_RT)
pythonize_bool(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
pythonize_bool(LIBCXX_ENABLE_PARALLEL_ALGORITHMS)
pythonize_bool(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX)
pythonize_bool(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI)
set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
"TargetInfo to use when setting up test environment.")
set(LIBCXXABI_EXECUTOR "${Python3_EXECUTABLE} ${LIBCXXABI_LIBCXX_PATH}/utils/run.py" CACHE STRING
"Executor to use when running tests.")
if (LIBCXXABI_ENABLE_SHARED)
set(LIBCXXABI_TEST_DEPS cxxabi_shared)
else()
set(LIBCXXABI_TEST_DEPS cxxabi_static)
endif()
if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
list(APPEND LIBCXXABI_TEST_DEPS cxx_external_threads)
endif()
list(APPEND LIBCXXABI_TEST_DEPS cxx)
if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
list(APPEND LIBCXXABI_TEST_DEPS unwind)
endif()
set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
macro(serialize_lit_param param value)
string(APPEND SERIALIZED_LIT_PARAMS "config.${param} = ${value}\n")
endmacro()
if (NOT LIBCXXABI_ENABLE_EXCEPTIONS)
serialize_lit_param(enable_exceptions False)
endif()
if (LIBCXXABI_ENABLE_ASSERTIONS)
serialize_lit_param(enable_assertions True)
endif()
serialize_lit_param(enable_experimental False)
if (LLVM_USE_SANITIZER)
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
endif()
if (CMAKE_CXX_COMPILER_TARGET)
serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"")
else()
serialize_lit_param(target_triple "\"${LLVM_DEFAULT_TARGET_TRIPLE}\"")
endif()
foreach(param IN LISTS LIBCXXABI_TEST_PARAMS)
string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
serialize_lit_param("${name}" "\"${value}\"")
endforeach()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg"
@ONLY)
configure_lit_site_cfg(
"${LIBCXXABI_TEST_CONFIG}"
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${LIBCXXABI_TEST_DEPS})
|