Cross-platform gfx-hal example project
Gfx-hal quad example running on Windows, Linux, Mac, iOS, Android.
cd rust/game_desktop/
cargo run --features target
Where target
: mac
(Metal), linux
(Vulkan), pc_dx12
(DirectX 12) or pc_dx11
(DirectX 11).
- Install Rust iOS target:
rustup target add aarch64-apple-ios
- Install XcodeGen
cd
to theios
directory- Run XcodeGen
- Open project in Xcode
- Run example on device (with metal support)
cd ios/
xcodegen
- Install Rust Android targets:
rustup target add armv7-linux-androideabi
- Install cargo-apk:
cargo install --git https://github.com/rust-windowing/android-rs-glue.git cargo-apk
- Install the OpenJDK (1.8)
- Install the CMake
- Install Android SDK
- Install API level 24 support
- Install Android NDK 17c (why 17c? see issue)
- Install Gradle (4.6)
- Set the environment variables
JAVA_HOME
,NDK_HOME
,ANDROID_HOME
,GRADLE_HOME
. cd
to therust/game_android
directory- Run
cargo-apk build
- Install Vulkan validation layers:
cd
to theproject_root/target/android-artifacts
directorycp -fr $NDK_HOME/sources/third_party/vulkan/src/build-android/jniLibs/armeabi-v7a app/src/main/
- Run
gradle assembleDebug
- Run
gradle installDebug
- Run
adb logcat | grep RustAndroidGlueStdouterr
- Run example on connected device