Skip to content

Commit f9c064d

Browse files
authored
Merge pull request #85844 from MaxDesiatov/wasm-build-instructions
docs: Add instructions for Wasm stdlib building and testing
2 parents be78127 + 6c389fe commit f9c064d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/WebAssembly.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,27 @@ available yet, specifically:
1616
* Binary size is a high priority requirement. Since WebAssembly payloads are usually served in browsers,
1717
one wouldn't want end users to download multi-megabyte binaries.
1818

19+
## Running Wasm stdlib tests
20+
21+
If you're a compiler/stdlib engineer, this invocation builds LLVM, Swift, installs those together with necessary
22+
tools, and also builds WasmKit to execute stdlib tests:
23+
24+
```
25+
./utils/build-script --build-wasm-stdlib --wasmkit --build-embedded-stdlib --build-embedded-stdlib-cross-compiling \
26+
--install-swift --install-llvm \
27+
'--llvm-install-components=llvm-ar;llvm-nm;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;dsymutil;LTO;clang-features-file;lld' \
28+
--sccache
29+
```
30+
31+
On macOS it's also best to avoid cross-compiling host tools from arm64 to x86 and vice versa, add this option to avoid that: `--infer-cross-compile-hosts-on-darwin=false`.
32+
1933
## Building Swift SDK for WebAssembly
2034

2135
The [Swift SDK](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md)
2236
for WebAssembly is built and tested using the following command:
2337

2438
```bash
25-
./utils/build-script --build-wasm-stdlib --wasmkit --install-llvm --install-swift --swiftpm --install-swiftpm \
39+
./utils/build-script --sccache --build-wasm-stdlib --wasmkit --install-llvm --install-swift --swiftpm --install-swiftpm \
2640
--libcxx --install-libcxx --llbuild --install-llbuild --swift-testing --install-swift-testing \
2741
--swift-testing-macros --install-swift-testing-macros --build-embedded-stdlib --build-embedded-stdlib-cross-compiling \
2842
'--llvm-install-components=llvm-ar;llvm-nm;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;dsymutil;LTO;clang-features-file;lld'

0 commit comments

Comments
 (0)