Verified Commit dd2de6da authored by Ilya Bizyaev's avatar Ilya Bizyaev 📱 Committed by Linus Jahn

Adapt all build scripts to use QXmpp

parent cc9f5c53
...@@ -4,9 +4,10 @@ kaidan_automoc.cpp ...@@ -4,9 +4,10 @@ kaidan_automoc.cpp
misc/ubuntu-touch/manifest.json misc/ubuntu-touch/manifest.json
misc/windows/*-kaidan.png misc/windows/*-kaidan.png
misc/macos/kaidan.iconset misc/macos/kaidan.iconset
misc/android/res/mipmap-*
3rdparty/openssl 3rdparty/openssl
3rdparty/gloox 3rdparty/qxmpp
################### AppImage ################# ################### AppImage #################
AppDir/ AppDir/
...@@ -141,5 +142,6 @@ install_manifest.txt ...@@ -141,5 +142,6 @@ install_manifest.txt
*.swp *.swp
.vscode/ .vscode/
.directory .directory
.DS_Store
src/tags src/tags
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.12)
find_package(ECM 5.40.0 REQUIRED NO_MODULE) find_package(ECM 5.40.0 REQUIRED NO_MODULE)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(QT_MIN_VERSION "5.8.0") set(QT_MIN_VERSION "5.8.0")
...@@ -43,10 +43,10 @@ kde_enable_exceptions() ...@@ -43,10 +43,10 @@ kde_enable_exceptions()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Svg Sql QuickControls2 Xml) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Svg Sql QuickControls2 Xml)
find_package(KF5Kirigami2 REQUIRED) find_package(KF5Kirigami2 REQUIRED)
pkg_check_modules(QXmpp REQUIRED qxmpp>=0.9) pkg_search_module(QXmpp REQUIRED qxmpp>=0.9)
# Optional QWidget style integration (not on mobile) # Optional QWidget style integration (not on mobile)
if(NOT UBUNTU_TOUCH AND NOT ANDROID) if(NOT UBUNTU_TOUCH AND NOT ANDROID AND NOT IOS)
find_package(Qt5Widgets) find_package(Qt5Widgets)
set_package_properties(Qt5Widgets PROPERTIES set_package_properties(Qt5Widgets PROPERTIES
DESCRIPTION "Integration with QWidget based desktop styles" DESCRIPTION "Integration with QWidget based desktop styles"
...@@ -62,14 +62,12 @@ else() ...@@ -62,14 +62,12 @@ else()
add_definitions(-DQAPPLICATION_CLASS=QGuiApplication) add_definitions(-DQAPPLICATION_CLASS=QGuiApplication)
endif() endif()
if (ANDROID) if(ANDROID)
find_package(Qt5 REQUIRED COMPONENTS AndroidExtras) find_package(Qt5 REQUIRED COMPONENTS AndroidExtras)
endif() endif()
if (ANDROID OR WIN32) if(ANDROID OR WIN32)
pkg_search_module(OPENSSL REQUIRED openssl) pkg_search_module(OPENSSL REQUIRED openssl IMPORTED_TARGET)
include_directories(${OPENSSL_INCLUDE_DIRS})
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}") message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
endif() endif()
...@@ -104,6 +102,7 @@ endif() ...@@ -104,6 +102,7 @@ endif()
# Set app icon # Set app icon
if(APPLE) if(APPLE)
set(KAIDAN_ICNS "${CMAKE_SOURCE_DIR}/misc/macos/kaidan.icns") set(KAIDAN_ICNS "${CMAKE_SOURCE_DIR}/misc/macos/kaidan.icns")
set_source_files_properties(${KAIDAN_ICNS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
elseif(WIN32) elseif(WIN32)
include(ECMAddAppIcon) include(ECMAddAppIcon)
file(GLOB WIN_ICONS_SRCS "${CMAKE_SOURCE_DIR}/misc/windows/*kaidan.png") file(GLOB WIN_ICONS_SRCS "${CMAKE_SOURCE_DIR}/misc/windows/*kaidan.png")
...@@ -132,9 +131,12 @@ target_link_libraries(${PROJECT_NAME} ...@@ -132,9 +131,12 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Network Qt5::Network
Qt5::Xml Qt5::Xml
${__Qt5Widgets_LIBRARIES} ${__Qt5Widgets_LIBRARIES}
${QXmpp_LIBRARIES} # currently needs to be hardcoded for windows builds
qxmpp
) )
link_directories(${QXmpp_LIBDIR})
target_include_directories(${PROJECT_NAME} PUBLIC target_include_directories(${PROJECT_NAME} PUBLIC
${QXmpp_INCLUDE_DIRS} ${QXmpp_INCLUDE_DIRS}
) )
...@@ -143,26 +145,69 @@ target_compile_options(${PROJECT_NAME} PUBLIC ...@@ -143,26 +145,69 @@ target_compile_options(${PROJECT_NAME} PUBLIC
${QXmpp_CFLAGS_OTHER} ${QXmpp_CFLAGS_OTHER}
) )
if (ANDROID OR WIN32) if(ANDROID OR WIN32 OR IOS)
target_link_libraries(${PROJECT_NAME} Qt5::QuickControls2 KF5::Kirigami2 ${OPENSSL_LIBRARIES}) target_link_libraries(${PROJECT_NAME} Qt5::QuickControls2 KF5::Kirigami2)
endif() endif()
if (ANDROID) if(ANDROID OR WIN32)
target_link_libraries(${PROJECT_NAME} PkgConfig::OPENSSL)
endif()
if(ANDROID)
target_link_libraries(${PROJECT_NAME} Qt5::AndroidExtras) target_link_libraries(${PROJECT_NAME} Qt5::AndroidExtras)
endif() endif()
if (WIN32 AND STATIC_BUILD) if(STATIC_BUILD)
pkg_check_modules(QT5ALL Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Network Qt5Qml Qt5Svg Qt5Sql) add_definitions(-DQXMPP_STATIC)
foreach(plugin ${Qt5Gui_PLUGINS} ${Qt5Network_PLUGINS} ${Qt5Qml_PLUGINS} ${Qt5Svg_PLUGINS} ${Qt5Sql_PLUGINS})
get_target_property(_loc ${plugin} LOCATION) find_package(Perl REQUIRED)
message("Plugin ${plugin} is at location ${_loc}")
set(plugin_libs ${plugin_libs} ${_loc}) set(STATIC_DEPENDENCIES_CMAKE_FILE "${CMAKE_BINARY_DIR}/QtStaticDependencies.cmake")
if(EXISTS ${STATIC_DEPENDENCIES_CMAKE_FILE})
file(REMOVE ${STATIC_DEPENDENCIES_CMAKE_FILE})
endif()
get_target_property(QT_LIBDIR Qt5::Core LOCATION)
get_filename_component(QT_LIBDIR ${QT_LIBDIR} DIRECTORY)
macro(CONVERT_PRL_LIBS_TO_CMAKE _qt_component)
if(TARGET Qt5::${_qt_component})
get_target_property(_lib_location Qt5::${_qt_component} LOCATION)
execute_process(COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/convert-prl-libs-to-cmake.pl
--lib ${_lib_location}
--libdir ${QT_LIBDIR}
--out ${STATIC_DEPENDENCIES_CMAKE_FILE}
--component ${_qt_component}
--compiler ${CMAKE_CXX_COMPILER_ID}
)
endif()
endmacro()
link_directories(${_qt5_install_prefix}/../)
foreach(qt_module Gui Quick QuickControls2 Network Qml Svg Sql QSQLiteDriverPlugin
QJpegPlugin QGifPlugin QSvgPlugin QSvgIconPlugin QICOPlugin QGenericEnginePlugin
QLocalClientConnectionFactory QTcpServerConnectionFactory)
CONVERT_PRL_LIBS_TO_CMAKE(${qt_module})
endforeach() endforeach()
pkg_search_module(SQLITE REQUIRED sqlite3)
if(WIN32)
CONVERT_PRL_LIBS_TO_CMAKE(QWindowsIntegrationPlugin)
elseif(IOS)
foreach(qt_module QIOSIntegrationPlugin QMacHeifPlugin QMacJp2Plugin
QICNSPlugin QTgaPlugin QTiffPlugin QWbmpPlugin QWebpPlugin)
CONVERT_PRL_LIBS_TO_CMAKE(${qt_module})
endforeach()
endif()
if(NOT EXISTS ${STATIC_DEPENDENCIES_CMAKE_FILE})
message(FATAL_ERROR "Unable to find ${STATIC_DEPENDENCIES_CMAKE_FILE}")
endif()
include(${STATIC_DEPENDENCIES_CMAKE_FILE})
set(QT_QML_PATH ${_qt5Quick_install_prefix}) set(QT_QML_PATH ${_qt5Quick_install_prefix})
find_library(KIRIGAMI_PLUGIN kirigamiplugin PATHS ${CMAKE_PREFIX_PATH}/${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2) find_library(KIRIGAMI_PLUGIN kirigamiplugin PATHS ${Kirigami2_INSTALL_PREFIX}/${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2)
find_library(QUICK_PLUGIN qtquick2plugin PATHS ${QT_QML_PATH}/qml/QtQuick.2) find_library(QUICK_PLUGIN qtquick2plugin PATHS ${QT_QML_PATH}/qml/QtQuick.2)
find_library(LABS_PLATFORM_PLUGIN qtlabsplatformplugin PATHS ${QT_QML_PATH}/qml/Qt/labs/platform) find_library(LABS_PLATFORM_PLUGIN qtlabsplatformplugin PATHS ${QT_QML_PATH}/qml/Qt/labs/platform)
find_library(GRAPHEFFECTS_PLUGIN qtgraphicaleffectsplugin PATHS ${QT_QML_PATH}/qml/QtGraphicalEffects) find_library(GRAPHEFFECTS_PLUGIN qtgraphicaleffectsplugin PATHS ${QT_QML_PATH}/qml/QtGraphicalEffects)
...@@ -175,14 +220,17 @@ if (WIN32 AND STATIC_BUILD) ...@@ -175,14 +220,17 @@ if (WIN32 AND STATIC_BUILD)
find_library(QSHAPES_PLUGIN qmlshapesplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Shapes) find_library(QSHAPES_PLUGIN qmlshapesplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Shapes)
find_library(QTEMPLATES_PLUGIN qtquicktemplates2plugin PATHS ${QT_QML_PATH}/qml/QtQuick/Templates.2) find_library(QTEMPLATES_PLUGIN qtquicktemplates2plugin PATHS ${QT_QML_PATH}/qml/QtQuick/Templates.2)
find_library(QMODELS_PLUGIN modelsplugin PATHS ${QT_QML_PATH}/qml/QtQml/Models.2) find_library(QMODELS_PLUGIN modelsplugin PATHS ${QT_QML_PATH}/qml/QtQml/Models.2)
find_library(WIN_SECUR32 secur32)
find_library(QT_FONT_SUPPORT Qt5FontDatabaseSupport)
find_library(QT_THEME_SUPPORT Qt5ThemeSupport)
find_library(QT_EVENT_SUPPORT Qt5EventDispatcherSupport)
find_library(QT_ACCESSIBILITY_SUPPORT Qt5AccessibilitySupport)
find_library(QT_UIAUTO_SUPPORT Qt5WindowsUIAutomationSupport)
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
${plugin_libs} ${plugin_libs}
Qt5::QSQLiteDriverPlugin
Qt5::QJpegPlugin
Qt5::QGifPlugin
Qt5::QSvgPlugin
Qt5::QSvgIconPlugin
Qt5::QICOPlugin
Qt5::QGenericEnginePlugin
Qt5::QLocalClientConnectionFactory
Qt5::QTcpServerConnectionFactory
${KIRIGAMI_PLUGIN} ${KIRIGAMI_PLUGIN}
${QUICK_PLUGIN} ${QUICK_PLUGIN}
${LABS_PLATFORM_PLUGIN} ${LABS_PLATFORM_PLUGIN}
...@@ -196,32 +244,49 @@ if (WIN32 AND STATIC_BUILD) ...@@ -196,32 +244,49 @@ if (WIN32 AND STATIC_BUILD)
${QSHAPES_PLUGIN} ${QSHAPES_PLUGIN}
${QTEMPLATES_PLUGIN} ${QTEMPLATES_PLUGIN}
${QMODELS_PLUGIN} ${QMODELS_PLUGIN}
${SQLITE_LIBRARIES} ${__Qt5Widgets_LIBRARIES}
${QT_EVENT_SUPPORT} )
${QT_FONT_SUPPORT}
${QT_THEME_SUPPORT} if(WIN32)
${QT_ACCESSIBILITY_SUPPORT} target_link_libraries(${PROJECT_NAME}
${QT_UIAUTO_SUPPORT} Qt5::QWindowsIntegrationPlugin
jpeg )
${__Qt5Widgets_LIBRARIES} ${WIN_SECUR32} elseif(IOS)
${QT5ALL_LDFLAGS}) target_link_libraries(${PROJECT_NAME}
Qt5::QIOSIntegrationPlugin
Qt5::QMacHeifPlugin
Qt5::QMacJp2Plugin
Qt5::QICNSPlugin
Qt5::QTgaPlugin
Qt5::QTiffPlugin
Qt5::QWbmpPlugin
Qt5::QWebpPlugin
)
endif()
endif() endif()
# Set a custom plist file for the app bundle # Set a custom plist file for the app bundle
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/misc/macos/Info.plist) if(APPLE)
if(IOS)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/misc/ios/Info.plist)
else()
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/misc/macos/Info.plist)
endif()
endif()
# #
# Global C++ variables # Global C++ variables
# #
# iOS-specific linker flags
if(IOS)
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-Wl,-e,_qt_main_wrapper -u _qt_registerPlatformPlugin")
endif()
if(UBUNTU_TOUCH) if(UBUNTU_TOUCH)
set(KAIDAN_COMPILE_DEFINITIONS set(KAIDAN_COMPILE_DEFINITIONS UBUNTU_TOUCH=True)
UBUNTU_TOUCH=True elseif(NOT ANDROID AND NOT IOS AND NOT WIN32)
) set(KAIDAN_COMPILE_DEFINITIONS NOTIFICATIONS_LIBNOTIFY=True)
elseif(NOT ANDROID)
set(KAIDAN_COMPILE_DEFINITIONS
NOTIFICATIONS_LIBNOTIFY=True
)
endif() endif()
if(STATIC_BUILD) if(STATIC_BUILD)
......
...@@ -65,6 +65,10 @@ License: CC-BY-SA-3.0 ...@@ -65,6 +65,10 @@ License: CC-BY-SA-3.0
Comment: Comment:
data/images/chat.png: From <https://www.toptal.com/designers/subtlepatterns/inspiration-geometry/> data/images/chat.png: From <https://www.toptal.com/designers/subtlepatterns/inspiration-geometry/>
Files: utils/convert-prl-libs-to-cmake.pl
Copyright: 2016, Konstantin Tokarev <annulen@yandex.ru>
License: MIT-Apple
License: GPL-3+ with OpenSSL exception License: GPL-3+ with OpenSSL exception
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -127,3 +131,25 @@ License: MIT ...@@ -127,3 +131,25 @@ License: MIT
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License: MIT-Apple
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
...@@ -19,10 +19,6 @@ set(KAIDAN_SOURCES ...@@ -19,10 +19,6 @@ set(KAIDAN_SOURCES
${CURDIR}/StatusBar.cpp ${CURDIR}/StatusBar.cpp
${CURDIR}/UploadManager.cpp ${CURDIR}/UploadManager.cpp
# SingleApplication
${CURDIR}/singleapp/singleapplication.cpp
${CURDIR}/singleapp/singleapplication_p.cpp
# needed to trigger moc generation # needed to trigger moc generation
${CURDIR}/Enums.h ${CURDIR}/Enums.h
...@@ -31,3 +27,10 @@ set(KAIDAN_SOURCES ...@@ -31,3 +27,10 @@ set(KAIDAN_SOURCES
${CURDIR}/qxmpp-exts/QXmppUploadRequestManager.cpp ${CURDIR}/qxmpp-exts/QXmppUploadRequestManager.cpp
${CURDIR}/qxmpp-exts/QXmppUploadManager.cpp ${CURDIR}/qxmpp-exts/QXmppUploadManager.cpp
) )
if (NOT ANDROID AND NOT IOS)
set (KAIDAN_SOURCES ${KAIDAN_SOURCES}
${CURDIR}/singleapp/singleapplication.cpp
${CURDIR}/singleapp/singleapplication_p.cpp
)
endif()
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#endif #endif
#include QT_STRINGIFY(QAPPLICATION_CLASS) #include QT_STRINGIFY(QAPPLICATION_CLASS)
#ifndef Q_OS_ANDROID #if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID)
// SingleApplication (Qt5 replacement for QtSingleApplication) // SingleApplication (Qt5 replacement for QtSingleApplication)
#include "singleapp/singleapplication.h" #include "singleapp/singleapplication.h"
#endif #endif
...@@ -76,6 +76,10 @@ ...@@ -76,6 +76,10 @@
#include <QtAndroid> #include <QtAndroid>
#endif #endif
#ifdef Q_OS_WIN
#include <windows.h>
#endif
enum CommandLineParseResult { enum CommandLineParseResult {
CommandLineOk, CommandLineOk,
CommandLineError, CommandLineError,
...@@ -115,7 +119,7 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err ...@@ -115,7 +119,7 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
Q_DECL_EXPORT int main(int argc, char *argv[]) Q_DECL_EXPORT int main(int argc, char *argv[])
{ {
#ifdef _WIN32 #ifdef Q_OS_WIN
if (AttachConsole(ATTACH_PARENT_PROCESS)) { if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
...@@ -141,7 +145,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -141,7 +145,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// create a qt app // create a qt app
#ifdef Q_OS_ANDROID #if defined(Q_OS_IOS) || defined(Q_OS_ANDROID)
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
#else #else
SingleApplication app(argc, argv, true); SingleApplication app(argc, argv, true);
...@@ -194,7 +198,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -194,7 +198,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
break; break;
} }
#ifndef Q_OS_ANDROID #if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID)
// check if another instance already runs // check if another instance already runs
if (app.isSecondary() && !parser.isSet("multiple")) { if (app.isSecondary() && !parser.isSet("multiple")) {
qDebug().noquote() << QString("Another instance of %1 is already running.") qDebug().noquote() << QString("Another instance of %1 is already running.")
...@@ -215,7 +219,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -215,7 +219,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
Kaidan kaidan(&app, !parser.isSet("disable-xml-log")); Kaidan kaidan(&app, !parser.isSet("disable-xml-log"));
#ifndef Q_OS_ANDROID #if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID)
// receive messages from other instances of Kaidan // receive messages from other instances of Kaidan
kaidan.connect(&app, &SingleApplication::receivedMessage, kaidan.connect(&app, &SingleApplication::receivedMessage,
&kaidan, &Kaidan::receiveMessage); &kaidan, &Kaidan::receiveMessage);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
// This file imports static plugin classes for static plugins // This file imports static plugin classes for static plugins
#include <QtPlugin> #include <QtPlugin>
#ifdef __APPLE__ #ifdef Q_OS_IOS
Q_IMPORT_PLUGIN(QIOSIntegrationPlugin) Q_IMPORT_PLUGIN(QIOSIntegrationPlugin)
Q_IMPORT_PLUGIN(QMacHeifPlugin) Q_IMPORT_PLUGIN(QMacHeifPlugin)
Q_IMPORT_PLUGIN(QMacJp2Plugin) Q_IMPORT_PLUGIN(QMacJp2Plugin)
...@@ -40,9 +40,11 @@ Q_IMPORT_PLUGIN(QTgaPlugin) ...@@ -40,9 +40,11 @@ Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QTiffPlugin) Q_IMPORT_PLUGIN(QTiffPlugin)
Q_IMPORT_PLUGIN(QWbmpPlugin) Q_IMPORT_PLUGIN(QWbmpPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QWebpPlugin)
#endif // __APPLE__ #endif //Q_OS_IOS
Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin); #ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
#endif
// Media support // Media support
Q_IMPORT_PLUGIN(QSvgPlugin) Q_IMPORT_PLUGIN(QSvgPlugin)
......
...@@ -25,9 +25,10 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}" ...@@ -25,9 +25,10 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}"
ANDROID_SDK_BUILD_TOOLS_REVISION=${ANDROID_SDK_BUILD_TOOLS_REVISION:-25.0.3} ANDROID_SDK_BUILD_TOOLS_REVISION=${ANDROID_SDK_BUILD_TOOLS_REVISION:-25.0.3}
# Build API version # Build API version
ANDROID_API_VERSION=21 ANDROID_API_VERSION=21
# Build architecture
ANDROID_ARCH=${ANDROID_ARCH:-armv7}
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/.. KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
GLOOX_PATH=/tmp/gloox
OPENSSL_PATH=/tmp/openssl OPENSSL_PATH=/tmp/openssl
OPENSSL_SETENV=$OPENSSL_PATH/Setenv-android.sh OPENSSL_SETENV=$OPENSSL_PATH/Setenv-android.sh
CUSTOM_ANDROID_TOOLCHAIN=/tmp/android-arm-toolchain CUSTOM_ANDROID_TOOLCHAIN=/tmp/android-arm-toolchain
...@@ -38,14 +39,14 @@ echo "*****************************************" ...@@ -38,14 +39,14 @@ echo "*****************************************"
echo "Fetching dependencies if required" echo "Fetching dependencies if required"
echo "*****************************************" echo "*****************************************"
if [ ! -d "$GLOOX_PATH" ]; then if [ ! -d "$KAIDAN_SOURCES/3rdparty/qxmpp/.git" ]; then
echo "Cloning Gloox from SVN" echo "Cloning QXmpp"
svn co svn://svn.camaya.net/gloox/branches/1.0 $GLOOX_PATH git clone https://github.com/qxmpp-project/qxmpp.git 3rdparty/qxmpp
fi fi
if [ ! -d "$OPENSSL_PATH" ]; then if [ ! -d "$OPENSSL_PATH" ]; then
echo "Cloning OpenSSL into $OPENSSL_PATH" echo "Cloning OpenSSL into $OPENSSL_PATH"
git clone --depth=1 git://git.openssl.org/openssl.git $OPENSSL_PATH git clone --branch OpenSSL_1_0_2-stable --depth=1 git://git.openssl.org/openssl.git $OPENSSL_PATH
fi fi
if [ ! -f "$OPENSSL_SETENV" ]; then if [ ! -f "$OPENSSL_SETENV" ]; then
...@@ -78,41 +79,27 @@ echo "*****************************************" ...@@ -78,41 +79,27 @@ echo "*****************************************"
{ {
cd $OPENSSL_PATH cd $OPENSSL_PATH
source ./Setenv-android.sh source $OPENSSL_SETENV
export ANDROID_NDK=$ANDROID_NDK_ROOT export ANDROID_NDK=$ANDROID_NDK_ROOT
./Configure shared android-armeabi --prefix=$CUSTOM_ANDROID_TOOLCHAIN
make build_libs -j$(nproc) SHLIB_VERSION_NUMBER= SHLIB_EXT=.so
make install_sw SHLIB_VERSION_NUMBER= SHLIB_EXT=.so
}
fi
if [ ! -f "$CUSTOM_ANDROID_TOOLCHAIN/lib/libgloox.a" ]; then
echo "*****************************************"
echo "Building Gloox"
echo "*****************************************"
{ case ${ANDROID_ARCH} in
# Add the standalone toolchain to the search path. x86)
export PATH=$CUSTOM_ANDROID_TOOLCHAIN/bin:$PATH sed -ie 's/_ANDROID_ARCH=.*$/_ANDROID_ARCH="arch-x86"/' $OPENSSL_SETENV
sed -ie 's/_ANDROID_EABI=.*$/_ANDROID_EABI="x86-4.9"/' $OPENSSL_SETENV
# Tell configure what tools to use. ;;
export target_host=arm-linux-androideabi armv7)
export AR=$target_host-ar sed -ie 's/_ANDROID_ARCH=.*$/_ANDROID_ARCH="arch-arm"/' $OPENSSL_SETENV
export AS=$target_host-clang sed -ie 's/_ANDROID_EABI=.*$/_ANDROID_EABI="arm-linux-androideabi-4.9"/' $OPENSSL_SETENV
export CC=$target_host-clang ;;
export CXX=$target_host-clang++ esac
export LD=$target_host-ld
export STRIP=$target_host-strip ./Configure --prefix=$CUSTOM_ANDROID_TOOLCHAIN shared android-${ANDROID_ARCH}
#./Configure -I${ANDROID_NDK_ROOT}/sysroot/usr/include -I${ANDROID_NDK_ROOT}/sysroot/usr/include/${CROSS_COMPILE::-1}/ shared android-${ANDROID_ARCH}
# Tell configure what flags Android requires.
export CFLAGS="-fPIE -fPIC" make depend
export LDFLAGS="-pie" make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" build_libs -j$(nproc) || return
make -k CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" install_sw -j$(nproc)
cd $GLOOX_PATH cp -v libcrypto.so libssl.so $CUSTOM_ANDROID_TOOLCHAIN/lib
./autogen.sh
./configure --host=arm --with-openssl=$CUSTOM_ANDROID_TOOLCHAIN --prefix=$CUSTOM_ANDROID_TOOLCHAIN --with-tests=no --with-examples=no
make -j$(nproc)
make install
} }
fi fi
...@@ -124,6 +111,28 @@ cdnew() { ...@@ -124,6 +111,28 @@ cdnew() {
cd $1 cd $1
} }
if [ ! -f "$CUSTOM_ANDROID_TOOLCHAIN/lib/pkgconfig/qxmpp.pc" ]; then
echo "*****************************************"
echo "Building QXmpp"
echo "*****************************************"
{
cdnew $KAIDAN_SOURCES/3rdparty/qxmpp/build
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
-DECM_ADDITIONAL_FIND_ROOT_PATH=$QT_ANDROID \
-DANDROID_NDK=$ANDROID_NDK_ROOT \
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \
-DANDROID_SDK_BUILD_TOOLS_REVISION=$ANDROID_SDK_BUILD_TOOLS_REVISION \
-DCMAKE_PREFIX_PATH=$QT_ANDROID \
-DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN
make -j$(nproc)
make install
rm -rf $KAIDAN_SOURCES/3rdparty/qxmpp/build
}
fi
if [ ! -f "$CUSTOM_ANDROID_TOOLCHAIN/lib/libKF5Kirigami2.so" ]; then if [ ! -f "$CUSTOM_ANDROID_TOOLCHAIN/lib/libKF5Kirigami2.so" ]; then
echo "*****************************************" echo "*****************************************"
echo "Building Kirigami" echo "Building Kirigami"
...@@ -132,7 +141,7 @@ echo "*****************************************" ...@@ -132,7 +141,7 @@ echo "*****************************************"
cdnew $KAIDAN_SOURCES/3rdparty/kirigami/build cdnew $KAIDAN_SOURCES/3rdparty/kirigami/build
cmake .. \ cmake .. \
-DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \ -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
-DECM_ADDITIONAL_FIND_ROOT_PATH=$QT_ANDROID \ -DECM_ADDITIONAL_FIND_ROOT_PATH=$QT_ANDROID \
-DCMAKE_PREFIX_PATH=$QT_ANDROID/ \ -DCMAKE_PREFIX_PATH=$QT_ANDROID/ \
-DANDROID_NDK=$ANDROID_NDK_ROOT \ -DANDROID_NDK=$ANDROID_NDK_ROOT \
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \ -DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \
...@@ -145,7 +154,7 @@ echo "*****************************************" ...@@ -145,7 +154,7 @@ echo "*****************************************"
} }
fi fi
if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-ldpi" ]; then if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-xxxhdpi" ]; then
echo "*****************************************" echo "*****************************************"
echo "Rendering logos" echo "Rendering logos"
echo "*****************************************" echo "*****************************************"
...@@ -168,6 +177,8 @@ if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-ldpi" ]; then ...@@ -168,6 +177,8 @@ if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-ldpi" ]; then
androidlogo xxxhdpi 192 androidlogo xxxhdpi 192
fi fi
export PKG_CONFIG_PATH=$CUSTOM_ANDROID_TOOLCHAIN/lib/pkgconfig
echo "*****************************************" echo "*****************************************"
echo "Building Kaidan" echo "Building Kaidan"
echo "*****************************************" echo "*****************************************"
...@@ -183,7 +194,7 @@ echo "*****************************************" ...@@ -183,7 +194,7 @@ echo "*****************************************"
-DANDROID_SDK_BUILD_TOOLS_REVISION=$ANDROID_SDK_BUILD_TOOLS_REVISION \ -DANDROID_SDK_BUILD_TOOLS_REVISION=$ANDROID_SDK_BUILD_TOOLS_REVISION \
-DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN \ -DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN \
-DANDROID_APK_DIR=../misc/android -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DANDROID_APK_DIR=../misc/android -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DKF5Kirigami2_DIR=$CUSTOM_ANDROID_TOOLCHAIN/lib/cmake/KF5Kirigami2 -DI18N=1 -DI18N=1
make create-apk-kaidan -j$(nproc) make create-apk-kaidan -j$(nproc)
} }
......
...@@ -13,6 +13,7 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}" ...@@ -13,6 +13,7 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}"
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/.. KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
KIRIGAMI_BUILD=/tmp/kirigami-linux-build KIRIGAMI_BUILD=/tmp/kirigami-linux-build
QXMPP_BUILD=/tmp/qxmpp-linux-build
echo "-- Starting $BUILD_TYPE build of Kaidan --" echo "-- Starting $BUILD_TYPE build of Kaidan --"
...@@ -25,6 +26,11 @@ if [ ! -f "$KAIDAN_SOURCES/3rdparty/kirigami/.git" ] || [ ! -f "$KAIDAN_SOURCES/ ...@@ -25,6 +26,11 @@ if [ ! -f "$KAIDAN_SOURCES/3rdparty/kirigami/.git" ] || [ ! -f "$KAIDAN_SOURCES/
git submodule update --init git submodule update --init
fi fi
if [ ! -d "$KAIDAN_SOURCES/3rdparty/qxmpp/.git" ]; then
echo "Cloning QXmpp"
git clone https://github.com/qxmpp-project/qxmpp.git 3rdparty/qxmpp
fi