1if(NOT (TARGET libc.src.__support.threads.mutex) 2 OR LIBC_TARGET_OS_IS_GPU) 3 # Not all platforms have a mutex implementation. If mutex is unvailable, 4 # we just skip everything about files. 5 return() 6endif() 7 8add_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 19 libc.hdr.types.off_t 20 libc.hdr.stdio_macros 21 libc.hdr.func.realloc 22) 23 24add_object_library( 25 dir 26 SRCS 27 dir.cpp 28 HDRS 29 dir.h 30 DEPENDS 31 libc.src.__support.CPP.mutex 32 libc.src.__support.CPP.new 33 libc.src.__support.CPP.span 34 libc.src.__support.threads.mutex 35) 36 37if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) 38 return() 39endif() 40 41add_subdirectory(${LIBC_TARGET_OS}) 42 43set(target_file libc.src.__support.File.${LIBC_TARGET_OS}.file) 44set(target_stdout libc.src.__support.File.${LIBC_TARGET_OS}.stdout) 45set(target_stderr libc.src.__support.File.${LIBC_TARGET_OS}.stderr) 46set(target_stdin libc.src.__support.File.${LIBC_TARGET_OS}.stdin) 47 48set(file_targets "${target_file};${target_stdout};${target_stdin};${target_stderr}") 49set(file_aliases "platform_file;platform_stdout;platform_stdin;platform_stderr") 50 51foreach(alias target IN ZIP_LISTS file_aliases file_targets) 52 if(TARGET ${target}) 53 add_object_library( 54 ${alias} 55 ALIAS 56 ${target} 57 DEPENDS 58 ${target} 59 ) 60 endif() 61endforeach() 62 63set(target_dir libc.src.__support.File.${LIBC_TARGET_OS}.${LIBC_TARGET_OS}_dir) 64if(NOT TARGET ${target_dir}) 65 return() 66endif() 67 68add_object_library( 69 platform_dir 70 ALIAS 71 ${target_dir} 72 DEPENDS 73 ${target_dir} 74) 75