Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions stdlib/public/Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ foreach(sdk ${SWIFT_SDKS})
list(APPEND glibc_modulemap_target_list ${copy_glibc_modulemap_static})
endif()

set(glibc_header_out "${module_dir}/SwiftGlibc.h")
handle_gyb_source_single(glibc_header_target
SOURCE "SwiftGlibc.h.gyb"
OUTPUT "${glibc_header_out}"
FLAGS "-DCMAKE_SDK=${sdk}")
list(APPEND glibc_modulemap_target_list ${glibc_header_target})

# If this SDK is a target for a non-native host, except if it's for Android
# with its own native sysroot, create a native modulemap without a sysroot
# prefix. This is the one we'll install instead.
Expand Down Expand Up @@ -150,11 +157,17 @@ foreach(sdk ${SWIFT_SDKS})
swift_install_in_component(FILES "${glibc_modulemap_out}"
DESTINATION "lib/swift/${arch_subdir}"
COMPONENT sdk-overlay)
swift_install_in_component(FILES "${glibc_header_out}"
DESTINATION "lib/swift/${arch_subdir}"
COMPONENT sdk-overlay)

if(SWIFT_BUILD_STATIC_STDLIB)
swift_install_in_component(FILES "${glibc_modulemap_out}"
DESTINATION "lib/swift_static/${arch_subdir}"
COMPONENT sdk-overlay)
swift_install_in_component(FILES "${glibc_header_out}"
DESTINATION "lib/swift_static/${arch_subdir}"
COMPONENT sdk-overlay)
endif()
endforeach()
endforeach()
Expand Down
107 changes: 107 additions & 0 deletions stdlib/public/Platform/SwiftGlibc.h.gyb
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
%{
headers = [
'stdc-predef.h',
'features.h',

# C standard library
'complex.h',
'ctype.h',
'errno.h',
'fenv.h',
'float.h',
'inttypes.h',
'iso646.h',
'libutil.h',
'limits.h',
'locale.h',
'math.h',
'pty.h',
'setjmp.h',
'signal.h',
'stdarg.h',
'stdbool.h',
'stddef.h',
'stdint.h',
'stdio.h',
'stdlib.h',
'string.h',
'tgmath.h',
'time.h',
'utmp.h',
'utmpx.h',

# POSIX
'aio.h',
'arpa/inet.h',
'bsd/ifaddrs.h',
'bsd/pty.h',
'cpio.h',
'dirent.h',
'dlfcn.h',
'fcntl.h',
'fmtmsg.h',
'fnmatch.h',
'ftw.h',
'glob.h',
'grp.h',
'iconv.h',
'ifaddrs.h',
'langinfo.h',
'libgen.h',
'link.h',
'monetary.h',
'net/if.h',
'netdb.h',
'netinet/in.h',
'netinet/tcp.h',
'nl_types.h',
'poll.h',
'pthread.h',
'pwd.h',
'regex.h',
'sched.h',
'search.h',
'semaphore.h',
'spawn.h',
'strings.h',
'sys/event.h',
'sys/file.h',
'sys/inotify.h',
'sys/ioctl.h',
'sys/ipc.h',
'sys/mman.h',
'sys/msg.h',
'sys/resource.h',
'sys/select.h',
'sys/sem.h',
'sys/sendfile.h',
'sys/shm.h',
'sys/socket.h',
'sys/stat.h',
'sys/statvfs.h',
'sys/time.h',
'sys/times.h',
'sys/types.h',
'sys/uio.h',
'sys/un.h',
'sys/user.h',
'sys/utsname.h',
'sys/wait.h',
'sysexits.h',
'syslog.h',
'tar.h',
'termios.h',
'ulimit.h',
'unistd.h',
'utime.h',
'utmpx.h',
'wait.h',
'wordexp.h',
]
}%

% for header in headers:
#if __has_include(<${header}>)
#include <${header}>
#endif
% end
Loading