Skip to content

Commit c62d022

Browse files
Add documentation for more common generator options most might want to use
1 parent af00a0d commit c62d022

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,40 @@ for Ubuntu Jammy and Swift 5.9 this would be `swift:5.9-jammy-slim`. If you'd li
116116
an arbitrary Ubuntu Jammy system, make sure you pass `--static-swift-stdlib` flag to `swift build`, in addition
117117
to the `--experimental-swift-sdk` option.
118118

119+
## Common Generator Options
120+
121+
By default, on macOS hosts running on Apple Silicon, the Swift SDK Generator will create Swift SDKs
122+
for Ubuntu Jammy on aarch64, which matches the arch of the host. However, it is possible to change
123+
the default target architecture by passing the `--target` flag:
124+
125+
```bash
126+
swift run swift-sdk-generator make-linux-sdk --target x86_64-unknown-linux-gnu
127+
```
128+
129+
The Linux distribution name and version can also be passed to change from the default of Ubuntu Jammy:
130+
131+
```bash
132+
swift run swift-sdk-generator make-linux-sdk --linux-distribution-name ubuntu --linux-distribution-version noble
133+
```
134+
135+
### Host Toolchain
136+
137+
The host toolchain is not included in the generated Swift SDK by default on Linux to match the behavior
138+
of the [Static Linux Swift SDKs](https://www.swift.org/documentation/articles/static-linux-getting-started.html)
139+
downloadable from [swift.org](https://www.swift.org/install/). However, on macOS, since most users are using Xcode
140+
and are likely not using the Swift OSS toolchain to build and run Swift projects, the Swift host toolchain
141+
is included by *default*. This default behavior can be changed by passing `--no-host-toolchain`:
142+
143+
```bash
144+
swift run swift-sdk-generator make-linux-sdk --no-host-toolchain --target x86_64-unknown-linux-gnu
145+
```
146+
147+
Or, if on Linux, and desiring to generate the Swift SDK with the host toolchain included, add `--host-toolchain`:
148+
149+
```bash
150+
swift run swift-sdk-generator make-linux-sdk --host-toolchain --target aarch64-unknown-linux-gnu
151+
```
152+
119153
## Building an SDK from a container image
120154

121155
You can base your SDK on a container image, such as one of the

0 commit comments

Comments
 (0)