Example setup for using xilem on android, iOS, and desktop
Note: may not work on the Apple iOS Simulator due to lack of capabilites *
rustup target add aarch64-apple-ios
open xilem_example_mobile.xcodeproj
# Configure signing
# Build
rustup target add aarch64-linux-android armv7-linux-androideabi
cargo install cargo-apk
cargo apk run -p xilem_example_mobile
Note: only tested on macOS but should work on other systems as well
cargo run --manifest-path=./desktop/Cargo.toml
- The android build uses cargo-apk
which, although it's deprecated, is the most stable way of building rust
projects into android apps. It's configured in
mobile/Cargo.toml
and calls theandroid_main
function from themobile
crate. - iOS also uses the
mobile
crate but compiles is a library(usingcdylib
) which is then called by an Objective-C file inios-src
. There's an XCode project inxilem_example_mobile.xcodeproj
that includes the required files and which callsbuild_rust_deps.sh
during build to compile the rust code. - There's a separate crate for the desktop build since cargo-apk fails if the mobile project contains a binary target. It's a normal cargo project
- The application logic is a separate project so that it can be imported by both the mobile and desktop crates. It's based on the xilem mason example.
The setup should work with winit directly and would only require removing xilem from the app crate and instead creating the event loop and window directly.