blob: 0c6ec9f07a9b705c2a193ae0078b2183d2e733f1 (
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
|
function(add_fp_unittest name)
cmake_parse_arguments(
"MATH_UNITTEST"
"NEED_MPFR;NEED_MPC;UNIT_TEST_ONLY;HERMETIC_TEST_ONLY" # Optional arguments
"" # Single value arguments
"LINK_LIBRARIES;DEPENDS" # Multi-value arguments
${ARGN}
)
if(MATH_UNITTEST_NEED_MPC)
set(MATH_UNITTEST_NEED_MPFR TRUE)
if(NOT LIBC_TESTS_CAN_USE_MPC)
message(VERBOSE "Complex test ${name} will be skipped as MPC library is not available.")
return()
endif()
list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPCWrapper)
endif()
if(MATH_UNITTEST_NEED_MPFR)
if(NOT LIBC_TESTS_CAN_USE_MPFR)
message(VERBOSE "Math test ${name} will be skipped as MPFR library is not available.")
return()
endif()
endif()
if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
set(test_type HERMETIC_TEST_ONLY)
elseif(MATH_UNITTEST_UNIT_TEST_ONLY)
set(test_type UNIT_TEST_ONLY)
endif()
if(MATH_UNITTEST_NEED_MPFR)
if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
message(FATAL_ERROR "Hermetic math test cannot require MPFR.")
endif()
set(test_type UNIT_TEST_ONLY)
list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp)
if(NOT(LIBC_TARGET_OS_IS_DARWIN))
# macOS does not have libatomic.
list(APPEND MATH_UNITTEST_LINK_LIBRARIES -latomic)
endif()
endif()
list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
set(deps libc.hdr.math_macros)
if(MATH_UNITTEST_DEPENDS)
list(APPEND deps ${MATH_UNITTEST_DEPENDS})
endif()
add_libc_test(
${name}
${test_type}
LINK_LIBRARIES "${MATH_UNITTEST_LINK_LIBRARIES}"
"${MATH_UNITTEST_UNPARSED_ARGUMENTS}"
DEPENDS
libc.hdr.stdint_proxy
"${deps}"
)
endfunction(add_fp_unittest)
add_subdirectory(__support)
add_subdirectory(complex)
add_subdirectory(ctype)
add_subdirectory(errno)
add_subdirectory(fenv)
add_subdirectory(math)
add_subdirectory(search)
add_subdirectory(setjmp)
add_subdirectory(stdbit)
add_subdirectory(stdfix)
add_subdirectory(stdio)
add_subdirectory(stdlib)
add_subdirectory(string)
add_subdirectory(strings)
add_subdirectory(wchar)
add_subdirectory(wctype)
add_subdirectory(time)
add_subdirectory(unistd)
# Depends on utilities in stdlib
add_subdirectory(inttypes)
if(${LIBC_TARGET_OS} STREQUAL "linux")
add_subdirectory(fcntl)
add_subdirectory(poll)
add_subdirectory(sched)
add_subdirectory(sys)
add_subdirectory(termios)
endif()
if(NOT LLVM_LIBC_FULL_BUILD)
return()
endif()
add_subdirectory(arpa)
add_subdirectory(assert)
add_subdirectory(compiler)
add_subdirectory(dirent)
add_subdirectory(locale)
add_subdirectory(nl_types)
add_subdirectory(signal)
add_subdirectory(spawn)
if(${LIBC_TARGET_OS} STREQUAL "linux")
add_subdirectory(pthread)
endif()
|