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