Skip to content

Commit

Permalink
Merge pull request #35 from rib/pure-rust-native-activity
Browse files Browse the repository at this point in the history
Pure-Rust native activity backend
  • Loading branch information
rib committed Oct 11, 2022
2 parents b13a53f + c3d115f commit 0590bf6
Show file tree
Hide file tree
Showing 19 changed files with 2,216 additions and 40,997 deletions.
1 change: 1 addition & 0 deletions android-activity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.4] - 2022-09-20
### Changed
- *Breaking*: `input_events` callback now return whether an event was handled or not to allow for fallback handling ([#31](https://github.com/rib/android-activity/issues/31))
- The native-activity backend is now implemented in Rust only, without building on `android_native_app_glue.c` ([#35](https://github.com/rib/android-activity/pull/35))

## [0.3] - 2022-09-15
### Added
Expand Down
10 changes: 0 additions & 10 deletions android-activity/build.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#![allow(dead_code)]

fn build_glue_for_native_activity() {
cc::Build::new()
.include("native-activity-csrc")
.include("native-activity-csrc/native-activity/native_app_glue")
.file("native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.c")
.compile("libnative_app_glue.a");
}

fn build_glue_for_game_activity() {
cc::Build::new()
.cpp(true)
Expand Down Expand Up @@ -38,6 +30,4 @@ fn build_glue_for_game_activity() {
fn main() {
#[cfg(feature = "game-activity")]
build_glue_for_game_activity();
#[cfg(feature = "native-activity")]
build_glue_for_native_activity();
}
27 changes: 4 additions & 23 deletions android-activity/generate-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ while read ARCH && read TARGET ; do
--blocklist-item 'C?_?JNIEnv' \
--blocklist-item '_?JavaVM' \
--blocklist-item '_?j\w+' \
--blocklist-item 'size_t' \
--blocklist-item 'pthread_\w*' \
--blocklist-function 'pthread_\w' \
--blocklist-item 'ARect' \
--blocklist-item 'ALooper\w*' \
--blocklist-function 'ALooper\w*' \
--blocklist-item 'AAsset\w*' \
Expand All @@ -33,29 +37,6 @@ while read ARCH && read TARGET ; do
-Igame-activity-csrc \
--sysroot="$SYSROOT" --target=$TARGET

bindgen native-activity-ffi.h -o src/native_activity/ffi_$ARCH.rs \
--blocklist-item 'JNI\w+' \
--blocklist-item 'C?_?JNIEnv' \
--blocklist-item '_?JavaVM' \
--blocklist-item '_?j\w+' \
--blocklist-item 'ALooper\w*' \
--blocklist-function 'ALooper\w*' \
--blocklist-item 'AAsset\w*' \
--blocklist-item 'AAssetManager\w*' \
--blocklist-function 'AAssetManager\w*' \
--blocklist-item 'ANativeWindow\w*' \
--blocklist-function 'ANativeWindow\w*' \
--blocklist-item 'AConfiguration\w*' \
--blocklist-function 'AConfiguration\w*' \
--blocklist-function 'android_main' \
--blocklist-item 'AInputQueue\w*' \
--blocklist-function 'AInputQueue\w*' \
--blocklist-item 'GameActivity_onCreate' \
--blocklist-function 'GameActivity_onCreate_C' \
--newtype-enum '\w+_(result|status)_t' \
-- \
-Inative-activity-csrc \
--sysroot="$SYSROOT" --target=$TARGET
done << EOF
arm
arm-linux-androideabi
Expand Down
Loading

0 comments on commit 0590bf6

Please sign in to comment.