@@ -115,7 +115,6 @@ list(APPEND _Foundation_common_build_flags
115115 "-DCF_BUILDING_CF"
116116 "-DDEPLOYMENT_ENABLE_LIBDISPATCH"
117117 "-DHAVE_STRUCT_TIMESPEC"
118- "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
119118 "-Wno-shorten-64-to-32"
120119 "-Wno-deprecated-declarations"
121120 "-Wno-unreachable-code"
@@ -127,6 +126,18 @@ list(APPEND _Foundation_common_build_flags
127126 "-Wno-switch"
128127 "-fblocks" )
129128
129+ if (CMAKE_SYSTEM_NAME STREQUAL "WASI" )
130+ list (APPEND _Foundation_common_build_flags
131+ "-D_WASI_EMULATED_SIGNAL"
132+ "-DHAVE_STRLCPY"
133+ "-DHAVE_STRLCAT"
134+ )
135+ else ()
136+ list (APPEND _Foundation_common_build_flags
137+ "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
138+ )
139+ endif ()
140+
130141if (NOT "${CMAKE_C_SIMULATE_ID} " STREQUAL "MSVC" )
131142 list (APPEND _Foundation_common_build_flags
132143 "-fconstant-cfstrings"
@@ -154,10 +165,21 @@ set(_Foundation_swift_build_flags)
154165list (APPEND _Foundation_swift_build_flags
155166 "-swift-version 6"
156167 "-DDEPLOYMENT_RUNTIME_SWIFT"
157- "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
158168 "-Xfrontend"
159169 "-require-explicit-sendable" )
160170
171+ if (CMAKE_SYSTEM_NAME STREQUAL "WASI" )
172+ list (APPEND _Foundation_swift_build_flags
173+ "-D_WASI_EMULATED_SIGNAL"
174+ "-DHAVE_STRLCPY"
175+ "-DHAVE_STRLCAT"
176+ )
177+ else ()
178+ list (APPEND _Foundation_swift_build_flags
179+ "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
180+ )
181+ endif ()
182+
161183if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" )
162184 list (APPEND _Foundation_common_build_flags
163185 "-D_GNU_SOURCE" )
0 commit comments