| # Helper function that creates an alias if a target specific implementation | |
| # exists, otherwise it uses a generic one. | |
| function(add_stdio_entrypoint_object name) | |
| if(TARGET libc.src.stdio.${LIBC_TARGET_OS}.${name}) | |
| add_entrypoint_object( | |
| ${name} | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.${name} | |
| ) | |
| elseif(TARGET libc.src.stdio.generic.${name}) | |
| add_entrypoint_object( | |
| ${name} | |
| ALIAS | |
| DEPENDS | |
| .generic.${name} | |
| ) | |
| endif() | |
| endfunction() | |
| if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) | |
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) | |
| endif() | |
| add_stdio_entrypoint_object(stdin) | |
| add_stdio_entrypoint_object(stdout) | |
| add_stdio_entrypoint_object(stderr) | |
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/generic) | |
| if(NOT LLVM_LIBC_FULL_BUILD) | |
| set(use_system_file "COMPILE_OPTIONS") | |
| libc_add_definition(use_system_file "LIBC_COPT_STDIO_USE_SYSTEM_FILE") | |
| endif() | |
| if(TARGET libc.src.stdio.${LIBC_TARGET_OS}.fflush_internal) | |
| add_object_library( | |
| fflush_internal | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.fflush_internal | |
| ) | |
| elseif(TARGET libc.src.stdio.generic.fflush_internal) | |
| add_object_library( | |
| fflush_internal | |
| ALIAS | |
| DEPENDS | |
| .generic.fflush_internal | |
| ) | |
| endif() | |
| add_entrypoint_object( | |
| fflush | |
| SRCS | |
| fflush.cpp | |
| HDRS | |
| fflush.h | |
| DEPENDS | |
| libc.hdr.stdio_macros | |
| libc.hdr.types.FILE | |
| libc.src.__support.error_or | |
| libc.src.__support.libc_errno | |
| .fflush_internal | |
| ) | |
| add_entrypoint_object( | |
| flockfile | |
| SRCS | |
| flockfile.cpp | |
| HDRS | |
| flockfile.h | |
| DEPENDS | |
| libc.hdr.types.FILE | |
| libc.src.__support.File.file | |
| libc.src.__support.File.platform_file | |
| ) | |
| add_entrypoint_object( | |
| funlockfile | |
| SRCS | |
| funlockfile.cpp | |
| HDRS | |
| funlockfile.h | |
| DEPENDS | |
| libc.hdr.types.FILE | |
| libc.src.__support.File.file | |
| libc.src.__support.File.platform_file | |
| ) | |
| add_entrypoint_object( | |
| fmemopen | |
| SRCS | |
| fmemopen.cpp | |
| HDRS | |
| fmemopen.h | |
| DEPENDS | |
| libc.hdr.errno_macros | |
| libc.hdr.stdint_proxy | |
| libc.hdr.stdio_macros | |
| libc.hdr.types.FILE | |
| libc.hdr.types.off_t | |
| libc.hdr.types.size_t | |
| libc.src.__support.CPP.algorithm | |
| libc.src.__support.CPP.new | |
| libc.src.__support.File.file | |
| libc.src.__support.alloc_checker | |
| libc.src.__support.libc_errno | |
| libc.src.__support.macros.null_check | |
| libc.src.string.memory_utils.inline_memcpy | |
| ) | |
| add_entrypoint_object( | |
| fopencookie | |
| SRCS | |
| fopencookie.cpp | |
| HDRS | |
| fopencookie.h | |
| DEPENDS | |
| libc.hdr.stdio_macros | |
| libc.hdr.types.off_t | |
| libc.hdr.types.cookie_io_functions_t | |
| libc.hdr.types.FILE | |
| libc.src.__support.CPP.new | |
| libc.src.__support.File.file | |
| ) | |
| add_entrypoint_object( | |
| setbuf | |
| SRCS | |
| setbuf.cpp | |
| HDRS | |
| setbuf.h | |
| DEPENDS | |
| libc.src.errno.errno | |
| libc.hdr.types.off_t | |
| libc.src.__support.File.file | |
| libc.src.__support.File.platform_file | |
| ) | |
| add_entrypoint_object( | |
| setvbuf | |
| SRCS | |
| setvbuf.cpp | |
| HDRS | |
| setvbuf.h | |
| DEPENDS | |
| libc.src.errno.errno | |
| libc.hdr.types.FILE | |
| libc.src.__support.File.file | |
| libc.src.__support.File.platform_file | |
| ) | |
| add_entrypoint_object( | |
| sscanf | |
| SRCS | |
| sscanf.cpp | |
| HDRS | |
| sscanf.h | |
| DEPENDS | |
| libc.src.__support.arg_list | |
| libc.src.stdio.scanf_core.scanf_main | |
| libc.src.stdio.scanf_core.string_reader | |
| ) | |
| add_entrypoint_object( | |
| vsscanf | |
| SRCS | |
| vsscanf.cpp | |
| HDRS | |
| vsscanf.h | |
| DEPENDS | |
| libc.src.__support.arg_list | |
| libc.src.stdio.scanf_core.scanf_main | |
| libc.src.stdio.scanf_core.string_reader | |
| ) | |
| set(sprintf_srcs sprintf.cpp) | |
| if(LIBC_CONF_PRINTF_MODULAR) | |
| list(APPEND sprintf_srcs sprintf_modular.cpp) | |
| endif() | |
| add_entrypoint_object( | |
| sprintf | |
| SRCS | |
| ${sprintf_srcs} | |
| HDRS | |
| sprintf.h | |
| DEPENDS | |
| libc.src.__support.printf_core.printf_main | |
| libc.src.__support.printf_core.writer | |
| libc.src.__support.printf_core.core_structs | |
| libc.src.__support.printf_core.error_mapper | |
| libc.src.__support.libc_errno | |
| libc.src.__support.CPP.limits | |
| ) | |
| set(snprintf_srcs snprintf.cpp) | |
| if(LIBC_CONF_PRINTF_MODULAR) | |
| list(APPEND snprintf_srcs snprintf_modular.cpp) | |
| endif() | |
| add_entrypoint_object( | |
| snprintf | |
| SRCS | |
| ${snprintf_srcs} | |
| HDRS | |
| snprintf.h | |
| DEPENDS | |
| libc.src.__support.printf_core.printf_main | |
| libc.src.__support.printf_core.writer | |
| libc.src.__support.printf_core.core_structs | |
| libc.src.__support.printf_core.error_mapper | |
| libc.src.__support.libc_errno | |
| libc.src.__support.CPP.limits | |
| ) | |
| set(asprintf_srcs asprintf.cpp) | |
| if(LIBC_CONF_PRINTF_MODULAR) | |
| list(APPEND asprintf_srcs asprintf_modular.cpp) | |
| endif() | |
| add_entrypoint_object( | |
| asprintf | |
| SRCS | |
| ${asprintf_srcs} | |
| HDRS | |
| asprintf.h | |
| DEPENDS | |
| libc.src.__support.printf_core.vasprintf_internal | |
| libc.src.__support.printf_core.core_structs | |
| libc.src.__support.printf_core.error_mapper | |
| libc.src.__support.libc_errno | |
| libc.src.__support.CPP.limits | |
| ) | |
| set(vsprintf_srcs vsprintf.cpp) | |
| if(LIBC_CONF_PRINTF_MODULAR) | |
| list(APPEND vsprintf_srcs vsprintf_modular.cpp) | |
| endif() | |
| add_entrypoint_object( | |
| vsprintf | |
| SRCS | |
| ${vsprintf_srcs} | |
| HDRS | |
| vsprintf.h | |
| DEPENDS | |
| libc.src.__support.printf_core.printf_main | |
| libc.src.__support.printf_core.writer | |
| libc.src.__support.printf_core.core_structs | |
| libc.src.__support.printf_core.error_mapper | |
| libc.src.__support.libc_errno | |
| libc.src.__support.CPP.limits | |
| ) | |
| set(vsnprintf_srcs vsnprintf.cpp) | |
| if(LIBC_CONF_PRINTF_MODULAR) | |
| list(APPEND vsnprintf_srcs vsnprintf_modular.cpp) | |
| endif() | |
| add_entrypoint_object( | |
| vsnprintf | |
| SRCS | |
| ${vsnprintf_srcs} | |
| HDRS | |
| vsnprintf.h | |
| DEPENDS | |
| libc.src.__support.printf_core.printf_main | |
| libc.src.__support.printf_core.writer | |
| libc.src.__support.printf_core.core_structs | |
| libc.src.__support.printf_core.error_mapper | |
| libc.src.__support.libc_errno | |
| libc.src.__support.CPP.limits | |
| ) | |
| set(vasprintf_srcs vasprintf.cpp) | |
| if(LIBC_CONF_PRINTF_MODULAR) | |
| list(APPEND vasprintf_srcs vasprintf_modular.cpp) | |
| endif() | |
| add_entrypoint_object( | |
| vasprintf | |
| SRCS | |
| ${vasprintf_srcs} | |
| HDRS | |
| vasprintf.h | |
| DEPENDS | |
| libc.src.__support.printf_core.vasprintf_internal | |
| libc.src.__support.printf_core.core_structs | |
| libc.src.__support.printf_core.error_mapper | |
| libc.src.__support.libc_errno | |
| libc.src.__support.CPP.limits | |
| ) | |
| add_subdirectory(scanf_core) | |
| add_entrypoint_object( | |
| remove | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.remove | |
| ) | |
| add_entrypoint_object( | |
| rename | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.rename | |
| ) | |
| add_entrypoint_object( | |
| renameat | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.renameat | |
| ) | |
| add_entrypoint_object( | |
| fdopen | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.fdopen | |
| ) | |
| add_entrypoint_object( | |
| popen | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.popen | |
| ) | |
| add_entrypoint_object( | |
| pclose | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.pclose | |
| ) | |
| add_entrypoint_object( | |
| tmpfile | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.tmpfile | |
| ) | |
| add_entrypoint_object( | |
| tmpnam | |
| ALIAS | |
| DEPENDS | |
| .${LIBC_TARGET_OS}.tmpnam | |
| ) | |
| # These entrypoints have multiple potential implementations. | |
| add_stdio_entrypoint_object(feof) | |
| add_stdio_entrypoint_object(feof_unlocked) | |
| add_stdio_entrypoint_object(ferror) | |
| add_stdio_entrypoint_object(ferror_unlocked) | |
| add_stdio_entrypoint_object(fseek) | |
| add_stdio_entrypoint_object(fgetpos) | |
| add_stdio_entrypoint_object(fsetpos) | |
| add_stdio_entrypoint_object(rewind) | |
| add_stdio_entrypoint_object(ftell) | |
| add_stdio_entrypoint_object(fseeko) | |
| add_stdio_entrypoint_object(fileno) | |
| add_stdio_entrypoint_object(ftello) | |
| add_stdio_entrypoint_object(clearerr) | |
| add_stdio_entrypoint_object(clearerr_unlocked) | |
| add_stdio_entrypoint_object(fopen) | |
| add_stdio_entrypoint_object(freopen) | |
| add_stdio_entrypoint_object(fclose) | |
| add_stdio_entrypoint_object(fread_unlocked) | |
| add_stdio_entrypoint_object(fread) | |
| add_stdio_entrypoint_object(perror) | |
| add_stdio_entrypoint_object(puts) | |
| add_stdio_entrypoint_object(fputs) | |
| add_stdio_entrypoint_object(fwrite_unlocked) | |
| add_stdio_entrypoint_object(fwrite) | |
| add_stdio_entrypoint_object(fputc) | |
| add_stdio_entrypoint_object(putc) | |
| add_stdio_entrypoint_object(putchar) | |
| add_stdio_entrypoint_object(printf) | |
| add_stdio_entrypoint_object(fprintf) | |
| add_stdio_entrypoint_object(fgetc) | |
| add_stdio_entrypoint_object(fgetc_unlocked) | |
| add_stdio_entrypoint_object(getc) | |
| add_stdio_entrypoint_object(getc_unlocked) | |
| add_stdio_entrypoint_object(getchar) | |
| add_stdio_entrypoint_object(getchar_unlocked) | |
| add_stdio_entrypoint_object(fgets) | |
| add_stdio_entrypoint_object(ungetc) | |
| add_stdio_entrypoint_object(scanf) | |
| add_stdio_entrypoint_object(fscanf) | |
| add_stdio_entrypoint_object(vprintf) | |
| add_stdio_entrypoint_object(vfprintf) | |
| add_stdio_entrypoint_object(vscanf) | |
| add_stdio_entrypoint_object(vfscanf) |