Git commit e068cfccd08ff94a93b864103f87fffcfa3cc610 by Johnny Jazeix. Committed on 29/09/2018 at 05:28. Pushed by jjazeix into branch 'master'. android, improve build to work on kde binary factory M +4 -6 CMakeLists.txt M +1 -1 android/AndroidManifest.xml.cmake M +11 -0 android/CMakeLists.txt M +1 -1 src/core/ApplicationInfo.cpp M +1 -1 src/core/CMakeLists.txt M +2 -2 src/core/main.cpp https://commits.kde.org/gcompris/e068cfccd08ff94a93b864103f87fffcfa3cc610 diff --git a/CMakeLists.txt b/CMakeLists.txt index b767910f..43c7e2b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,8 +92,8 @@ endif("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}= ") set(QT_REQUIRED_VERSION 5.6.0) = find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED - Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTool= s Sensors) - = + Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTools Sensor= s) + if(ANDROID) find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED AndroidExtras) endif(ANDROID) @@ -144,8 +144,6 @@ set(GRAPHICAL_RENDERER "auto" CACHE STRING "Policy for = choosing the renderer bac if(CMAKE_HOST_APPLE) set(_bundle_bin gcompris-qt.app/Contents/MacOS) set(_data_dest_dir bin/${_bundle_bin}/../Resources) -elseif(ANDROID) - set(_data_dest_dir android/assets) else() set(_data_dest_dir share/${GCOMPRIS_EXECUTABLE_NAME}) endif() @@ -153,7 +151,7 @@ if(ANDROID) # Android .so output set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/android/libs/${AN= DROID_ABI}/) set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACH= E INTERNAL "" FORCE) - set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNA= L "" FORCE) + set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/android/assets/${_data_dest_dir= }/rcc CACHE INTERNAL "" FORCE) if(ACTIVATION_MODE STREQUAL "inapp") set(ANDROID_BILLING_PERMISSION "") set(ANDROID_PACKAGE "net.gcompris") @@ -441,7 +439,7 @@ else() # make sure submodule is up2date find_package(Git) if(GIT_FOUND) - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init) + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init WO= RKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif() = # for visual studio, we need to create a vcxproj diff --git a/android/AndroidManifest.xml.cmake b/android/AndroidManifest.xm= l.cmake index 9fd6e833..6527dd33 100644 --- a/android/AndroidManifest.xml.cmake +++ b/android/AndroidManifest.xml.cmake @@ -6,7 +6,7 @@ - + diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index d0963f3c..eb51ed06 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -131,3 +131,14 @@ add_custom_target (apk_signed_aligned add_custom_target (apk_install DEPENDS apkInstall ) + +if (TARGET create-apk) + set(PACKAGE_DIR ${PACKAGE_SOURCE_ANDROID}) + set_target_properties(create-apk-GCompris PROPERTIES ANDROID_APK_DIR "$= {PACKAGE_DIR}") + add_custom_target(gcompris-move-metadata ALL + COMMAND cmake -E echo "Moving GCompris shared Android resources" + COMMAND cmake -E make_directory ${PACKAGE_SOURCE_ANDROID} + COMMAND cmake -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}" "${PAC= KAGE_SOURCE_ANDROID}" + ) + add_dependencies(create-apk gcompris-move-metadata) +endif() diff --git a/src/core/ApplicationInfo.cpp b/src/core/ApplicationInfo.cpp index a35ee47c..0a7d2a89 100644 --- a/src/core/ApplicationInfo.cpp +++ b/src/core/ApplicationInfo.cpp @@ -128,7 +128,7 @@ QString ApplicationInfo::getResourceDataPath() QString ApplicationInfo::getFilePath(const QString &file) { #if defined(Q_OS_ANDROID) - return QString("assets:/%1").arg(file); + return QString("assets:/share/GCompris/rcc/%1").arg(file); #elif defined(Q_OS_MACX) return QString("%1/../Resources/rcc/%2").arg(QCoreApplication::applica= tionDirPath(), file); #elif defined(Q_OS_IOS) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f07ddc82..15204831 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -213,7 +213,7 @@ endif(BUILD_STANDALONE) #if(WIN32) set(GCOMPRIS_OTHER_LIBS "") endif() = # install fixup_bundle script to resolve and fixup runtime dependencies -if(BUILD_STANDALONE) +if(BUILD_STANDALONE AND NOT ANDROID) configure_file(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in FixBundle.cm= ake) install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) = diff --git a/src/core/main.cpp b/src/core/main.cpp index 4d1500b8..9a8fb32a 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -38,14 +38,14 @@ = bool loadAndroidTranslation(QTranslator &translator, const QString &locale) { - QFile file("assets:/gcompris_" + locale + ".qm"); + QFile file("assets:/share/GCompris/gcompris_" + locale + ".qm"); = file.open(QIODevice::ReadOnly); QDataStream in(&file); uchar *data =3D (uchar*)malloc(file.size()); = if(!file.exists()) - qDebug() << "file assets:/" << locale << ".qm does not exist"; + qDebug() << "file assets:/share/GCompris/gcompris_" << locale << "= .qm does not exist"; = in.readRawData((char*)data, file.size()); =20