Skip to content

Commit 47c8c02

Browse files
committed
Add a minimal OpenXR Info example
1 parent 29bc50e commit 47c8c02

File tree

22 files changed

+661
-0
lines changed

22 files changed

+661
-0
lines changed

na-openxr-info/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
*.so
17+
18+
# Added by cargo
19+
20+
/target
21+
Cargo.lock

na-openxr-info/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

na-openxr-info/.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

na-openxr-info/.idea/gradle.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

na-openxr-info/.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

na-openxr-info/.idea/vcs.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

na-openxr-info/Cargo.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[package]
2+
name = "na-openxr-info"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
log = "0.4"
10+
openxr = { version = "0.16" }
11+
12+
[target.'cfg(not(target_os = "android"))'.dependencies]
13+
env_logger = "0.9"
14+
15+
[target.'cfg(target_os = "android")'.dependencies]
16+
android_logger = "0.11.0"
17+
android-activity = { path="../../android-activity", features = ["native-activity"] }
18+
19+
[patch.crates-io]
20+
# openxr 0.16 uses ndk-glue, but master uses ndk-context which is compatible with android-activity
21+
openxr = { git = "https://github.com/Ralith/openxrs" }
22+
23+
[features]
24+
default = [ "linked" ]
25+
26+
android = [ "openxr/linked" ]
27+
desktop = [ "linked", "openxr/static"]
28+
linked = []
29+
30+
[lib]
31+
name="main"
32+
crate_type=["cdylib"]
33+
34+
[[bin]]
35+
path="src/lib.rs"
36+
name="test-winit-wgpu"
37+
required-features = [ "desktop" ]

na-openxr-info/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a minimal OpenXR application that builds for desktop or
2+
Android and simply prints out extension information for the OpenXR
3+
library.
4+
5+
This is based on the [hello](https://github.com/Ralith/openxrs/blob/master/openxr/examples/hello.rs)
6+
example from the [openxrs](https://github.com/Ralith/openxrs) repo.
7+
8+
# Oculus Quest
9+
10+
To build for the Oculus Quest then you first need to download
11+
the Oculus OpenXR Mobile SDK from:
12+
https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/
13+
14+
unpack the zip file and then set the OVR_OPENXR_LIBDIR environment variable
15+
to point at the directory with libopenxr_loader.so
16+
17+
```
18+
export export OVR_OPENXR_LIBDIR="path/to/ovr_openxr_mobile_sdk_42.0/OpenXR/Libs/Android/arm64-v8a/Debug"
19+
export ANDROID_NDK_HOME="path/to/ndk"
20+
export ANDROID_HOME="path/to/sdk"
21+
22+
rustup target add aarch64-linux-android
23+
cargo install cargo-ndk
24+
25+
cargo ndk -t arm64-v8a -o app/src/main/jniLibs/ build --features=android
26+
./gradlew build
27+
./gradlew installDebug
28+
```
29+
30+
# Desktop
31+
32+
To build for PC you need to build with the "desktop" feature
33+
34+
`cargo run --features=desktop`

na-openxr-info/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

na-openxr-info/app/build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
compileSdk 31
7+
8+
defaultConfig {
9+
applicationId "co.realfit.naopenxrinfo"
10+
minSdk 24
11+
targetSdk 25
12+
compileSdkVersion 26
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
debug {
25+
minifyEnabled false
26+
//packagingOptions {
27+
// doNotStrip '**/*.so'
28+
//}
29+
//debuggable true
30+
}
31+
}
32+
compileOptions {
33+
sourceCompatibility JavaVersion.VERSION_1_8
34+
targetCompatibility JavaVersion.VERSION_1_8
35+
}
36+
}
37+
38+
dependencies {
39+
40+
41+
}
42+

0 commit comments

Comments
 (0)