-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
1,922 additions
and
13,897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
[workspace] | ||
|
||
members = [ | ||
"android-ndk-sys", | ||
"android-ndk", | ||
"ndk", | ||
"ndk-build", | ||
"ndk-examples", | ||
"ndk-glue", | ||
"ndk-sys", | ||
"cargo-apk", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,62 @@ | ||
# `android-ndk`: Rust bindings of the Android NDK | ||
# Rust on Android | ||
|
||
[![Build Status](https://travis-ci.org/mb64/android-ndk-rs.svg?branch=master)](https://travis-ci.org/mb64/android-ndk-rs) | ||
[![Crates.io Status](https://meritbadge.herokuapp.com/android-ndk-sys)](https://crates.io/crates/android-ndk-sys) | ||
[![Docs.rs Status](https://docs.rs/android-ndk-sys/badge.svg)](https://docs.rs/android-ndk-sys) | ||
[![Crates.io Status](https://meritbadge.herokuapp.com/android-ndk)](https://crates.io/crates/android-ndk) | ||
[![Docs.rs Status](https://docs.rs/android-ndk/badge.svg)](https://docs.rs/android-ndk) | ||
- Raw FFI bindings to the NDK ![ndk-sys-docs][ndk-sys-badge] | ||
- Safe abstraction of the bindings ![ndk-docs][ndk-badge] | ||
- Startup code ![ndk-glue-docs][ndk-glue-badge] | ||
- Everything for building apk's ![ndk-build-docs][ndk-build-badge] | ||
- Build tool ![cargo-apk-docs][cargo-apk-badge] | ||
|
||
This is a work in progress at the moment. | ||
## Hello world | ||
`Cargo.toml` | ||
```toml | ||
[lib] | ||
crate-type = ["lib", "cdylib"] | ||
``` | ||
|
||
`android-ndk-sys` contains the raw FFI bindings, pre-generated from NDK r20, and `android-ndk` | ||
provides a safe API over it. | ||
`src/lib.rs` | ||
```rust | ||
#[cfg(target_os = "android")] | ||
ndk_glue::ndk_glue!(main); | ||
|
||
Other helpful crates for Android: | ||
pub fn main() { | ||
println!("hello world"); | ||
} | ||
``` | ||
|
||
* [`jni`](https://crates.io/crates/jni), JNI bindings for Rust | ||
* [`android_logger`](https://crates.io/crates/android_logger) and [`ndk-logger`](https://crates.io/crates/ndk-logger), | ||
Android backends for the `log` crate | ||
`src/main.rs` | ||
```rust | ||
fn main() { | ||
$crate::main(); | ||
} | ||
``` | ||
|
||
```sh | ||
cargo install cargo-apk | ||
cargo apk run | ||
``` | ||
|
||
## Logging and stdout | ||
Stdout is redirected to the android log api when using `ndk-glue`. Any logger that logs to | ||
stdout should therefore work. | ||
|
||
## JNI | ||
TODO: talk more about jni and add some examples | ||
|
||
- [`jni`](https://crates.io/crates/jni), JNI bindings for Rust | ||
|
||
## Winit and glutin | ||
TODO shameless plug | ||
|
||
## Flutter | ||
TODO shameless plug | ||
|
||
[ndk-sys-docs]: https://docs.rs/ndk-sys | ||
[ndk-sys-badge]: https://docs.rs/ndk-sys/badge.svg | ||
[ndk-docs]: https://docs.rs/ndk | ||
[ndk-badge]: https://docs.rs/ndk/badge.svg | ||
[ndk-glue-docs]: https://docs.rs/ndk-glue | ||
[ndk-badge]: https://docs.rs/ndk-glue/badge.svg | ||
[ndk-build-docs]: https://docs.rs/ndk-build | ||
[ndk-build-badge]: https://docs.rs/ndk-build/badge.svg | ||
[cargo-apk-docs]: https://docs.rs/cargo-apk | ||
[cargo-apk-badge]: https://docs.rs/cargo-apk/badge.svg |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.