From dd4f4f09934c44b334814ce30dfba5c4b28e5534 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 29 Jan 2015 13:03:39 -0800 Subject: [PATCH] repairs for hifi scheme handling on android --- cmake/android/AndroidManifest.xml.in | 28 +++++++++++--------- gvr-interface/CMakeLists.txt | 39 +++++++++++++--------------- gvr-interface/src/GVRInterface.cpp | 6 ++--- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/cmake/android/AndroidManifest.xml.in b/cmake/android/AndroidManifest.xml.in index c85430b5b1..ea11d81cff 100755 --- a/cmake/android/AndroidManifest.xml.in +++ b/cmake/android/AndroidManifest.xml.in @@ -8,12 +8,14 @@ - + + @@ -42,17 +44,19 @@ + + ${ANDROID_EXTRA_ACTIVITY_XML} - + ${ANDROID_EXTRA_APPLICATION_XML} - diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index bf7d34a9cb..bd0eb07e87 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -1,6 +1,21 @@ set(TARGET_NAME gvr-interface) if (ANDROID) + set(ANDROID_APK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk-build") + set(ANDROID_APK_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk") + + set(ANDROID_SDK_ROOT $ENV{ANDROID_HOME}) + set(ANDROID_APP_DISPLAY_NAME Interface) + set(ANDROID_API_LEVEL 19) + set(ANDROID_APK_PACKAGE io.highfidelity.gvrinterface) + set(ANDROID_ACTIVITY_NAME io.highfidelity.gvrinterface.InterfaceActivity) + set(ANDROID_APK_VERSION_NAME "0.1") + set(ANDROID_APK_VERSION_CODE 1) + set(ANDROID_DEPLOY_QT_INSTALL "--install") + + set(BUILD_SHARED_LIBS ON) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}") + setup_hifi_library(Gui Widgets AndroidExtras) else () setup_hifi_project(Gui Widgets) @@ -13,25 +28,6 @@ include_glm() link_hifi_libraries(shared networking audio-client avatars) include_dependency_includes() -if (ANDROID) - - set(ANDROID_APK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk-build") - set(ANDROID_APK_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk") - - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}") - set(BUILD_SHARED_LIBS ON) - - set(ANDROID_SDK_ROOT $ENV{ANDROID_HOME}) - set(ANDROID_APP_DISPLAY_NAME Interface) - set(ANDROID_API_LEVEL 19) - set(ANDROID_APK_PACKAGE io.highfidelity.gvrinterface) - set(ANDROID_ACTIVITY_NAME io.highfidelity.gvrinterface.InterfaceActivity) - set(ANDROID_APK_VERSION_NAME "0.1") - set(ANDROID_APK_VERSION_CODE 1) - set(ANDROID_DEPLOY_QT_INSTALL "--install") - -endif () - find_package(LibOVR) if (LIBOVR_FOUND) add_definitions(-DHAVE_LIBOVR) @@ -77,10 +73,11 @@ if (ANDROID) \n \ \n \ \n \ - \n " + \n " ) - set(ANDROID_EXTRA_APPLICATION_XML "${HOCKEY_APP_ACTIVITY}${HIFI_URL_INTENT}") + set(ANDROID_EXTRA_APPLICATION_XML "${HOCKEY_APP_ACTIVITY}") + set(ANDROID_EXTRA_ACTIVITY_XML "${HIFI_URL_INTENT}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/hockeyapp.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/hockeyapp.xml") qt_create_apk() diff --git a/gvr-interface/src/GVRInterface.cpp b/gvr-interface/src/GVRInterface.cpp index 57907ee752..2517af91f6 100644 --- a/gvr-interface/src/GVRInterface.cpp +++ b/gvr-interface/src/GVRInterface.cpp @@ -9,7 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#ifdef Q_OS_ANDROID +#ifdef Q_WS_ANDROID #include #include @@ -42,7 +42,7 @@ GVRInterface::GVRInterface(int argc, char* argv[]) : connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange); -#if defined(Q_OS_ANDROID) && defined(HAVE_LIBOVR) +#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR) QAndroidJniEnvironment jniEnv; QPlatformNativeInterface* interface = QApplication::platformNativeInterface(); @@ -59,7 +59,7 @@ GVRInterface::GVRInterface(int argc, char* argv[]) : } void GVRInterface::idle() { -#if defined(Q_OS_ANDROID) && defined(HAVE_LIBOVR) +#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR) if (!_inVRMode && ovr_IsHeadsetDocked()) { qDebug() << "The headset just got docked - assume we are in VR mode."; _inVRMode = true;