@@ -256,10 +256,31 @@ foreach(sdk ${SWIFT_SDKS})
256
256
add_dependencies (stdlib swift-stdlib-${arch_suffix} swiftImageRegistration-${arch_suffix} )
257
257
endif ()
258
258
259
+ string (TOLOWER "${sdk} " lowercase_sdk )
259
260
# Generate the static-stdlib-args.lnk file used by -static-stdlib option for
260
261
# 'GenericUnix' (eg linux)
261
262
if (${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF )
262
263
string (TOLOWER "${sdk} " lowercase_sdk )
264
+ if (SWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB )
265
+ set (libicu_i18n_a -licui18nswift )
266
+ set (libicu_uc_a -licuucswift )
267
+ set (libicu_data_a -licudataswift )
268
+ else ()
269
+ find_package (ICU REQUIRED COMPONENTS uc i18n )
270
+ get_filename_component (ICU_UC_LIBDIR "${ICU_UC_LIBRARIES} " DIRECTORY )
271
+ get_filename_component (ICU_I18N_LIBDIR "${ICU_I18N_LIBRARIES} " DIRECTORY )
272
+
273
+ set (libicu_i18n_a -licui18n )
274
+ set (libicu_uc_a -licuuc )
275
+ set (libicu_data_a )
276
+ if (EXISTS ${ICU_I18N_LIBDIR} /libicui18n.a AND
277
+ EXISTS ${ICU_UC_LIBDIR} /libicuuc.a AND
278
+ EXISTS ${ICU_UC_LIBDIR} /libicudata.a )
279
+ set (libicu_i18n_a ${ICU_I18N_LIBDIR} /libicui18n.a )
280
+ set (libicu_uc_a ${ICU_UC_LIBDIR} /libicuuc.a )
281
+ set (libicu_data_a ${ICU_UC_LIBDIR} /libicudata.a )
282
+ endif ()
283
+ endif ()
263
284
set (libpthread -lpthread )
264
285
set (concurrency_libs )
265
286
set (android_libraries )
@@ -286,6 +307,28 @@ ${concurrency_libs}
286
307
swift_install_in_component (FILES "${SWIFTSTATICLIB_DIR} /${linkfile} "
287
308
DESTINATION "lib/swift_static/${lowercase_sdk} "
288
309
COMPONENT stdlib )
310
+ elseif ("${sdk} " STREQUAL "WASI" )
311
+ set (swift_icu_libs_wasi_list )
312
+ set (icu_modules UC I18N DATA )
313
+ foreach (module IN LISTS icu_modules )
314
+ set (module_lib "${SWIFT_WASI_wasm32_ICU_${module} }" )
315
+ get_filename_component (module_lib_name ${module_lib} NAME )
316
+ add_custom_command_target (swift_icu_${module}_${sdk}
317
+ COMMAND
318
+ "${CMAKE_COMMAND} " -E copy
319
+ "${module_lib} "
320
+ "${SWIFTSTATICLIB_DIR} /${lowercase_sdk} /${module_lib_name} "
321
+ OUTPUT
322
+ "${SWIFTSTATICLIB_DIR} /${lowercase_sdk} /${module_lib_name} "
323
+ DEPENDS
324
+ "${module_lib} " )
325
+ list (APPEND swift_icu_libs_wasi_list ${swift_icu_${module}_${sdk}} )
326
+ swift_install_in_component (FILES "${SWIFTSTATICLIB_DIR} /${lowercase_sdk} /${module_lib_name} "
327
+ DESTINATION "lib/swift_static/${lowercase_sdk} "
328
+ COMPONENT stdlib )
329
+ endforeach ()
330
+ add_custom_target (swift_icu_libs_wasi ALL DEPENDS ${swift_icu_libs_wasi_list} )
331
+ add_dependencies (stdlib swift_icu_libs_wasi )
289
332
endif ()
290
333
endforeach ()
291
334
endforeach ()
0 commit comments