@@ -148,6 +148,9 @@ def _apply_default_arguments(args):
148148 if not args .android or not args .build_android :
149149 args .build_android = False
150150
151+ if not args .wasi or not args .build_wasi :
152+ args .build_wasi = False
153+
151154 # --test-paths implies --test and/or --validation-test
152155 # depending on what directories/files have been specified.
153156 if args .test_paths :
@@ -184,6 +187,7 @@ def _apply_default_arguments(args):
184187 args .test_tvos = False
185188 args .test_watchos = False
186189 args .test_android = False
190+ args .test_wasi = False
187191 args .test_swiftpm = False
188192 args .test_swiftsyntax = False
189193 args .test_indexstoredb = False
@@ -230,11 +234,19 @@ def _apply_default_arguments(args):
230234 if not args .test_android :
231235 args .test_android_host = False
232236
237+ if not args .build_wasi :
238+ args .test_wasi = False
239+ args .test_wasi_host = False
240+
241+ if not args .test_wasi :
242+ args .test_wasi_host = False
243+
233244 if not args .host_test :
234245 args .test_ios_host = False
235246 args .test_tvos_host = False
236247 args .test_watchos_host = False
237248 args .test_android_host = False
249+ args .test_wasi_host = False
238250
239251
240252def create_argument_parser ():
@@ -323,6 +335,9 @@ def create_argument_parser():
323335 option ('--android' , toggle_true ,
324336 help = 'also build for Android' )
325337
338+ option ('--wasi' , toggle_true ,
339+ help = 'also build for WebAssembly/WASI' )
340+
326341 option ('--swift-analyze-code-coverage' , store ,
327342 choices = ['false' , 'not-merged' , 'merged' ],
328343 # so CMake can see the inert mode as a false value
@@ -919,6 +934,9 @@ def create_argument_parser():
919934 option ('--skip-build-android' , toggle_false ('build_android' ),
920935 help = 'skip building Swift stdlibs for Android' )
921936
937+ option ('--skip-build-wasi' , toggle_false ('build_wasi' ),
938+ help = 'skip building Swift stdlibs for WebAssembly/WASI' )
939+
922940 option ('--skip-build-benchmarks' , toggle_false ('build_benchmarks' ),
923941 help = 'skip building Swift Benchmark Suite' )
924942
@@ -975,6 +993,14 @@ def create_argument_parser():
975993 help = 'skip testing Android device targets on the host machine (the '
976994 'phone itself)' )
977995
996+ option ('--skip-test-wasi' ,
997+ toggle_false ('test_wasi' ),
998+ help = 'skip testing all WebAssembly/WASI targets.' )
999+ option ('--skip-test-wasi-host' ,
1000+ toggle_false ('test_wasi_host' ),
1001+ help = 'skip testing WebAssembly/WASI device targets on the host machine (the '
1002+ 'WebAssembly/WASI runtime)' )
1003+
9781004 option ('--skip-test-swiftpm' , toggle_false ('test_swiftpm' ),
9791005 help = 'skip testing swiftpm' )
9801006 option ('--skip-test-swiftsyntax' , toggle_false ('test_swiftsyntax' ),
@@ -1043,6 +1069,24 @@ def create_argument_parser():
10431069 'Currently only armv7 and aarch64 are supported. '
10441070 '%(default)s is the default.' )
10451071
1072+ # -------------------------------------------------------------------------
1073+ in_group ('Build settings for WebAssembly/WASI' )
1074+
1075+ option ('--wasi-sysroot' , store_path ,
1076+ help = 'An absolute path to WASI sysroot that will be used as a libc '
1077+ 'implementation for WebAssembly builds' )
1078+
1079+ option ('--wasi-icu-uc' , store_path ,
1080+ help = 'Path to libicuuc.a' )
1081+ option ('--wasi-icu-uc-include' , store_path ,
1082+ help = 'Path to a directory containing headers for libicuuc' )
1083+ option ('--wasi-icu-i18n' , store_path ,
1084+ help = 'Path to libicui18n.a' )
1085+ option ('--wasi-icu-i18n-include' , store_path ,
1086+ help = 'Path to a directory containing headers libicui18n' )
1087+ option ('--wasi-icu-data' , store_path ,
1088+ help = 'Path to libicudata.a' )
1089+
10461090 # -------------------------------------------------------------------------
10471091 in_group ('Experimental language features' )
10481092
0 commit comments