Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libc / src / __support / File / CMakeLists.txt
blobb3e4cc4b02779695fc1d933ff4390ed4768aaaa8
1 if(NOT (TARGET libc.src.__support.threads.mutex)
2    OR LIBC_TARGET_ARCHITECTURE_IS_GPU)
3   # Not all platforms have a mutex implementation. If mutex is unvailable,
4   # we just skip everything about files.
5   return()
6 endif()
8 add_object_library(
9   file
10   SRCS
11     file.cpp
12   HDRS
13     file.h
14   DEPENDS
15     libc.src.__support.CPP.new
16     libc.src.__support.CPP.span
17     libc.src.__support.threads.mutex
18     libc.src.__support.error_or
21 add_object_library(
22   dir
23   SRCS
24     dir.cpp
25   HDRS
26     dir.h
27   DEPENDS
28     libc.src.__support.CPP.new
29     libc.src.__support.CPP.span
30     libc.src.__support.threads.mutex
33 if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
34   return()
35 endif()
37 add_subdirectory(${LIBC_TARGET_OS})
39 set(target_file libc.src.__support.File.${LIBC_TARGET_OS}.file)
40 set(target_stdout libc.src.__support.File.${LIBC_TARGET_OS}.stdout)
41 set(target_stderr libc.src.__support.File.${LIBC_TARGET_OS}.stderr)
42 set(target_stdin libc.src.__support.File.${LIBC_TARGET_OS}.stdin)
44 set(file_targets "${target_file};${target_stdout};${target_stdin};${target_stderr}")
45 set(file_aliases "platform_file;platform_stdout;platform_stdin;platform_stderr")
47 foreach(alias target IN ZIP_LISTS file_aliases file_targets)
48   if(TARGET ${target})
49     add_object_library(
50       ${alias}
51       ALIAS
52         ${target}
53       DEPENDS
54         ${target}
55     )
56   endif()
57 endforeach()
59 set(target_dir libc.src.__support.File.${LIBC_TARGET_OS}.${LIBC_TARGET_OS}_dir)
60 if(NOT TARGET ${target_dir})
61   return()
62 endif()
64 add_object_library(
65   platform_dir
66   ALIAS
67     ${target_dir}
68   DEPENDS
69     ${target_dir}