mirror of https://github.com/bjornbytes/lovr.git
Universal APK for Oculus, Pico and Generic loaders
This commit is contained in:
parent
f3837d99fd
commit
ac012d39c2
|
@ -62,7 +62,6 @@ if(EMSCRIPTEN)
|
|||
elseif(MSVC)
|
||||
add_compile_options(/MP)
|
||||
elseif(ANDROID)
|
||||
set(ANDROID_FLAVOR "oculus" CACHE STRING "Which Android flavor to build (oculus, pico or generic)")
|
||||
find_package(Java REQUIRED)
|
||||
set(LOVR_USE_DESKTOP OFF)
|
||||
if(LOVR_BUILD_EXE)
|
||||
|
@ -207,23 +206,7 @@ endif()
|
|||
# OpenXR
|
||||
if(LOVR_ENABLE_HEADSET AND LOVR_USE_OPENXR)
|
||||
include_directories(deps/openxr/include)
|
||||
if(ANDROID)
|
||||
add_library(openxr_loader SHARED IMPORTED)
|
||||
set(LOVR_OPENXR openxr_loader)
|
||||
if(ANDROID_FLAVOR STREQUAL "oculus")
|
||||
set(LOVR_OPENXR_OCULUS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/oculus-openxr" CACHE STRING "The path to the Oculus OpenXR loader")
|
||||
set_target_properties(openxr_loader PROPERTIES IMPORTED_LOCATION "${LOVR_OPENXR_OCULUS_PATH}/Libs/Android/${ANDROID_ABI}/Release/libopenxr_loader.so")
|
||||
elseif(ANDROID_FLAVOR STREQUAL "pico")
|
||||
set(LOVR_OPENXR_PICO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/pico-openxr" CACHE STRING "The path to the Pico OpenXR loader")
|
||||
set_target_properties(openxr_loader PROPERTIES IMPORTED_LOCATION "${LOVR_OPENXR_PICO_PATH}/Libs/Android/${ANDROID_ABI}/libopenxr_loader.so")
|
||||
elseif(ANDROID_FLAVOR STREQUAL "generic")
|
||||
set(LOVR_OPENXR_GENERIC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/generic-openxr" CACHE STRING "The path to the Generic OpenXR loader")
|
||||
set_target_properties(openxr_loader PROPERTIES IMPORTED_LOCATION "${LOVR_OPENXR_GENERIC_PATH}/Libs/Android/${ANDROID_ABI}/libopenxr_loader.so")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported Android flavor (expected: oculus, pico or generic)")
|
||||
endif()
|
||||
else()
|
||||
if(LOVR_SYSTEM_OPENXR)
|
||||
if(LOVR_SYSTEM_OPENXR AND NOT ANDROID)
|
||||
pkg_search_module(OPENXR openxr)
|
||||
if(NOT OPENXR_FOUND)
|
||||
message(FATAL_ERROR "OpenXR not found.")
|
||||
|
@ -235,7 +218,6 @@ if(LOVR_ENABLE_HEADSET AND LOVR_USE_OPENXR)
|
|||
add_subdirectory(deps/openxr openxr)
|
||||
set(LOVR_OPENXR openxr_loader)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# pthreads
|
||||
|
@ -759,7 +741,7 @@ elseif(ANDROID)
|
|||
if(LOVR_BUILD_EXE)
|
||||
set(ANDROID_JAR "${ANDROID_SDK}/platforms/${ANDROID_PLATFORM}/android.jar")
|
||||
set(ANDROID_TOOLS "${ANDROID_SDK}/build-tools/${ANDROID_BUILD_TOOLS_VERSION}")
|
||||
set(ANDROID_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/etc/AndroidManifest_${ANDROID_FLAVOR}.xml" CACHE STRING "The AndroidManifest.xml file to use")
|
||||
set(ANDROID_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/etc/AndroidManifest.xml" CACHE STRING "The AndroidManifest.xml file to use")
|
||||
|
||||
# If assets are included in the apk then add '-A assets' to aapt, otherwise don't add any flags
|
||||
if(ANDROID_ASSETS)
|
||||
|
@ -771,8 +753,21 @@ elseif(ANDROID)
|
|||
endif()
|
||||
|
||||
if(LOVR_USE_OPENXR)
|
||||
get_target_property(OPENXR_LIB ${LOVR_OPENXR} IMPORTED_LOCATION)
|
||||
file(COPY ${OPENXR_LIB} DESTINATION raw/lib/${ANDROID_ABI})
|
||||
add_custom_command(TARGET move_files POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
$<TARGET_SONAME_FILE:${LOVR_OPENXR}>
|
||||
raw/lib/${ANDROID_ABI}/libopenxr_loader_generic.so
|
||||
)
|
||||
set (PICO_LOADER "${CMAKE_CURRENT_SOURCE_DIR}/deps/pico-openxr/Libs/Android/${ANDROID_ABI}/libopenxr_loader.so")
|
||||
if (EXISTS ${PICO_LOADER})
|
||||
configure_file(${PICO_LOADER} "raw/lib/${ANDROID_ABI}/libopenxr_loader_pico.so" COPYONLY)
|
||||
endif()
|
||||
set (OCULUS_LOADER "${CMAKE_CURRENT_SOURCE_DIR}/deps/oculus-openxr/Libs/Android/${ANDROID_ABI}/Release/libopenxr_loader.so")
|
||||
if (EXISTS ${OCULUS_LOADER})
|
||||
configure_file(${OCULUS_LOADER} "raw/lib/${ANDROID_ABI}/libopenxr_loader_oculus.so" COPYONLY)
|
||||
endif()
|
||||
|
||||
configure_file("${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so" "raw/lib/${ANDROID_ABI}/libc++_shared.so" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(LOVR_USE_OCULUS_AUDIO)
|
||||
|
|
|
@ -3,10 +3,24 @@ package org.lovr.app;
|
|||
import android.Manifest;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
import android.os.Build;
|
||||
|
||||
public class Activity extends NativeActivity {
|
||||
static {
|
||||
System.loadLibrary("openxr_loader");
|
||||
if (Build.MANUFACTURER.contains("Oculus")) {
|
||||
Log.d("LOVR", "Using Oculus OpenXR Loader");
|
||||
System.loadLibrary("openxr_loader_oculus");
|
||||
}
|
||||
else if (Build.MANUFACTURER.contains("Pico"))
|
||||
{
|
||||
Log.d("LOVR", "Using Pico OpenXR Loader");
|
||||
System.loadLibrary("openxr_loader_pico");
|
||||
}
|
||||
else {
|
||||
Log.d("LOVR", "Using Generic OpenXR Loader");
|
||||
System.loadLibrary("openxr_loader_generic");
|
||||
}
|
||||
System.loadLibrary("lovr");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.lovr.app" android:installLocation="auto" android:versionCode="1">
|
||||
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26"/>
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:required="false"/>
|
||||
<uses-feature android:name="oculus.software.handtracking" android:required="false"/>
|
||||
<!-- Oculus -->
|
||||
<uses-feature android:name="oculus.software.trackedkeyboard" android:required="false"/>
|
||||
<uses-feature android:name="com.oculus.feature.RENDER_MODEL" android:required="false"/>
|
||||
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="false"/>
|
||||
|
@ -14,16 +14,26 @@
|
|||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!-- Khronos/Generic -->
|
||||
<uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
|
||||
<uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />
|
||||
<queries>
|
||||
<provider android:name="org.khronos.openxr.runtime_broker" android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" />
|
||||
</queries>
|
||||
|
||||
<application android:allowBackup="false" android:label="LÖVR" android:extractNativeLibs="false" android:debuggable="true">
|
||||
<meta-data android:name="pvr.app.type" android:value="vr"/> <!-- Pico -->
|
||||
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
|
||||
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
|
||||
<meta-data android:name="com.oculus.handtracking.version" android:value="V2.0"/>
|
||||
<activity android:name="Activity" android:launchMode="singleTask" android:screenOrientation="landscape" android:excludeFromRecents="true">
|
||||
<activity android:name="Activity" android:launchMode="singleTask" android:screenOrientation="landscape" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:excludeFromRecents="true">
|
||||
<meta-data android:name="android.app.lib_name" android:value="lovr"/>
|
||||
<meta-data android:name="com.oculus.vr.focusaware" android:value="true"/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="com.oculus.intent.category.VR"/>
|
||||
<category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.lovr.app" android:installLocation="auto" android:versionCode="1">
|
||||
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26"/>
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:required="false" android:version="1" />
|
||||
<uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
|
||||
<uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />
|
||||
<queries>
|
||||
<provider android:name="org.khronos.openxr.runtime_broker" android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" />
|
||||
</queries>
|
||||
|
||||
<application android:allowBackup="false" android:label="LÖVR" android:extractNativeLibs="false" android:debuggable="true">
|
||||
<activity
|
||||
android:name="Activity"
|
||||
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode|density"
|
||||
android:excludeFromRecents="false"
|
||||
android:launchMode="singleTask"
|
||||
android:resizeableActivity="false"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
|
||||
|
||||
<meta-data android:name="android.app.lib_name" android:value="lovr" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.lovr.app">
|
||||
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/>
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true"/>
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
<application android:allowBackup="false" android:label="LÖVR">
|
||||
<meta-data android:name="pvr.app.type" android:value="vr"/>
|
||||
<activity android:name="Activity" android:launchMode="singleTask" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
|
||||
<meta-data android:name="android.app.lib_name" android:value="lovr"/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
Loading…
Reference in New Issue