A cool experiment to create a Rust UI using JSX
git clone https://github.com/nmpribeiro/ruinx.git
[cargo run] command also builds :)
cargo build
cargo run
rustup target add aarch64-apple-ios x86_64-apple-ios
Install cargo-lipo
cargo install cargo-lipo
Build Xcode project
./ios.sh
And answer the question "do you want a release? (yes/no)"
- Open generated xcodeproject
- Set signing team
- Select target device
- Click Run button
Open xcode, open the project and build.
Exact commands and pathes may depend on the host OS. Here linux commands are used, but on all the other OSes the idea should be very similar.
This step highly depends on the OS, for ubuntu:
sudo apt-get install openjdk-8-jdk
Assuming rustup's rust installation:
rustup target add armv7-linux-androideabi
rustup target add aarch64-linux-android
rustup target add i686-linux-android
rustup target add x86_64-linux-android
Create a folder for all the android pre-requisites stuff
mkdir /this/may/be/any/path/android
cd android
wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip -q sdk-tools-linux-4333796.zip
rm sdk-tools-linux-4333796.zip
tools/bind/sdkmanager "platform-tools"
tools/bin/sdkmanager "platforms;android-29"
tools/bin/sdkmanager "build-tools;29.0.0"
tools/bin/sdkmanager --update
cd /path/from/previous/step/android
wget -q http://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
unzip -q android-ndk-r20-linux-x86_64.zip
rm android-ndk-r20-linux-x86_64.zip
For debug or build you can do `./android.sh -b` (-b or --build) or `./android.sh -r` (-r or --release).
export ANDROID_HOME=/path/from/previous/step/android
export NDK_HOME=/path/from/previous/step/android/android-ndk-r20
Here are my personal environment variables:
export ANDROID_SDK_ROOT=/Users/$USER/android
export NDK_HOME=$ANDROID_SDK_ROOT/android/android-ndk-r20/
Once you have my environmental variables, a bash script android.sh
was made for your convenience.
./android.sh -d
./android.sh -r
Head over to your android studio and run it. If you just want the apk, it will be in target/android-artifacts/debug/apk
or target/android-artifacts/release/apk
.
Use android project to check logs.
- - android - Fix android lost of surface on home & switching apps and going back to the app
I/rust-app: graphics::state: Resizing: 1080 x 2312
wgpu_core::device: configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Rgba8UnormSrgb, width: 1080, height: 2312, present_mode: Fifo }
E/vulkan: NATIVE_WINDOW_MAX_BUFFER_COUNT query failed: No such device (-19)
E/rust-app: wgpu_hal::vulkan::adapter: get_physical_device_surface_capabilities: ERROR_SURFACE_LOST_KHR
I/RustStdoutStderr: thread '<unnamed>' panicked at 'Error in Surface::configure: surface does not support the adapter's queue family', /Users/nmpribeiro/.cargo/git/checkouts/wgpu-53e70f8674b08dd4/9bc5908/wgpu/src/backend/direct.rs:197:9
- - android - Fix android scalling very different from desktop and iOS
- - Touch screens - Create a functional Touch/Tap event
- - Touch screens - Figure how to connect the Touch/Tap event with Conrad widgets
- - iOS - fix
ld: in ../target/universal/release/libruinx.a(ruinx.ruinx.54ed59ac-cgu.9.rcgu.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
when trying to profile - - UI - generate Conrod UI from internal UI structure
- - UI - generate internal UI structure (some DOM like) from RSX
Have a look at this cool exploration of rust scrtipting lang ecosystem as of 2021 here. We went for Dyon
- A bunch of cool resources about WebGPU in rust: Everything I know
[ ] - Latest version of winit
(both master and v0.25
) only works with ndk_glue
v0.3.0
. Other combinations have a bug where in android were we cannot aquire the surface properly. Issue here.