mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 07:02:27 +02:00
being to rebuild gvr-interface deploy with androiddeployqt
This commit is contained in:
parent
2316cfb885
commit
225e326420
6 changed files with 122 additions and 52 deletions
cmake/android
gvr-interface
|
@ -2,15 +2,42 @@
|
|||
|
||||
<!-- IMPORTANT: Do not manually manipulate this automatically generated file, changes will be gone after the next build! -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${ANDROID_APK_PACKAGE}" android:versionCode="1" android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="${ANDROID_API_LEVEL}" />
|
||||
<application android:label="@string/ApplicationName" android:debuggable="${ANDROID_APK_DEBUGGABLE}">
|
||||
<activity android:name=".LoadLibraries" android:label="@string/ApplicationName" android:configChanges="orientation|keyboardHidden" ${ANDROID_APK_THEME}>
|
||||
<meta-data android:name="android.app.lib_name" android:value="${ANDROID_NAME}" />
|
||||
<manifest package="${ANDROID_APK_PACKAGE}" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="${ANDROID_API_LEVEL}" />
|
||||
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:debuggable="${ANDROID_APK_DEBUGGABLE}" android:label="@string/ApplicationName">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name="org.qtproject.qt5.android.bindings.QtActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="unspecified">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<!-- %%INSERT_PERMISSIONS -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<!-- %%INSERT_FEATURES -->
|
||||
</manifest>
|
||||
|
|
|
@ -72,11 +72,7 @@ macro(android_create_apk name apk_directory shared_libraries static_libraries ja
|
|||
if(ANDROID_APK_CREATE)
|
||||
# Construct the current package name and theme
|
||||
set(ANDROID_APK_PACKAGE "${ANDROID_APK_TOP_LEVEL_DOMAIN}.${ANDROID_APK_DOMAIN}.${ANDROID_APK_SUBDOMAIN}")
|
||||
if(ANDROID_APK_FULLSCREEN)
|
||||
set(ANDROID_APK_THEME "android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"")
|
||||
else()
|
||||
set(ANDROID_APK_THEME "")
|
||||
endif()
|
||||
|
||||
set(ANDROID_NAME ${name})
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(ANDROID_APK_DEBUGGABLE "true")
|
||||
|
|
68
cmake/android/QtCreateAPK.cmake
Normal file
68
cmake/android/QtCreateAPK.cmake
Normal file
|
@ -0,0 +1,68 @@
|
|||
#
|
||||
# QtCreateAPK.cmake
|
||||
#
|
||||
# Created by Stephen Birarda on 11/18/14.
|
||||
# Copyright 2013 High Fidelity, Inc.
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
|
||||
#
|
||||
# OPTIONS
|
||||
# These options will modify how QtCreateAPK behaves. May be useful if somebody wants to fork.
|
||||
# For High Fidelity purposes these should not need to be changed.
|
||||
#
|
||||
set(ANDROID_APK_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/apk")
|
||||
|
||||
|
||||
set(ANDROID_THIS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) # Directory this CMake file is in
|
||||
|
||||
macro(qt_create_apk)
|
||||
if(ANDROID_APK_FULLSCREEN)
|
||||
set(ANDROID_APK_THEME "android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"")
|
||||
else()
|
||||
set(ANDROID_APK_THEME "")
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(ANDROID_APK_DEBUGGABLE "true")
|
||||
set(ANDROID_APK_RELEASE_LOCAL "0")
|
||||
else ()
|
||||
set(ANDROID_APK_DEBUGGABLE "false")
|
||||
set(ANDROID_APK_RELEASE_LOCAL ${ANDROID_APK_RELEASE})
|
||||
endif ()
|
||||
|
||||
# Create "AndroidManifest.xml"
|
||||
configure_file("${ANDROID_THIS_DIRECTORY}/AndroidManifest.xml.in" "${ANDROID_APK_DIRECTORY}/AndroidManifest.xml")
|
||||
|
||||
# Create "res/values/strings.xml"
|
||||
configure_file("${ANDROID_THIS_DIRECTORY}/strings.xml.in" "${ANDROID_APK_DIRECTORY}/res/values/strings.xml")
|
||||
|
||||
# figure out where the qt dir is
|
||||
get_filename_component(_QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../../" ABSOLUTE)
|
||||
|
||||
# find androiddeployqt
|
||||
find_program(ANDROID_DEPLOY_QT androiddeployqt HINTS "${_QT_DIR}/bin")
|
||||
|
||||
# set the path to our app shared library
|
||||
set(EXECUTABLE_DESTINATION_PATH "${CMAKE_BINARY_DIR}/libs/${ANDROID_ABI}/lib${TARGET_NAME}.so")
|
||||
|
||||
# add our dependencies to the deployment file
|
||||
get_property(_DEPENDENCIES TARGET ${TARGET_NAME} PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||
set(_DEPS_LIST)
|
||||
message(${_DEPENDENCIES})
|
||||
foreach(_DEP IN LISTS _DEPENDENCIES)
|
||||
if(NOT _DEP MATCHES "Qt5::.*")
|
||||
get_property(_DEP_LOCATION TARGET ${_DEP} PROPERTY "LOCATION_${CMAKE_BUILD_TYPE}")
|
||||
list(APPEND _DEPS_LIST ${_DEP_LOCATION})
|
||||
endif()
|
||||
endforeach()
|
||||
string(REPLACE ";" "," _DEPS "${_DEPS_LIST}")
|
||||
configure_file("${ANDROID_THIS_DIRECTORY}/deployment-file.json.in" "${TARGET_NAME}-deployment.json")
|
||||
|
||||
# Uninstall previous version from the device/emulator (else we may get e.g. signature conflicts)
|
||||
add_custom_command(TARGET ${TARGET_NAME}
|
||||
COMMAND adb uninstall ${ANDROID_APK_PACKAGE}
|
||||
)
|
||||
endmacro()
|
14
cmake/android/deployment-file.json.in
Normal file
14
cmake/android/deployment-file.json.in
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"qt": "@QTDIR@",
|
||||
"sdk": "@ANDROID_SDK_ROOT@",
|
||||
"ndk": "@ANDROID_NDK@",
|
||||
"toolchain-prefix": "@ANDROID_TOOLCHAIN@",
|
||||
"tool-prefix": "@ANDROID_TOOLCHAIN@",
|
||||
"toolchain-version": "@ANDROID_GCC_VERSION@",
|
||||
"ndk-host": "@_HOST@",
|
||||
"target-architecture": "@ANDROID_ABI@",
|
||||
"application-binary": "@EXECUTABLE_DESTINATION_PATH@",
|
||||
"android-extra-libs": "@_DEPS@",
|
||||
"android-extra-plugins": "@CMAKE_PREFIX_PATH@/share,@CMAKE_PREFIX_PATH@/lib/qml",
|
||||
"android-package-source-directory": "@ANDROID_APK_DIR@"
|
||||
}
|
|
@ -3,5 +3,5 @@
|
|||
<!-- IMPORTANT: Do not manually manipulate this automatically generated file, changes will be gone after the next build! -->
|
||||
|
||||
<resources>
|
||||
<string name="ApplicationName">${ANDROID_NAME}</string>
|
||||
<string name="ApplicationName">${ANDROID_APP_NAME}</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
set(TARGET_NAME gvr-interface)
|
||||
|
||||
set(${TARGET_NAME}_SRCS
|
||||
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c
|
||||
)
|
||||
|
||||
set(${TARGET_NAME}_SHARED true)
|
||||
setup_hifi_library()
|
||||
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
include_glm()
|
||||
|
||||
set(REQUIRED_HIFI_LIBRARIES "shared" "networking")
|
||||
|
@ -16,38 +10,9 @@ set(REQUIRED_HIFI_LIBRARIES "shared" "networking")
|
|||
link_hifi_libraries(${REQUIRED_HIFI_LIBRARIES})
|
||||
link_shared_dependencies()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} log android)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS "ANDROID")
|
||||
|
||||
set(ANDROID_APP_NAME Interface)
|
||||
set(ANDROID_API_LEVEL 19)
|
||||
set(ARM_TARGET "armeabi-v7a")
|
||||
set(ANDROID_APK_PACKAGE io.highfidelity.io)
|
||||
set(ANDROID_APK_FULLSCREEN true)
|
||||
|
||||
foreach(TARGET_LINK_LIBRARY ${${TARGET_NAME}_LIBRARIES_TO_LINK})
|
||||
get_filename_component(LIB_EXTENSION ${TARGET_LINK_LIBRARY} NAME_WE)
|
||||
|
||||
if (LIB_EXTENSION STREQUAL "so")
|
||||
list(APPEND TARGET_SHARED_LIBRARIES ${TARGET_LINK_LIBRARY})
|
||||
else ()
|
||||
list(APPEND TARGET_STATIC_LIBRARIES ${TARGET_LINK_LIBRARY})
|
||||
endif ()
|
||||
|
||||
endforeach()
|
||||
|
||||
# append each of the hifi shared libraries to our list of libs to link
|
||||
foreach(HIFI_STATIC_LIBRARY ${REQUIRED_HIFI_LIBRARIES})
|
||||
list(APPEND TARGET_STATIC_LIBRARIES "${LIBRARY_OUTPUT_PATH}/lib${HIFI_STATIC_LIBRARY}.a")
|
||||
endforeach()
|
||||
|
||||
list(APPEND TARGET_SHARED_LIBRARIES "${LIBRARY_OUTPUT_PATH}/lib${TARGET_NAME}.so")
|
||||
|
||||
set(TARGET_JAR_LIBRARIES "${QT_CMAKE_PREFIX_PATH}/../../jar/QtAndroid-bundled.jar")
|
||||
|
||||
android_create_apk(
|
||||
${TARGET_NAME}
|
||||
"${CMAKE_BINARY_DIR}/apk"
|
||||
"${TARGET_SHARED_LIBRARIES}"
|
||||
"${TARGET_STATIC_LIBRARIES}"
|
||||
"${TARGET_JAR_LIBRARIES}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/assets"
|
||||
"Data"
|
||||
)
|
||||
qt_create_apk()
|
Loading…
Reference in a new issue