Skip to content

Commit 8873088

Browse files
committed
Reflect Package.swift WASI changes in CMakeLists.txt
1 parent acdc7e1 commit 8873088

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

CMakeLists.txt

+24-2
Original file line numberDiff line numberDiff line change
@@ -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+
130141
if(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)
154165
list(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+
161183
if(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

Comments
 (0)