|
| 1 | +# Built core extension libraries |
| 2 | + |
| 3 | +This document describes how builds of the PowerSync SQLite core extension are consumed in different PowerSync SDKs. |
| 4 | + |
| 5 | +## Native |
| 6 | + |
| 7 | +- [Native SDK](https://github.com/powersync-ja/powersync-native): Compiled from source (as a regular Rust dependency). |
| 8 | +- [Dart SDK](https://github.com/powersync-ja/powersync.dart/): Uses build hooks to link dynamic libraries attached to releases. |
| 9 | +- [Swift SDK](https://github.com/powersync-ja/powersync-swift): Uses an XCFramework via SwiftPM and this [intermediate repository](https://github.com/powersync-ja/powersync-sqlite-core-swift). |
| 10 | +- [Kotlin SDK](https://github.com/powersync-ja/powersync-kotlin): |
| 11 | + - On Android, we use cargo-ndk builds published to Maven Central (see the `android/` directory for more). |
| 12 | + - On the JVM, we download dynamic libraries attached to releases. |
| 13 | + - For Kotlin/Native: |
| 14 | + - Older versions only support Apple targets and expect a framework path to be present. Users are responsible for bundling the extension, |
| 15 | + we suggest a SwiftPM dependency through the intermediate repository. |
| 16 | + - We are migrating towards a setup where we can also support Linux and Windows by linking the core extension staticaly through cinterops. |
| 17 | +- [dotnet SDK](https://github.com/powersync-ja/powersync-dotnet): |
| 18 | + - On maui/Android, we download the Maven Central asset and extract individual libraries. |
| 19 | + - On maui/iOS and maui/macCatalyst: We use the XCFramework downloaded directly from GitHub releases. |
| 20 | + - On Desktop platforms, we download a dynamic library attached to releases. |
| 21 | +- [JavaScript SDKs](https://github.com/powersync-ja/powersync-js): |
| 22 | + - Capacitor: Same as React Native. |
| 23 | + - Node: Downloads dynamic libraries attached to releases. We also upload these libraries to npm as part of the package to avoid postinstall scripts. |
| 24 | + - React Native: |
| 25 | + - Android: Gradle dependency to builds published to Maven Central. |
| 26 | + - iOS: We use a CocoaPod dependency downloading the XCFramework. |
| 27 | + - Tauri: Depends on the native SDK, building the core extension from source as part of the app. |
| 28 | + |
| 29 | +## Web |
| 30 | + |
| 31 | +- Dart: We build the core extension as a static [WebAssembly object file](https://github.com/WebAssembly/tool-conventions/blob/main/Linking.md). |
| 32 | + A script in the Dart SDK builds `sqlite3.wasm` and `sqlite3mc.wasm` by linking this file and patching `sqlite3_os_init` to auto-load the extension. |
| 33 | +- JavaScript: We have a fork of `wa-sqlite` that statically links the core extension object file and exports `powersync_init_static`. |
| 34 | + The web SDK calls `powersync_init_static` before connections are opened. |
| 35 | + We also build the core extension for [Emscripten dynamic linking](https://emscripten.org/docs/compiling/Dynamic-Linking.html), but this mode is not currently used. |
0 commit comments