/crossplatform_gfx_hal_example

Gfx-hal quad example running on Windows, Linux, Mac, iOS, Android

Primary LanguageRustApache License 2.0Apache-2.0

Cross-platform gfx-hal example project

Gfx-hal quad example running on Windows, Linux, Mac, iOS, Android.

Desktop (Windows, Linux, Mac)

cd rust/game_desktop/
cargo run --features target

Where target: mac (Metal), linux (Vulkan), pc_dx12 (DirectX 12) or pc_dx11 (DirectX 11).

iOS (Metal)

  1. Install Rust iOS target: rustup target add aarch64-apple-ios
  2. Install XcodeGen
  3. cd to the ios directory
  4. Run XcodeGen
  5. Open project in Xcode
  6. Run example on device (with metal support)
cd ios/
xcodegen

Android (Vulkan)

  1. Install Rust Android targets: rustup target add armv7-linux-androideabi
  2. Install cargo-apk: cargo install --git https://github.com/rust-windowing/android-rs-glue.git cargo-apk
  3. Install the OpenJDK (1.8)
  4. Install the CMake
  5. Install Android SDK
  6. Install API level 24 support
  7. Install Android NDK 17c (why 17c? see issue)
  8. Install Gradle (4.6)
  9. Set the environment variables JAVA_HOME, NDK_HOME, ANDROID_HOME, GRADLE_HOME.
  10. cd to the rust/game_android directory
  11. Run cargo-apk build
  12. Install Vulkan validation layers:
    1. cd to the project_root/target/android-artifacts directory
    2. cp -fr $NDK_HOME/sources/third_party/vulkan/src/build-android/jniLibs/armeabi-v7a app/src/main/
  13. Run gradle assembleDebug
  14. Run gradle installDebug
  15. Run adb logcat | grep RustAndroidGlueStdouterr
  16. Run example on connected device