A portable app runtime. Apps are written once in Embedded Swift, built
as a wasm32 module and optional native static libraries, and run inside a
native host on iOS, macOS, Android and Linux. Guest and host talk only
through a small dynamic-runtime C ABI, rt.h,
modeled on the Objective-C runtime and reduced to what Objective-C, JNI and C
all support. Platforms implement portable contracts declared as Swift
protocols.
- Design: Documentation/DynamicRuntime.md
- Phase one status, decisions and findings: Documentation/Implementation.md
This repository holds the shared, platform-independent code (the ABI, the guest library and macros, the runtime core, the provider contracts, the guest build scripts), the wasm import shim, and the Linux bundle launcher and sandbox. Platform hosts and UI renderers (iOS, Android, Linux) are written separately.
The package supports macOS 12 and iOS 15, the oldest deployment targets
current Xcode accepts. The WasmKit engine needs macOS 15 / iOS 18, so it is
its own package, Packages/RuntimeWasm, which
depends on this one by path. Hosts that ship only native slices or wasm2c
don't depend on WasmKit.
| Target | Role | Embedded |
|---|---|---|
CRuntime |
rt.h, plus rt_guest.h (ABI version, section names, wasm allocator) |
C, freestanding |
RuntimeABI |
Wire types, signatures, status codes, contract descriptors, rt.contracts encoding |
yes |
DynamicRuntime |
Guest library: rt_* wrappers, proxies, marshaling, rt_dispatch / rt_finalize (the GuestExports trait), List, macros |
yes |
DynamicRuntimeMacros |
@DynamicRuntime / @DynamicCallback: proxies, dispatch adapters, metadata records |
build machine |
RuntimeCore |
Runtime core: handle table, registry, Swift-registry backend, validation | yes |
RuntimeNative |
rt_* as C symbols for native slices, and a direct binding for host Swift code |
yes |
RuntimeHost |
What native hosts share: the app's Info.plist keys (AppInfo), the startup checks, HostModule and permission providers, and the generic Permissions and Application built-ins |
host |
RuntimeWasm |
WasmKit import shim: runs App.wasm against RuntimeCore. A separate package in Packages/RuntimeWasm |
host, macOS 15 / iOS 18 |
DynamicBluetooth, DynamicLocation, DynamicNetworking, DynamicFormatting |
Provider contracts (declarations) | yes |
DynamicFiles |
The app's files and its bundle's: the Files contract and the guest's FileManager. RuntimeHost has HostFiles, the host side over POSIX calls |
yes |
DynamicMedia |
Media players: a song, a podcast or a video the host decodes and shows. The MediaPlayback contract, the guest's MediaPlayer, VideoPlayer and AudioPlayer, what's playing for the lock screen, and playing on in the background |
yes |
RuntimeMedia |
HostMediaPlayback: the media contract over a host's own players |
host |
DynamicContacts |
The people in the user's address book, as the system keeps them: the Contacts framework's place. The Contacts contract and the guest's ContactStore and Contact |
yes |
RuntimeContacts |
HostContacts: the contacts contract over a host's own address book, and one in memory for tests |
host |
DynamicPhotos |
The photos and videos the system keeps for the user: PhotoKit's place. The Photos contract, the guest's PhotoLibrary, PhotoAsset and PhotoFetchResult, and the PhotoView that shows one |
yes |
RuntimePhotos |
HostPhotos: the photos contract over a host's own library, and one in memory for tests |
host |
DynamicTransfers |
Downloads to a file and uploads from one, which the host moves and the system can carry on after the app closes. The Transfers contract, the guest's TransferManager and observable Transfer |
yes |
RuntimeTransfers |
HostTransfers: the transfers contract over a host's engines, with one over URLSession and one in memory for tests |
host |
DynamicCamera |
The camera: a live preview, photos, and video with sound. The CameraCapture contract, the guest's Camera, and the CameraPreview view |
yes |
RuntimeCamera |
HostCameraCapture: the camera contract over a host's own cameras |
host |
DynamicCalendar |
The user's calendars and events, as the system keeps them: EventKit's place. The Calendars contract and the guest's EventStore, Event and RecurrenceRule |
yes |
RuntimeCalendar |
HostCalendars: the calendar contract over a host's own store, and a store in memory that expands repeating events |
host |
DynamicSecrets |
An app's secrets, kept encrypted by the system: a token, a password. The Secrets contract and the guest's Keychain |
yes |
RuntimeSecrets |
HostSecrets: the secrets contract over a host's own store |
host |
DynamicAuthentication |
Signing in on a page the system's browser shows: the WebAuthentication contract and the guest's WebAuthenticationSession |
yes |
RuntimeAuthentication |
HostWebAuthentication: the sign-in contract over a host's own browser |
host |
DynamicClipboard |
The system's clipboard, for an app's own Copy and Paste: text, a link, an image. The Clipboard contract and the guest's Pasteboard |
yes |
RuntimeClipboard |
HostClipboard: the clipboard contract over a host's own clipboard, with image files |
host |
DynamicText |
Text the host holds and the user edits: a file in an editor, a message. The TextStorage contract, the guest's TextBuffer, and the TextEditor view |
yes |
RuntimeText |
HostTextStorage: the text contract over a host's own text views, with files, encodings, line endings and search |
host |
DynamicFonts |
The platform's fonts, for a guest that draws text itself: glyphs, shaped lines, glyph images and outlines. The FontFace contract and the guest's Typeface |
yes |
RuntimeFonts |
HostFontFace: the fonts contract over a host's font engine, with the bundle's Fonts folder |
host |
DynamicBackgroundTasks |
Running while the app isn't in front: tasks the system starts from time to time, and time to finish something. The BackgroundTasks contract and the guest's BackgroundTaskScheduler |
yes |
RuntimeBackgroundTasks |
HostBackgroundTasks: the background contract over a host's own scheduler |
host |
DynamicNotifications |
Notifications the system shows for the app, now or scheduled, with buttons, and pushes from the app's server: the Notifications and PushNotifications contracts and the guest's UserNotificationCenter |
yes |
RuntimeNotifications |
HostNotifications: the notification contracts over a host's own notification centre |
host |
DynamicDocuments |
The user's files, through the platform's pickers: the Documents contract, the guest's DocumentPicker, Document and ContentType, and SwiftUI's fileImporter and fileExporter. A picked file is a directory DynamicFiles reaches |
yes |
RuntimeDocuments |
HostDocuments: the documents contracts over a host's own pickers, granting each pick in HostFiles |
host |
DynamicDefaults |
Small settings kept across launches: the Defaults contract, the guest's UserDefaults and @AppStorage. RuntimeHost has HostDefaults, with a file-backed store |
yes |
DynamicCoreModel |
A model store behind CoreModel: the ModelStore contracts, and for the guest RuntimeModelStorage, FetchedResults and Query |
yes |
RuntimeCoreModel |
HostModelStore: the model store's contracts over any CoreModel backend, for hosts written in Swift |
host |
RuntimeFormatting |
HostFormattingModule: the formatting contracts (LocaleInfo, NumberFormat, DateFormat), the system's clock, calendars, time zones and string comparison over Swift Foundation, for hosts written in Swift on Apple platforms and Linux |
host |
RuntimeNetworking |
HostNetworkingModule: the networking contracts (HTTPSession, HTTPTask, HTTPRequest, URL and the rest) over Swift Foundation's URLSession, for hosts written in Swift on Apple platforms and Linux |
host |
DynamicWebKit |
Web views (WebKit in guest builds): the WebContent contract, the observable WebPage, WebsiteDataStore, WebDownload, and the WebView view |
yes |
DynamicMapKit |
Maps the host draws (MapKit in guest builds): the Maps contract, MapProvider, and SwiftUI's Map with markers, annotations, lines, areas and where the user is |
yes |
RuntimeMaps |
HostMaps: the maps contract over the service a host is built with |
host |
DynamicDrawing |
2D drawing: images the host decodes (Image(contentsOf:), Image(data:), Image(pixels:width:height:scale:)), and Canvas, GraphicsContext, BitmapContext, Path, shapes of an app's own and fonts measured, recorded in the guest and replayed by the host |
yes |
RuntimeDrawing |
HostImages: the image contract over a host's decoder |
host |
CGLES2 |
gles2.h: OpenGL ES 2.0 under WebGL 1 rules, as a guest calls it. Generated by Scripts/gles2.py |
C, freestanding |
DynamicGraphics |
The Surface a guest draws on, its frames and pointer and key input |
yes |
CRuntimeGL |
The wasm engines' side of a guest's GL imports: bounds checks and the WebGL buffer rules. Generated by Scripts/gles2.py |
host, C |
AppRuntime, bundle-runtime, CBundleRuntime |
Linux bundle model, launcher and sandbox | Linux |
import DynamicRuntime
@DynamicRuntime("org.pureswift.bluetooth.Central", requires: .bluetooth)
public protocol BluetoothCentral: AnyObject {
static func make(_ delegate: BluetoothCentralDelegate) -> Self
func state() -> Int32
func scan(services: [String], allowDuplicates: Bool)
}The macro generates BluetoothCentralProxy (calls through rt_call), the descriptor
and an rt.contracts record, plus adapters that export a Swift
implementation to the runtime. Guest code uses BluetoothCentralProxy.make(delegate);
a Swift host registers BluetoothCentralProxy.register(MyCentral.self, in: registrar).
An app exports one entry point and no main. Runtime.main runs the async
work it starts before returning to the host:
@_expose(wasm, "rt_main")
@c(rt_main)
public func appMain() -> rt_status {
Runtime.main { App.start() }
}Async code runs on the guest executor: tasks run before each call from the
host returns, and RuntimeClock.sleep(nanoseconds:) stands in for
Task.sleep, which Embedded Swift doesn't have.
Every host also provides the built-in Permissions, Bundle (AppBundle in
Swift) and Application contracts: one way to ask for any capability, the
app's metadata and localized strings, and its lifecycle and incoming URLs.
let greeting = try AppBundleProxy.localizedString("greeting", table: nil) ?? "Hello"
if try PermissionsProxy.status(.location) == PermissionStatus.notDetermined.rawValue {
try PermissionsProxy.request(.location, delegate: permissionsDelegate)
}
let application = try ApplicationProxy.make(lifecycleDelegate)Each provider contract also has async wrappers for guest code, such as
AsyncCentral, AsyncLocationManager and HTTPSession.data(for:). Event
sequences are EventStreams, which stop the native work when released:
let central = AsyncCentral()
guard await central.requestAuthorization() == .allowed else { return }
for try await result in central.scan(services: [.bit16(0x180D)]) {
let peripheral = try await central.connect(result.peripheral)
// …
}Guests write SwiftUI. import SwiftUI and import Observation give guest
builds the Embedded frontend and the Observation stopgap. The frontend does
no layout or rendering: it sends the host's renderer a render IR tree, and
then only what changes (Documentation/RenderIR.md).
@Observable
final class Store {
var name: String = "World"
}
struct ContentView: View {
@Bindable var store: Store
var body: some View {
VStack {
Text("Hello, \(store.name)!")
TextField("Name", text: $store.name)
}
}
}
struct ExampleApp: App {
let store = Store()
var body: some Scene {
WindowGroup { ContentView(store: store) }
}
}
@_expose(wasm, "rt_main")
@c(rt_main)
public func appMain() -> rt_status {
Runtime.main { ExampleApp.run() }
}examples/ExampleUI is a fuller app. Its sheet's System tab opens a URL,
has a link the app handles itself, shows the URL the app was opened with
and its scene phase, and keeps the screen awake
(Application). Its Card tab has
a card the user drags and holds to pin; it has a Fruit menu, shortcuts on
its buttons, and detents on its sheet
(Input). The Darwin host's
SwiftUI player renders the IR on iOS and macOS (DarwinAppRuntime's
DarwinUI).
examples/ExampleNotes is folders, their notes and a note in a
NavigationSplitView, which the host collapses into a stack in a narrow
window (Environment values and split views).
It reads the window's size class and color scheme with
@Environment(.colorScheme), and the text size in each row, and its sheet
closes itself with dismiss. No host reports a window's values or draws a
split view yet, so the tests report them.
examples/ExampleGL draws with OpenGL ES 2.0 in a Surface placed by a
GLSurface view, and takes pointer and key input
(Graphics). The Darwin host runs it
on iOS and macOS (DarwinAppRuntime's DarwinGraphics), and
Scripts/test-gl-mesa.sh draws it on Mesa in Docker and checks the pixels.
examples/ExampleFiles is a notebook kept as text files: it reads its
bundle, and saves, lists, opens and deletes notes with the guest's
FileManager (Files). The Darwin host
runs it on iOS and macOS (DarwinAppRuntime's DarwinFiles).
examples/ExampleMedia is a small music player: it reads its songs'
titles, artists and covers from their tags, plays them one after another,
says what's playing so the system can show it, answers next and previous,
plays on in the background, and offers its video's subtitles
(Media players,
Now playing,
Media files). The Darwin host
plays it on iOS and macOS (DarwinAppRuntime's DarwinMedia); in the
tests, players kept in memory stand in.
examples/ExampleText is a small editor: it loads a text from its bundle
into a buffer the host holds, says where the caret is, finds and replaces,
undoes and saves (Text editing).
The Darwin host shows it in a UITextView or NSTextView
(DarwinAppRuntime's DarwinText); in the tests, the test types into texts
kept in memory.
examples/ExampleClipboard copies a sum, a link and its logo, says what
there is to paste without reading it, and pastes text, a link and an image
(Clipboard). The Darwin host copies
and pastes through the system's pasteboard (DarwinAppRuntime's
DarwinClipboard); in the tests, the test keeps one.
examples/ExampleSignIn is an account with a provider: it shows the
provider's page in the system's browser, checks the reply, and keeps the
token in the keychain (Secrets and sign-in).
The Darwin host keeps it in the Keychain and shows the page with
ASWebAuthenticationSession (DarwinAppRuntime's DarwinSecrets and
DarwinAuthentication); in the tests, the test plays both.
examples/ExampleCalendar is a month's agenda: it lists each occurrence
of what's on, adds a weekly meeting, moves one occurrence and cancels the
rest (Calendar events). No host
has a calendar store behind it yet, so the tests keep the events in
memory.
examples/ExampleContacts is an address book: it lists everyone, finds
people as a name is typed, and adds, changes and removes someone
(Contacts). No host has an address
book behind it yet, so the tests keep the people in memory.
examples/ExampleTransfers is a list of downloads: it starts them, pauses
and resumes them, cancels and removes them, and finds at launch the ones
that finished while it was closed (Transfers).
The host moves every byte and puts a download in place only when it's
whole. No host carries one on after the app closes yet, so the tests play
the system.
examples/ExampleMaps is places on a map and in a list, picked in
either, with a walk between them, where the user is, and pins dropped
with a long press (Maps). The host draws
the map with the platform's own. No host draws one yet, so the tests stand
in for it.
examples/ExampleImages shows a picture fitted in a scroll view that
zooms, with its size and the scale beneath, a thumbnail and a swatch it
makes from pixels, and opens an image the user picks instead
(Drawing). The host reads and
decodes each file for the size it's drawn at. No host decodes one yet, so
the tests' decoder reads the headers.
examples/ExampleDrawing draws a gauge in a Canvas, a bar chart whose
labels are measured to fit, and a star that's a Shape of its own, and
draws a badge off screen into a bitmap, which it shows and saves as a PNG
(Drawing). No host draws a canvas
yet; in the tests, a recorder stands in.
examples/ExamplePhotos is a gallery: it shows the user's newest photos
in a grid a page at a time, lists the albums, shows a photo large, opens
its original as a file and deletes it with the user's leave
(Photo library). The host draws
every photo. No host has a photo library behind it yet, so the tests keep
one in memory.
examples/ExampleCamera is a viewfinder: it shows what the camera sees,
takes a photo, records a video with sound, zooms, switches cameras, and
saves what it took to the user's photos
(Camera). No host has a camera
behind it yet, so the tests stand in for one.
examples/ExampleBackground is a feed that keeps itself fresh: it
registers a task the system may run while the app is closed, asks for it
every quarter of an hour, and asks for time to finish a save
(Background tasks). The
Darwin host schedules its task and holds the app for the save on iOS and
macOS (DarwinAppRuntime's DarwinBackgroundTasks); in the tests, the
test runs its task as the system would.
examples/ExampleNotifications is a set of kitchen timers: it asks the
user's leave, schedules a notification for when each timer ends, answers
the notification's buttons, and registers for pushes
(Notifications). The Darwin
host shows its notifications on iOS and macOS (DarwinAppRuntime's
DarwinNotifications); in the tests, it runs against a centre kept in
memory.
examples/ExampleDocuments is a small text editor for the user's own
files: it opens one with fileImporter, or the one it's launched with,
saves back to it, saves a copy where the user says, lists a folder, and
takes a photo from the system's photo picker
(Documents). The Darwin host shows
the system's pickers for it on iOS and macOS (DarwinAppRuntime's
DarwinDocuments); in the tests, the test answers for the user.
examples/ExampleDefaults is a settings screen whose values survive a
relaunch, with @AppStorage
(Defaults). The Darwin host keeps
them in a UserDefaults suite of the app's own (DarwinAppRuntime's
DarwinDefaults).
examples/ExampleModel keeps to-dos in lists in a model store, written
against CoreModel, with Querys that keep the screen current
(Persistence). The Darwin host
keeps them in Core Data (DarwinAppRuntime's DarwinModelStore).
examples/ExampleWeb is a small browser around a WebView: guest code
says import WebKit, shows a WebPage, follows its title and progress,
decides its navigations and runs scripts in it
(Web views). It also has tabs, a
private tab, find and the find bar, downloads, a camera prompt, tab
pictures and a message page that loads nothing remote. The Darwin host
runs the page and its navigation over WKWebView on iOS and macOS
(DarwinAppRuntime's DarwinWebKit), and none of the browser features
yet.
The toolchain is pinned in .swift-version (Swift 6.4.2). Install it and
the matching wasm Swift SDK:
swiftly install 6.4.2
swift sdk install https://download.swift.org/swift-6.4.2-release/wasm-sdk/swift-6.4.2-RELEASE/swift-6.4.2-RELEASE_wasm.artifactbundle.tar.gz --checksum 83baca83553f8c443cda7b84800912e6e709c3acd2e7ebf277794ca5836c0da5swift build
swift testThe WasmKit engine's tests run from its own package:
cd Packages/RuntimeWasm
swift testScripts/guest.py compiles a package's guest library product for each
target, seals every native slice (§7.5), links App.wasm as a WASI reactor
and assembles the universal bundle a host consumes. It builds no host code.
Scripts/build-wasm.sh ExampleApp # wasm32
Scripts/build-ios.sh ExampleApp # iOS 6 armv7, iOS 13 arm64
Scripts/build-macos.sh ExampleApp # macOS 10.15, arm64 + x86_64
Scripts/build-tvos.sh ExampleApp # tvOS 13
Scripts/build-watchos.sh ExampleApp # watchOS 6 (arm64)
Scripts/build-visionos.sh ExampleApp # visionOS 1
Scripts/build-linux.sh ExampleApp # armv7, arm64, x86_64
Scripts/build-android.sh ExampleApp # armeabi-v7a, arm64-v8a, x86_64An app's manifest is Swift, like Package.swift
(examples/ExampleAppManifest/App.swift):
import AppManifest
let app = App(
id: "org.pureswift.example",
name: .localized("app.name"),
version: "1.0", build: 1,
languages: ["en", "es"],
product: "ExampleApp",
capabilities: [.bluetooth(usage: .localized("perm.bluetooth"))],
platforms: [.iOS("15.0"), .macOS("12.0"), .android(minSDK: 26, targetSDK: 35), .linux]
)Scripts/build-bundle.sh --manifest examples/ExampleAppManifest/App.swiftguest.py compiles the manifest with the AppManifest library and runs it
sandboxed. It checks the manifest against the app's contracts, its
resources/<language>.lproj/Manifest.strings and the slices' minimum OS
versions. It writes the portable Info.plist keys, and embeds the manifest
in every slice's rt.manifest section. Without a manifest, flags describe
the app:
Scripts/build-bundle.sh --product ExampleApp --id org.pureswift.example \
--name Example --version 1.0 --build 1 --capability bluetoothThe scripts' own tests:
python3 -m unittest discover -s Scripts -p 'test_*.py'Scripts/guest.py targets lists every target ID. Output goes to
.build/guest/<product>/.
The toolchain has no Embedded concurrency runtime for the arm64 ELF slices'
bare-metal triple, so linux-arm64 and android-arm64-v8a use the one for
aarch64-unknown-linux-gnu. arm64 Linux toolchains include it. Elsewhere,
copy it from the swift Docker image once per Swift version:
Scripts/fetch-embedded-linux.shWithout it, those two slices are built without concurrency.
RuntimeWasmTests (in Packages/RuntimeWasm) runs the example app's
App.wasm when it has been built (Scripts/build-wasm.sh ExampleApp), the
same app DynamicRuntimeTests runs as a native slice.
A host links the app's libapp.a next to its own Swift code. The slice
defines rt_dispatch and rt_finalize, so the host depends on AppRuntime
without the GuestExports trait, and binds its own DynamicRuntime to the
runtime directly:
.package(url: "https://github.com/PureSwift/AppRuntime.git", from: "…", traits: [])let native = NativeRuntime.shared
native.bindDirectly()
MyContractProxy.register(MyImplementation.self, in: native)
native.start(rt_main, dispatch: rt_dispatch, finalize: rt_finalize)The app's calls arrive through the rt_* C symbols; the host's proxies and
exports never use them. Packages/LinkedSlice tests this with the example
app's macOS slice:
Scripts/guest.py slice --product ExampleApp --target macos
cd Packages/LinkedSlice
swift testA Linux slice is libapp.so, not libapp.a, so a device installs an app
by copying files: it needs a runner, and no compiler or linker. The runner
loads the library and finds the three guest exports:
void *app = dlopen("lib/linux-arm64/libapp.so", RTLD_LAZY | RTLD_LOCAL);
rt_status (*app_main)(void) = dlsym(app, "rt_main");The library names no other library. The runner's process supplies what it
leaves undefined: the rt_* functions, which the runner exports
(-rdynamic), a few libc calls, and GLES 2.0 for an app that draws. So the
same file loads under glibc and musl, and a new runner needs no relink. It
binds every symbol as it loads, so a runner that lacks one refuses the app,
by name. Scripts/test-gl-mesa.sh loads ExampleGL this way; the rules
are in DynamicRuntime.md §7.5 and §7.6.
A host with no slice for its platform translates App.wasm to C with
WABT's wasm2c (brew install wabt). Scripts/wasm2c-shim.py adds the
import shim and a minimal WASI, and seals the result into a libapp.a that
a host links exactly like a slice:
Scripts/build-wasm.sh ExampleApp
Scripts/wasm2c-shim.py build --wasm .build/guest/ExampleApp/wasm32/App.wasm \
--output .build/guest/ExampleApp/wasm2c
cd Packages/LinkedSlice
APPRUNTIME_LINKED_ENGINE=wasm2c swift testAPPRUNTIME_LINKED_PRODUCT=ExampleUI runs the example UI app instead,
either way, ExampleFiles the notebook, with real files in a temporary
directory, ExampleDocuments the text editor, with the test answering its
pickers, ExampleNotifications the timers, with the test keeping the
notification centre, ExampleBackground the feed, with the test running
its task, ExampleMedia the music player, with the test standing in for
the players, ExampleText the editor, with the test typing into its
texts, ExampleClipboard the copying and pasting, with the test keeping
the clipboard, ExampleSignIn the account, with the test playing the
browser, ExampleCalendar the agenda, with its events in memory,
ExampleContacts the address book, with its people in memory,
ExampleTransfers the downloads, with the test playing the server and the
system, ExamplePhotos the gallery, with its library in memory, ExampleCamera
the viewfinder, with the test standing in for the cameras, ExampleDefaults the settings screen, with a real settings
file, ExampleModel the to-dos, with CoreModel's in-memory store,
ExampleWeb the browser, with the test standing in for the
engine, and ExampleGL the one that draws, against a GL that writes down
what it's asked.
For Linux, slice makes libapp.so, the slice a runner loads, for a
bundle with no native slice for an architecture, and adds it to the bundle:
Scripts/wasm2c-shim.py slice --bundle org.example.app --target linux-arm64It's compiled freestanding with the Swift toolchain, like a native slice, so it names no library and loads under any libc.
Scripts/wasm2c-shim.py sources stops before compiling and gathers the C
files, for a build with another toolchain. A module that draws gets the GL
shim too, and its host then defines rt_gl_context_generation
(Graphics).
bundle-runtime resolves a bundle, selects an architecture and launches it
inside a namespace sandbox. See Sandbox. The
bundle format it implements predates the
universal bundle of the new design (§7.5) and will move to it.
bundle-runtime com.example.myapp # by identifier
bundle-runtime /path/to/bundle.app # by pathUse CMake to cross-compile and install the launcher and libAppRuntime.so
for a target system (the Swift language requires the Ninja generator):
cmake -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=cmake/linux.toolchain.cmake \
-DAPPRUNTIME_ARCH=arm64 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usrcmake --build build && DESTDIR=/path/to/rootfs cmake --install build| Option | Default | Meaning |
|---|---|---|
APPRUNTIME_ARCH |
arm64 |
Target: arm64, x86_64, armv7, i386 |
APPRUNTIME_SYSROOT |
Swift SDK sysroot for the arch | Override the target sysroot |
APPRUNTIME_TOOLCHAIN_BIN |
~/.swiftly/bin |
Directory holding clang/swiftc |
APPRUNTIME_BUILD_LAUNCHER |
ON |
Build bundle-runtime (Linux only) |
BUILD_SHARED_LIBS |
ON |
Build the library shared rather than static |
examples/ also holds build scripts that package Celeste Classic
(ccleste) and Nanosaur 2 as port bundles.