Skip to content

[WIP] Google VR SDK Support #1370

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

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8110d8d
0.0.521
chrislatorres Apr 21, 2019
909923a
change build.gradle to be oculusmobile specific
chrislatorres Apr 21, 2019
7dbacb9
specify build gradle file name for oculus mobile
chrislatorres Apr 21, 2019
031da13
add googlevr build.gradle
chrislatorres Apr 21, 2019
801e034
change name for oculus mobile CMakeLists
chrislatorres Apr 21, 2019
c4490c5
change name for oculus mobile module build.gradle
chrislatorres Apr 21, 2019
45e52c7
add googlevr cmakelists
chrislatorres Apr 21, 2019
d750379
add googlevr module build.gradle
chrislatorres Apr 21, 2019
4cb6344
rename oculus mobile android manifest
chrislatorres Apr 21, 2019
e36ffe2
add googlevr android manifest
chrislatorres Apr 21, 2019
b4e3e5b
add gvr libs to cmakelists
chrislatorres Apr 21, 2019
28894fb
differentiate apk name for oculusmobile
chrislatorres Apr 21, 2019
3504e77
Delete package.json
chrislatorres Apr 22, 2019
a4eaa52
Revert "Delete package.json"
chrislatorres Apr 22, 2019
90cc862
add native-googlevr-deps to package.json
chrislatorres Apr 22, 2019
fc1b52b
add googlevr to binding.gyp
chrislatorres Apr 22, 2019
54341f8
add googlevr build script
chrislatorres Apr 22, 2019
ce93d54
differentiate build oculusmobile script
chrislatorres Apr 22, 2019
b7e784f
move oboe directory to deps/android
chrislatorres Apr 22, 2019
9c818eb
add GOOGLEVR define to build script
chrislatorres Apr 22, 2019
6db6c4c
add OCULUSMOBILE define to oculus mobile build script
chrislatorres Apr 22, 2019
c717f44
update oboe deps path in binding.gyp
chrislatorres Apr 22, 2019
028b15c
update oculusmobile specific ifdefs in exokit.cpp
chrislatorres Apr 22, 2019
b6b15e4
add googlevr.h
chrislatorres Apr 22, 2019
2f55d92
add googlevr-math.h
chrislatorres Apr 22, 2019
94c01ec
add googlevr-context.h
chrislatorres Apr 22, 2019
1b3733b
add googlevr-math.cpp
chrislatorres Apr 22, 2019
d8dc0d0
add googlevr.cpp
chrislatorres Apr 22, 2019
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ matrix:
- docker pull debian:latest
install:
- docker build -f android.Dockerfile -t exokit .
- docker run exokit cat exokit.apk >exokit.apk
- docker run exokit cat exokit.apk >exokit-oculusmobile.apk
script:
- echo "skipping 'npm run test' outside of docker"
deploy:
Expand Down
15 changes: 8 additions & 7 deletions android/app/build.gradle → android/app/googlevr-build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
externalNativeBuild {
cmake {
// version '3.10.2'
path '../CMakeLists.txt'
path '../googlevr-CMakeLists.txt'
}
}
lintOptions {
Expand All @@ -45,13 +45,14 @@ android {
}


/* dependencies {
implementation 'com.google.vr:sdk-base:1.190.0'
dependencies {
// Adds Google VR spatial audio support
compile 'com.google.vr:sdk-audio:1.160.0'

// Required for all Google VR apps
compile 'com.google.vr:sdk-base:1.160.0'
}

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
implementation 'de.javagl:obj:0.2.1'
} */

android {
sourceSets {
Expand Down
54 changes: 54 additions & 0 deletions android/app/oculusmobile-build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
// Sceneform libraries use language constructs from Java 8.
// Add these compile options if targeting minSdkVersion < 26.
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}


defaultConfig {
applicationId = 'com.webmr.exokit'
minSdkVersion 21
targetSdkVersion 21
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
cppFlags "-std=c++11"
}
}
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your APK.
abiFilters 'arm64-v8a'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
// version '3.10.2'
path '../oculusmobile-CMakeLists.txt'
}
}
lintOptions {
abortOnError false
}
}

android {
sourceSets {
main {
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['assets/node_modules/native-oculus-mobile-deps/lib/android']
}
}
}
77 changes: 77 additions & 0 deletions android/app/src/main/googlevr-AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.webmr.exokit"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<!-- The GVR SDK requires API 19+ and OpenGL ES 2+. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />

<!-- Required for vibration feedback when the trigger action is performed. -->
<uses-permission android:name="android.permission.VIBRATE"/>
<!-- Required to read the paired viewer's distortion parameters. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<!-- Make accelerometer and gyroscope hard requirements for good head tracking. -->
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/>
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/>

<!-- Indicates use of Android's VR-mode, available only on Android N+. -->
<uses-feature android:name="android.software.vr.mode" android:required="false"/>
<!-- Indicates use of VR features that are available only on Daydream-ready devices. -->
<uses-feature android:name="android.hardware.vr.high_performance" android:required="false"/>

<!-- Indicates that head tracking should be done in 6DoF, if available -->
<uses-feature
android:name="android.hardware.vr.headtracking"
android:version="1"
android:required="false"/>

<!-- This .apk has no Java code itself, so set hasCode to false. -->
<application
android:allowBackup="false"
android:label="Exokit"
android:hasCode="false">

<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>

<!-- Our activity is the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="android.app.NativeActivity"
android:label="Exokit"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize|uiMode|navigation|density"
android:enableVrMode="@string/gvr_vr_mode_component"
android:resizeableActivity="false">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="native-main" />
<!-- <meta-data android:name="android.app.func_name"
android:value="main" /> -->
<!-- The VR icon to be used in Daydream Home comes in two parts:
a foreground icon and a background icon. -->
<meta-data android:name="com.google.android.vr.icon"
android:resource="@drawable/hello_vr_icon_front" />
<meta-data android:name="com.google.android.vr.icon_background"
android:resource="@drawable/hello_vr_icon_back" />

<!-- Intent filter that enables this app to be launched from the
Daydream Home menu. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="com.google.intent.category.DAYDREAM"/>
</intent-filter>
<!-- Intent filter that enables this app to be launched from the
Cardboard app and from the traditional launcher. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="com.google.intent.category.CARDBOARD" />
</intent-filter>
</activity>
</application>
</manifest>
67 changes: 67 additions & 0 deletions android/googlevr-CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.6.0)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -Werror")
add_library(native-main SHARED ${CMAKE_SOURCE_DIR}/../main.cpp ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)

include_directories( SYSTEM ${CMAKE_SOURCE_DIR}/../node_modules/nan )
include_directories( SYSTEM ${CMAKE_SOURCE_DIR}/../deps/exokit-bindings/util/include )
include_directories( SYSTEM ${CMAKE_SOURCE_DIR}/../.node-gyp/11.6.0/include/node )
include_directories( SYSTEM ${CMAKE_SOURCE_DIR}/../build/libexokit )
include_directories( SYSTEM ${ANDROID_NDK}/sources/android/native_app_glue )

add_library( exokit STATIC IMPORTED )
set_target_properties( exokit PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../build/libexokit/libexokit.a )

add_library( node STATIC IMPORTED )
set_target_properties( node PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/libnode.a-android/libnode.a )

add_library( skia STATIC IMPORTED )
set_target_properties( skia PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-canvas-deps/lib2/magicleap/libskia.a )

add_library( labsound STATIC IMPORTED )
set_target_properties( labsound PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-audio-deps/lib2/magicleap/libLabSound.a )

add_library( avformat STATIC IMPORTED )
set_target_properties( avformat PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libavformat.a )
add_library( avcodec STATIC IMPORTED )
set_target_properties( avcodec PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libavcodec.a )
add_library( avutil STATIC IMPORTED )
set_target_properties( avutil PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libavutil.a )
add_library( avdevice STATIC IMPORTED )
set_target_properties( avdevice PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libavdevice.a )
add_library( swscale STATIC IMPORTED )
set_target_properties( swscale PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libswscale.a )
add_library( swresample STATIC IMPORTED )
set_target_properties( swresample PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libswresample.a )
add_library( opus STATIC IMPORTED )
set_target_properties( opus PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-video-deps/lib2/magicleap/libopus.a )

add_library( webrtc STATIC IMPORTED )
set_target_properties( webrtc PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-webrtc-deps/lib2/magicleap/libwebrtc.a )

add_library( gvr-lib SHARED IMPORTED )
set_target_properties( gvr-lib PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-googlevr-deps/lib/android/arm64-v8a/libgvr.so )
add_library( gvraudio-lib SHARED IMPORTED )
set_target_properties( gvraudio-lib PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../node_modules/native-googlevr-deps/lib/android/arm64-v8a/libgvr_audio.so )

target_link_libraries(native-main
android
log
EGL
GLESv2
exokit
node
skia
labsound
avformat
avcodec
avutil
avdevice
swscale
swresample
opus
webrtc
OpenSLES
gvr-lib
gvraudio-lib
)
31 changes: 31 additions & 0 deletions android/googlevr-build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}

allprojects {
repositories {
google()
jcenter()
maven {
// For Android support library components.
url "https://maven.google.com"
}
// You can also use a local Maven repository if desired.
mavenLocal()
}
dependencies {
// The Google VR SDK requires version 2.3.3 or higher.
classpath 'com.android.tools.build:gradle:3.3.2'

// The Google VR NDK requires experimental version 0.9.3 or higher.
// classpath 'com.android.tools.build:gradle-experimental:0.9.3'
}

}
File renamed without changes.
1 change: 0 additions & 1 deletion android/build.gradle → android/oculusmobile-build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ allprojects {
mavenLocal()
}
}

Loading