build + android: update dependencies, update build script for v7 arch on Android, fix wgpu limits for old Android devices
This commit is contained in:
parent
19befded82
commit
f85f4c9ed7
4 changed files with 345 additions and 278 deletions
575
Cargo.lock
generated
575
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -35,10 +35,10 @@ openssl-sys = { version = "0.9.82", features = ["vendored"] }
|
|||
|
||||
## ui
|
||||
pollster = "0.3.0"
|
||||
wgpu = "0.16.0"
|
||||
wgpu = "0.16.1"
|
||||
wgpu-core = { version = "0.16.1", features = ["gles"] }
|
||||
egui = { version = "0.22.0", default-features = false }
|
||||
egui_extras = { version = "0.22.0" }
|
||||
eframe = { version = "0.22.0", features = [ "wgpu", "android-game-activity" ] }
|
||||
|
||||
## grin_servers
|
||||
futures = "0.3"
|
||||
|
@ -67,8 +67,10 @@ built = { version = "0.6.0", features = ["git2"]}
|
|||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||
env_logger = "0.10.0"
|
||||
winit = { version = "0.28" }
|
||||
eframe = { version = "0.22.0", features = [ "wgpu" ] }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
android_logger = "0.13.1"
|
||||
jni = "0.21.1"
|
||||
winit = { version = "0.28", features = [ "android-game-activity" ] }
|
||||
winit = { version = "0.28", features = [ "android-game-activity" ] }
|
||||
eframe = { version = "0.22.0", features = [ "wgpu", "android-game-activity" ] }
|
|
@ -1,20 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
usage="Usage: build_and_run.sh [type] [platform]\n - type: debug, release\n - platform: v7, v8"
|
||||
case $1 in
|
||||
debug|release)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: build_and_run.sh [type] where is type is 'debug' or 'release'" >&2
|
||||
printf "$usage"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
case $2 in
|
||||
v7|v8)
|
||||
;;
|
||||
*)
|
||||
printf "$usage"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# Setup release argument
|
||||
type=$1
|
||||
[[ ${type} == "release" ]] && release_param+=(--release)
|
||||
export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0" && cargo ndk -t arm64-v8a build ${release_param[@]}
|
||||
|
||||
# Setup platform argument
|
||||
[[ $2 == "v7" ]] && platform_param+=(armeabi-v7a)
|
||||
[[ $2 == "v8" ]] && platform_param+=(arm64-v8a)
|
||||
|
||||
# Setup platform path
|
||||
[[ $2 == "v7" ]] && platform_path+=(armv7-linux-androideabi)
|
||||
[[ $2 == "v8" ]] && platform_path+=(aarch64-linux-android)
|
||||
|
||||
export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0" \
|
||||
&& cargo ndk -t ${platform_param} build ${release_param[@]}
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
yes | cp -f target/aarch64-linux-android/${type}/libgrim.so app/src/main/jniLibs/arm64-v8a
|
||||
yes | cp -f target/${platform_path}/${type}/libgrim.so app/src/main/jniLibs/${platform_param}
|
||||
./gradlew clean
|
||||
./gradlew build
|
||||
#./gradlew installDebug
|
||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -15,6 +15,8 @@
|
|||
#[macro_use]
|
||||
extern crate rust_i18n;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
use winit::platform::android::activity::AndroidApp;
|
||||
|
||||
|
@ -52,6 +54,18 @@ fn android_main(app: AndroidApp) {
|
|||
|
||||
use winit::platform::android::EventLoopBuilderExtAndroid;
|
||||
let mut options = eframe::NativeOptions::default();
|
||||
// Use limits are guaranteed to be compatible with Android devices.
|
||||
options.wgpu_options.device_descriptor = Arc::new(|adapter| {
|
||||
let base_limits = wgpu::Limits::downlevel_webgl2_defaults();
|
||||
wgpu::DeviceDescriptor {
|
||||
label: Some("egui wgpu device"),
|
||||
features: wgpu::Features::default(),
|
||||
limits: wgpu::Limits {
|
||||
max_texture_dimension_2d: 8192,
|
||||
..base_limits
|
||||
},
|
||||
}
|
||||
});
|
||||
options.event_loop_builder = Some(Box::new(move |builder| {
|
||||
builder.with_android_app(app);
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue