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