Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quest support #11

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/cd_android_gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: deploy android/quest apk to gh-pages
on:
workflow_run:
branches: [main]
workflows: [CI]
types: [completed]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-android

- run: mkdir dist
- run: cp target/x/release/android/osmeta.apk dist/osmeta.apk

- uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
keep_files: true
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,33 @@ jobs:
run: rustup component add rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check

android:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev lld llvm
- uses: actions/checkout@v4
- run: git submodule update --init
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-android
- uses: dtolnay/rust-toolchain@stable
- name: Add Android targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi
- name: Install cargo-binstall
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install xbuild
run: cargo binstall --git https://github.com/NiklasEi/xbuild --bin-dir x xbuild -y
- name: show deps
run: x doctor
- name: Build app bundle
run: x build --release --platform android --format apk --arch arm64
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "runtime_libs"]
path = runtime_libs
url = https://github.com/DerKarlos/OSMeta.git
branch = binaries
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Build for android

On windows hosts, install `llvm` (contains `clang`) from https://github.com/llvm/llvm-project/releases/

```
cargo install --git https://github.com/NiklasEi/xbuild
```

run `x doctor` to see what else you need to install for android, then run

```
x build --release --platform android --format apk --arch arm64
```
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "osmeta" # OSMeta ??? `#[warn(non_snake_case)]` on by default
name = "osmeta" # OSMeta ??? `#[warn(non_snake_case)]` on by default
version = "0.1.0"
edition = "2021"

links = "openxr_loader"
build = "build.rs"

# Enable a small amount of optimization in debug mode
[profile.dev]
Expand Down Expand Up @@ -36,3 +37,10 @@ default = ["xr"]
# path = "examples/test.rs"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html


# we need to split our crate into a lib and a binary, because android targets don't want a binary.
# our binary is now just a tiny dummy thing that invokes the library's main function.
[lib]
name = "osmeta"
crate-type = ["staticlib", "cdylib", "lib"]
6 changes: 6 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
println!("cargo:rerun-if-changed=build.rs");
if std::env::var("TARGET").unwrap() == "aarch64-linux-android" {
println!("cargo:rustc-link-search=runtime_libs/arm64-v8a");
}
}
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon.xcf
Binary file not shown.
27 changes: 27 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
android:
runtime_libs:
- "runtime_libs"
manifest:
package: "osm.eta.app"
application:
label: "OSMeta"
theme: "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
meta_data:
- name: "com.oculus.intent.category.VR"
value: "vr_only"
- name: "com.samsung.android.vr.application.mode"
value: "vr_only"
- name: "com.oculus.supportedDevices"
value: "quest|quest2|quest3|questpro"
activities:
- config_changes: "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
launch_mode: "singleTask"
orientation: "landscape"
intent_filters:
- actions:
- "android.intent.action.MAIN"
categories:
- "com.oculus.intent.category.VR"
- "android.intent.category.LAUNCHER"
sdk:
target_sdk_version: 32
1 change: 1 addition & 0 deletions runtime_libs
Submodule runtime_libs added at 84456e
3 changes: 3 additions & 0 deletions src/bin/demo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
osmeta::main();
}
3 changes: 2 additions & 1 deletion src/main.rs → src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ mod tilemap;
#[cfg(all(feature = "xr", not(target_os = "macos")))]
mod xr;

fn main() {
#[bevy_main]
pub fn main() {
let mut app = App::new();
if std::env::args().any(|arg| arg == "xr") {
#[cfg(all(feature = "xr", not(target_os = "macos")))]
Expand Down