Skip to content

Commit a17c6b3

Browse files
Update setup.md for 5.10 release and add setup-snapshot.md
1 parent bb1dd0d commit a17c6b3

File tree

4 files changed

+92
-18
lines changed

4 files changed

+92
-18
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [Introduction](README.md)
44
- [Getting Started](getting-started/index.md)
55
- [Installation](getting-started/setup.md)
6+
- [Development Snapshot](getting-started/setup-snapshot.md)
67
- [Hello, World](getting-started/hello-world.md)
78
- [Using Swift Package Manager](getting-started/swift-package.md)
89
- [Porting code from other platforms](getting-started/porting.md)

src/getting-started/setup-snapshot.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Installation - Development Snapshot
2+
3+
## WebAssembly SDK - Cross compile to WebAssembly
4+
5+
The upstream Open Source Swift toolchain does support WebAssembly as a target platform since **Swift 6.0**.
6+
For those versions, you just need to install [Swift SDK for cross-compilation](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md).
7+
8+
9+
## Instructions
10+
11+
1. **Find a Development Snapshot**
12+
13+
Visit the [SwiftWasm GitHub Releases page](https://github.com/swiftwasm/swift/releases).
14+
15+
2. **Match the Swift Toolchain Version**
16+
17+
Refer to the release note's table to find the corresponding upstream Swift toolchain version.
18+
> For example, [`swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-12-a`](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-12-a) corresponds to `swift-DEVELOPMENT-SNAPSHOT-2024-06-11-a`
19+
20+
3. **Download the Swift Toolchain**
21+
22+
Download the appropriate Swift toolchain version from [swift.org/install](https://www.swift.org/install).
23+
24+
4. **Get the Swift SDK artifactbundle URL**
25+
26+
Find the URL ending with `.artifactbundle.zip` from the release page you found in step 1.
27+
28+
5. **Install the Swift SDK for WebAssembly**
29+
30+
Use the following command to install the Swift SDK:
31+
```console
32+
$ swift sdk install <URL-or-filename-of-swift-sdk-artifactbundle>
33+
```
34+
> For example, if you selected `swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-12-a`, you need to run the following command:
35+
> ```console
36+
> $ swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-12-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-12-a-wasm32-unknown-wasi.artifactbundle.zip
37+
> ```
38+
6. You can see the installed SDKs using the following command:
39+
```console
40+
$ swift sdk list
41+
<Swift SDK id>
42+
...
43+
```
44+
> Once you don't need the SDK, you can remove it using the following command:
45+
> ```console
46+
> $ swift sdk remove <Swift SDK id>
47+
> ```
48+
49+
## How to use the Swift SDK
50+
51+
First, create a new Swift package using the following command:
52+
53+
```console
54+
$ mkdir Example
55+
$ cd Example
56+
$ swift package init --type executable
57+
```
58+
59+
Then, you can build the package using the Swift SDK:
60+
61+
```console
62+
$ swift build --swift-sdk wasm32-unknown-wasi
63+
# or
64+
$ swift build --swift-sdk <Swift SDK id>
65+
```
66+
67+
## FAQ
68+
69+
### What is the difference between the Swift Toolchain and the Swift SDK?
70+
71+
The Swift toolchain is a complete package that includes the Swift compiler, standard library, and other tools.
72+
73+
The Swift SDK includes a subset of the Swift toolchain that includes only the necessary components for cross-compilation and some supplementary resources.
74+
75+
### What is included in the Swift SDK for WebAssembly?
76+
77+
The Swift SDK for WebAssembly includes only the pre-built Swift standard libraries for WebAssembly. It does not include the Swift compiler or other tools that are part of the Swift toolchain.

src/getting-started/setup.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
# Installation
1+
# Installation - Latest Release (SwiftWasm 5.10)
22

33
To install Swift for WebAssembly toolchain, download one of the packages below and follow the instructions for your operating system.
44

5-
## Latest Release
6-
7-
**SwiftWasm 5.9**
8-
9-
Tag: [swift-wasm-5.9.1-RELEASE](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.9.1-RELEASE)
5+
Tag: [swift-wasm-5.10.0-RELEASE](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.10.0-RELEASE)
106

117
| Download | Docker Tag |
128
|:------------------:|:----------:|
13-
| [macOS arm64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-macos_arm64.pkg) | Unavailable |
14-
| [macOS x86](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-macos_x86_64.pkg) | Unavailable |
15-
| [Ubuntu 18.04 x86_64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-ubuntu18.04_x86_64.tar.gz) | [5.9-bionic, bionic](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
16-
| [Ubuntu 20.04 x86_64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-ubuntu20.04_x86_64.tar.gz) | [5.9-focal, focal](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
17-
| [Ubuntu 20.04 aarch64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-ubuntu20.04_aarch64.tar.gz) | [5.9-focal, focal](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
18-
| [Ubuntu 22.04 x86_64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-ubuntu22.04_x86_64.tar.gz) | [5.9, 5.9-jammy, jammy, latest](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
9+
| [macOS arm64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-macos_arm64.pkg) | Unavailable |
10+
| [macOS x86](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-macos_x86_64.pkg) | Unavailable |
11+
| [Ubuntu 18.04 x86_64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-ubuntu18.04_x86_64.tar.gz) | [5.10-bionic, bionic](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
12+
| [Ubuntu 20.04 x86_64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-ubuntu20.04_x86_64.tar.gz) | [5.10-focal, focal](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
13+
| [Ubuntu 20.04 aarch64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-ubuntu20.04_aarch64.tar.gz) | [5.10-focal, focal](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
14+
| [Ubuntu 22.04 x86_64](https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-ubuntu22.04_x86_64.tar.gz) | [5.10, 5.10-jammy, jammy, latest](https://github.com/orgs/swiftwasm/packages/container/package/swift) |
1915

2016

21-
You can download the latest development snapshot from [the Releases page](https://github.com/swiftwasm/swift/releases)
17+
You can find older releases from the [GitHub Releases page](https://github.com/swiftwasm/swift/releases?q=prerelease%3Afalse)
2218

2319
## Toolchain Installation
2420

@@ -37,7 +33,7 @@ export PATH=/Library/Developer/Toolchains/<toolchain name>.xctoolchain/usr/bin:"
3733
```bash
3834
$ swift --version
3935
# Or TOOLCHAINS=swiftwasm swift --version
40-
SwiftWasm Swift version 5.9.1 (swiftlang-5.9.1)
36+
SwiftWasm Swift version 5.10-dev
4137
Target: x86_64-apple-darwin21.6.0
4238
```
4339

@@ -52,13 +48,13 @@ If you want to uninstall the toolchain, you can remove the toolchain directory f
5248

5349
SwiftWasm provides [Swift SDK](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md)s for WebAssembly. You can use the Swift SDK to cross-compile Swift packages for WebAssembly without installing the whole toolchain.
5450

55-
To use the Swift SDK, you need to install the official Swift toolchain 5.9 or later. Then, you can install the Swift SDK using the following command while replacing `<your platform>`:
51+
To use the Swift SDK, you need to install the official Swift toolchain 5.10 or later. Then, you can install the Swift SDK using the following command while replacing `<your platform>`:
5652

5753
```bash
58-
$ swift experimental-sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.2-RELEASE/swift-wasm-5.9.2-RELEASE-<your platform>.artifactbundle.zip
54+
$ swift experimental-sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.10.0-RELEASE/swift-wasm-5.10.0-RELEASE-<your platform>.artifactbundle.zip
5955
```
6056

61-
You can find the latest Swift SDK release from [the GitHub Releases page](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.9.2-RELEASE).
57+
You can find the latest Swift SDK release from [the GitHub Releases page](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.10.0-RELEASE).
6258

6359
After installing the Swift SDK, you can see the installed SDKs using the following command:
6460

src/getting-started/swift-package.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $ swift build --triple wasm32-unknown-wasi
2525
If [you installed Swift SDK instead of the whole toolchain](./setup.md#experimental-swift-sdk), you need to use the following command:
2626

2727
```sh
28-
$ swift build --experimental-swift-sdk <SDK name>
28+
$ swift build --swift-sdk <SDK name>
2929
```
3030

3131
## 3. Run the produced binary

0 commit comments

Comments
 (0)