Commit 43b84458 authored by Sharaf Zaman's avatar Sharaf Zaman

Add configurations and patches to build Qt libs for android

The patches are neccessary, since null value of EGLConfig
causes the app to crash on some devices. So, we have to build
Qt first and once we build Qt libs we can use them in
`QT_ANDROID` to build other libs.

Maniphest: T10784
parent 3a920c7f
......@@ -92,6 +92,24 @@ if (WIN32)
BINARY_DIR b
DEPENDS ext_patch ext_openssl
)
elseif (ANDROID)
ExternalProject_Add(
ext_qt
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://download.qt.io/archive/qt/5.12/5.12.2/single/qt-everywhere-src-5.12.2.tar.xz
URL_MD5 99c2eb46e533371798b4ca2d1458e065
PATCH_COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/show-proper-error.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/workaround-null-eglconfig-crash.patch
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -verbose -nomake examples -nomake tests -nomake tools -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -skip qtmultimedia -android-sdk ${ANDROID_SDK_ROOT} -android-ndk ${CMAKE_ANDROID_NDK} -android-arch ${ANDROID_ABI} -xplatform android-clang -android-ndk-platform android-21 -make libs
INSTALL_DIR ${EXTPREFIX_qt}
BUILD_COMMAND $(MAKE)
INSTALL_COMMAND $(MAKE) install
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
)
elseif (NOT APPLE)
ExternalProject_Add(
ext_qt
......
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
@@ -180,9 +180,9 @@
m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object());
m_androidSurfaceObject = QJNIObjectPrivate();
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow, NULL);
+ EGLint error = eglGetError();
m_format = q_glFormatFromConfig(m_eglDisplay, config, window()->requestedFormat());
if (Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE)) {
- EGLint error = eglGetError();
eglTerminate(m_eglDisplay);
qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
}
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
@@ -176,6 +176,8 @@
void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
{
clearEgl();
+ if (config == nullptr)
+ return;
QJNIEnvironmentPrivate env;
m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object());
m_androidSurfaceObject = QJNIObjectPrivate();
#!/bin/bash
#!/bin/bash -e
# See more: 3rdparty/README.md
# Build external dependencies in $KRITA_ROOT/3rdparty
......@@ -28,7 +28,6 @@ cmake $KRITA_ROOT/3rdparty \
-DANDROID_STL=c++_static
# You can comment these and build them individually
cmake --build . --config RelWithDebInfo --target ext_png
cmake --build . --config RelWithDebInfo --target ext_zlib
......
#!/bin/bash
: ${KRITA_ROOT?"Project root path must be set"}
: ${CMAKE_ANDROID_NDK?"Android NDK path must be set"}
: ${BUILD_ROOT? "Build root must be set"}
: ${ANDROID_SDK_ROOT? "Android SDK path must be set"}
if [[ -z $ANDROID_ABI ]]; then
echo "ANDROID_ABI not specified, using the default one: armeabi-v7a"
ANDROID_ABI=armeabi-v7a
fi
cmake $KRITA_ROOT/3rdparty \
-DINSTALL_ROOT=$BUILD_ROOT/i \
-DEXTERNALS_DOWNLOAD_DIR=$BUILD_ROOT/d \
-DCMAKE_INSTALL_PREFIX=$BUILD_ROOT/i \
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=$ANDROID_ABI \
-DANDROID_STL=c++_static \
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
cmake --build . --config RelWithDebInfo --target ext_qt
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment