Skip to content
Draft
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
1 change: 1 addition & 0 deletions code/mobile/android/PhoneVR/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/ALVR
/cardboard
/gvr-android-sdk-1.200
/arcore-android-sdk-main
/app/libraries
/app/libraries_gvr

Expand Down
10 changes: 9 additions & 1 deletion code/mobile/android/PhoneVR/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ add_library(native-lib-alvr SHARED
${LIB_SRC}
)

# Import the ARCore (Google Play Services for AR) library.
add_library(arcore SHARED IMPORTED)
set_target_properties(arcore PROPERTIES IMPORTED_LOCATION
${ARCORE_LIBPATH}/${ANDROID_ABI}/libarcore_sdk_c.so
INTERFACE_INCLUDE_DIRECTORIES ${ARCORE_INCLUDE}
)

set(libs_dir ${CMAKE_CURRENT_SOURCE_DIR}/libraries)
set(alvr_build_dir ${CMAKE_CURRENT_SOURCE_DIR}/../ALVR/build/alvr_client_core)

Expand All @@ -31,10 +38,11 @@ target_include_directories(native-lib-alvr
# ALVR Headers
PUBLIC ${alvr_build_dir}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../cardboard
PUBLIC ${ARCORE_INCLUDE}
)

target_link_libraries(native-lib-alvr
log android EGL GLESv3 mediandk
log android EGL GLESv3 mediandk arcore
${alvr_build_dir}/${ANDROID_ABI}/libalvr_client_core.so
${libs_dir}/jni/${ANDROID_ABI}/libGfxPluginCardboard.so
)
Expand Down
21 changes: 21 additions & 0 deletions code/mobile/android/PhoneVR/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ apply plugin: 'com.google.gms.google-services'
apply from: '../versioning.gradle'
apply plugin: "com.diffplug.spotless"

/*
The arcore aar library contains the native shared libraries. These are
extracted before building to a temporary directory.
*/
def arcore_libpath = "${rootProject.layout.buildDirectory.get()}/arcore-native"

// Create a configuration to mark which aars to extract .so files from
configurations { natives }

def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
Expand Down Expand Up @@ -50,6 +59,8 @@ android {
externalNativeBuild {
cmake {
cppFlags "-std=c++17 -fexceptions -frtti" //-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON"
arguments "-DARCORE_LIBPATH=${arcore_libpath}/jni",
"-DARCORE_INCLUDE=${project.rootDir}/arcore-android-sdk-main/libraries/include"
}
}

Expand Down Expand Up @@ -174,6 +185,9 @@ dependencies {
implementation 'androidx.camera:camera-lifecycle:1.3.4'
implementation 'androidx.camera:camera-camera2:1.3.4'

implementation 'com.google.ar:core:1.46.0'
natives 'com.google.ar:core:1.46.0'

def acraVersion = '5.7.0'
implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-dialog:$acraVersion"
Expand All @@ -199,6 +213,13 @@ task extractNdk(type: Copy) {
include "jni/**/libgvr.so"
}
}
configurations.natives.files.each { f ->
copy {
from zipTree(f)
into arcore_libpath
include "jni/**/*"
}
}
}

task deleteNdk(type: Delete) {
Expand Down
1 change: 0 additions & 1 deletion code/mobile/android/PhoneVR/app/src/gvr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -std=c++17 -g")
set(ANDROID_STL c++_static)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)


set(gvr_libs_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../libraries_gvr)
file(GLOB_RECURSE LIB_SRC
../../../../../../common/libs/ifaddrs/*.c
Expand Down
2 changes: 2 additions & 0 deletions code/mobile/android/PhoneVR/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar"
android:launchMode="singleTop" />

<meta-data android:name="com.google.ar.core" android:value="optional" />
</application>

</manifest>
Loading
Loading