2 releases
| 0.1.1 | May 10, 2023 |
|---|---|
| 0.1.0 | May 8, 2023 |
#73 in Android
21 downloads per month
26KB
625 lines
cargo-sdl-apk
Build Android packages that use SDL.
This cargo tool aims to be for Rust SDL what cargo-apk is for Glutin, and cargo-quad-apk is for Miniquad. That is, a simple command to package up an APK and upload it to your phone and start it. The way it works internally is by automating the steps described in this article by Julian Heinken. I created it as a tool for my UI library Appy, but it can be used for other Rust SDL projects as well.
Basic usage
- Install with
cargo install cargo-sdl-apk. - Make sure you have the following:
- The SDL source, clone it from here. Make sure you have the
release-2.26.xbranch. - Java. Muse be jdk17 (doesn't work with jdk19).
- Android SDK with command line tools.
- Android NDK.
- The SDL source, clone it from here. Make sure you have the
- Set the environment variables:
ANDROID_HOMEpointing to the Android SDK.ANDROID_NDK_HOMEpointing to the Android NDK.SDLpointing to the SDL source dir.
- Run
cargo sdl-apk buildorcargo sdl-apk runfrom inside your SDL application crate. You can also usecargo sdl-apk run --example some_exampleto run a crate example, in a similar way as you would do with cargo.
Project setup
The entry point for your application must be called SDL_main and use the attribute #[no_mangle]. Here is
an example project. To build/run the
project, cd into it and run cargo sdl-apk build or cargo sdl-apk run.
Dependencies
~61MB
~1M SLoC