[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gcompris] /: android, improve build to work on kde binary factory
From:       Johnny Jazeix <null () kde ! org>
Date:       2018-09-29 5:28:28
Message-ID: E1g67no-00043I-FK () code ! kde ! org
[Download RAW message or body]

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 LinguistTools Sensors)
-          
+    Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTools Sensors)
+
 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/${ANDROID_ABI}/)  set(GCOMPRIS_TRANSLATIONS_DIR \
                ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE)
-  set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" \
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 "<uses-permission \
android:name=\"com.android.vending.BILLING\"/>")  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 \
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})  endif()
 
     # for visual studio, we need to create a vcxproj
diff --git a/android/AndroidManifest.xml.cmake b/android/AndroidManifest.xml.cmake
index 9fd6e833..6527dd33 100644
--- a/android/AndroidManifest.xml.cmake
+++ b/android/AndroidManifest.xml.cmake
@@ -6,7 +6,7 @@
 				<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.lib_name" \
android:value="GCompris"/>  <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"/>
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}" \
"${PACKAGE_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::applicationDirPath(), \
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.cmake)
   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 = (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());
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic