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
misc/ubuntu-touch/manifest.json
misc/windows/*-kaidan.png
misc/macos/kaidan.iconset
misc/android/res/mipmap-*
3rdparty/openssl
3rdparty/gloox
3rdparty/qxmpp
################### AppImage #################
AppDir/
......@@ -141,5 +142,6 @@ install_manifest.txt
*.swp
.vscode/
.directory
.DS_Store
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)
set(CMAKE_CXX_STANDARD 14)
set(QT_MIN_VERSION "5.8.0")
......@@ -43,10 +43,10 @@ kde_enable_exceptions()
find_package(PkgConfig REQUIRED)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Svg Sql QuickControls2 Xml)
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)
if(NOT UBUNTU_TOUCH AND NOT ANDROID)
if(NOT UBUNTU_TOUCH AND NOT ANDROID AND NOT IOS)
find_package(Qt5Widgets)
set_package_properties(Qt5Widgets PROPERTIES
DESCRIPTION "Integration with QWidget based desktop styles"
......@@ -62,14 +62,12 @@ else()
add_definitions(-DQAPPLICATION_CLASS=QGuiApplication)
endif()
if (ANDROID)
if(ANDROID)
find_package(Qt5 REQUIRED COMPONENTS AndroidExtras)
endif()
if (ANDROID OR WIN32)
pkg_search_module(OPENSSL REQUIRED openssl)
include_directories(${OPENSSL_INCLUDE_DIRS})
if(ANDROID OR WIN32)
pkg_search_module(OPENSSL REQUIRED openssl IMPORTED_TARGET)
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
endif()
......@@ -104,6 +102,7 @@ endif()
# Set app icon
if(APPLE)
set(KAIDAN_ICNS "${CMAKE_SOURCE_DIR}/misc/macos/kaidan.icns")
set_source_files_properties(${KAIDAN_ICNS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
elseif(WIN32)
include(ECMAddAppIcon)
file(GLOB WIN_ICONS_SRCS "${CMAKE_SOURCE_DIR}/misc/windows/*kaidan.png")
......@@ -132,9 +131,12 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Network
Qt5::Xml
${__Qt5Widgets_LIBRARIES}
${QXmpp_LIBRARIES}
# currently needs to be hardcoded for windows builds
qxmpp
)
link_directories(${QXmpp_LIBDIR})
target_include_directories(${PROJECT_NAME} PUBLIC
${QXmpp_INCLUDE_DIRS}
)
......@@ -143,26 +145,69 @@ target_compile_options(${PROJECT_NAME} PUBLIC
${QXmpp_CFLAGS_OTHER}
)
if (ANDROID OR WIN32)
target_link_libraries(${PROJECT_NAME} Qt5::QuickControls2 KF5::Kirigami2 ${OPENSSL_LIBRARIES})
if(ANDROID OR WIN32 OR IOS)
target_link_libraries(${PROJECT_NAME} Qt5::QuickControls2 KF5::Kirigami2)
endif()
if (ANDROID)
if(ANDROID OR WIN32)
target_link_libraries(${PROJECT_NAME} PkgConfig::OPENSSL)
endif()
if(ANDROID)
target_link_libraries(${PROJECT_NAME} Qt5::AndroidExtras)
endif()
if (WIN32 AND STATIC_BUILD)
pkg_check_modules(QT5ALL Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Network Qt5Qml Qt5Svg Qt5Sql)
foreach(plugin ${Qt5Gui_PLUGINS} ${Qt5Network_PLUGINS} ${Qt5Qml_PLUGINS} ${Qt5Svg_PLUGINS} ${Qt5Sql_PLUGINS})
get_target_property(_loc ${plugin} LOCATION)
message("Plugin ${plugin} is at location ${_loc}")
set(plugin_libs ${plugin_libs} ${_loc})
if(STATIC_BUILD)
add_definitions(-DQXMPP_STATIC)
find_package(Perl REQUIRED)
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()
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})
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(LABS_PLATFORM_PLUGIN qtlabsplatformplugin PATHS ${QT_QML_PATH}/qml/Qt/labs/platform)
find_library(GRAPHEFFECTS_PLUGIN qtgraphicaleffectsplugin PATHS ${QT_QML_PATH}/qml/QtGraphicalEffects)
......@@ -175,14 +220,17 @@ if (WIN32 AND STATIC_BUILD)
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(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}
${plugin_libs}
Qt5::QSQLiteDriverPlugin
Qt5::QJpegPlugin
Qt5::QGifPlugin
Qt5::QSvgPlugin
Qt5::QSvgIconPlugin
Qt5::QICOPlugin
Qt5::QGenericEnginePlugin
Qt5::QLocalClientConnectionFactory
Qt5::QTcpServerConnectionFactory
${KIRIGAMI_PLUGIN}
${QUICK_PLUGIN}
${LABS_PLATFORM_PLUGIN}
......@@ -196,32 +244,49 @@ if (WIN32 AND STATIC_BUILD)
${QSHAPES_PLUGIN}
${QTEMPLATES_PLUGIN}
${QMODELS_PLUGIN}
${SQLITE_LIBRARIES}
${QT_EVENT_SUPPORT}
${QT_FONT_SUPPORT}
${QT_THEME_SUPPORT}
${QT_ACCESSIBILITY_SUPPORT}
${QT_UIAUTO_SUPPORT}
jpeg
${__Qt5Widgets_LIBRARIES} ${WIN_SECUR32}
${QT5ALL_LDFLAGS})
${__Qt5Widgets_LIBRARIES}
)
if(WIN32)
target_link_libraries(${PROJECT_NAME}
Qt5::QWindowsIntegrationPlugin
)
elseif(IOS)
target_link_libraries(${PROJECT_NAME}
Qt5::QIOSIntegrationPlugin
Qt5::QMacHeifPlugin
Qt5::QMacJp2Plugin
Qt5::QICNSPlugin
Qt5::QTgaPlugin
Qt5::QTiffPlugin
Qt5::QWbmpPlugin
Qt5::QWebpPlugin
)
endif()
endif()
# 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
#
# 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)
set(KAIDAN_COMPILE_DEFINITIONS
UBUNTU_TOUCH=True
)
elseif(NOT ANDROID)
set(KAIDAN_COMPILE_DEFINITIONS
NOTIFICATIONS_LIBNOTIFY=True
)
set(KAIDAN_COMPILE_DEFINITIONS UBUNTU_TOUCH=True)
elseif(NOT ANDROID AND NOT IOS AND NOT WIN32)
set(KAIDAN_COMPILE_DEFINITIONS NOTIFICATIONS_LIBNOTIFY=True)
endif()
if(STATIC_BUILD)
......
......@@ -65,6 +65,10 @@ License: CC-BY-SA-3.0
Comment:
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
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
......@@ -127,3 +131,25 @@ License: MIT
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.
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
${CURDIR}/StatusBar.cpp
${CURDIR}/UploadManager.cpp
# SingleApplication
${CURDIR}/singleapp/singleapplication.cpp
${CURDIR}/singleapp/singleapplication_p.cpp
# needed to trigger moc generation
${CURDIR}/Enums.h
......@@ -31,3 +27,10 @@ set(KAIDAN_SOURCES
${CURDIR}/qxmpp-exts/QXmppUploadRequestManager.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 @@
#endif
#include QT_STRINGIFY(QAPPLICATION_CLASS)
#ifndef Q_OS_ANDROID
#if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID)
// SingleApplication (Qt5 replacement for QtSingleApplication)
#include "singleapp/singleapplication.h"
#endif
......@@ -76,6 +76,10 @@
#include <QtAndroid>
#endif
#ifdef Q_OS_WIN
#include <windows.h>
#endif
enum CommandLineParseResult {
CommandLineOk,
CommandLineError,
......@@ -115,7 +119,7 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef _WIN32
#ifdef Q_OS_WIN
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
......@@ -141,7 +145,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// create a qt app
#ifdef Q_OS_ANDROID
#if defined(Q_OS_IOS) || defined(Q_OS_ANDROID)
QGuiApplication app(argc, argv);
#else
SingleApplication app(argc, argv, true);
......@@ -194,7 +198,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
break;
}
#ifndef Q_OS_ANDROID
#if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID)
// check if another instance already runs
if (app.isSecondary() && !parser.isSet("multiple")) {
qDebug().noquote() << QString("Another instance of %1 is already running.")
......@@ -215,7 +219,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
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
kaidan.connect(&app, &SingleApplication::receivedMessage,
&kaidan, &Kaidan::receiveMessage);
......
......@@ -31,7 +31,7 @@
// This file imports static plugin classes for static plugins
#include <QtPlugin>
#ifdef __APPLE__
#ifdef Q_OS_IOS
Q_IMPORT_PLUGIN(QIOSIntegrationPlugin)
Q_IMPORT_PLUGIN(QMacHeifPlugin)
Q_IMPORT_PLUGIN(QMacJp2Plugin)
......@@ -40,9 +40,11 @@ Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QTiffPlugin)
Q_IMPORT_PLUGIN(QWbmpPlugin)
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
Q_IMPORT_PLUGIN(QSvgPlugin)
......
......@@ -25,9 +25,10 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}"
ANDROID_SDK_BUILD_TOOLS_REVISION=${ANDROID_SDK_BUILD_TOOLS_REVISION:-25.0.3}
# Build API version
ANDROID_API_VERSION=21
# Build architecture
ANDROID_ARCH=${ANDROID_ARCH:-armv7}
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
GLOOX_PATH=/tmp/gloox
OPENSSL_PATH=/tmp/openssl
OPENSSL_SETENV=$OPENSSL_PATH/Setenv-android.sh
CUSTOM_ANDROID_TOOLCHAIN=/tmp/android-arm-toolchain
......@@ -38,14 +39,14 @@ echo "*****************************************"
echo "Fetching dependencies if required"
echo "*****************************************"
if [ ! -d "$GLOOX_PATH" ]; then
echo "Cloning Gloox from SVN"
svn co svn://svn.camaya.net/gloox/branches/1.0 $GLOOX_PATH
if [ ! -d "$KAIDAN_SOURCES/3rdparty/qxmpp/.git" ]; then
echo "Cloning QXmpp"
git clone https://github.com/qxmpp-project/qxmpp.git 3rdparty/qxmpp
fi
if [ ! -d "$OPENSSL_PATH" ]; then
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
if [ ! -f "$OPENSSL_SETENV" ]; then
......@@ -78,41 +79,27 @@ echo "*****************************************"
{
cd $OPENSSL_PATH
source ./Setenv-android.sh
source $OPENSSL_SETENV
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 "*****************************************"
{
# Add the standalone toolchain to the search path.
export PATH=$CUSTOM_ANDROID_TOOLCHAIN/bin:$PATH
# Tell configure what tools to use.
export target_host=arm-linux-androideabi
export AR=$target_host-ar
export AS=$target_host-clang
export CC=$target_host-clang
export CXX=$target_host-clang++
export LD=$target_host-ld
export STRIP=$target_host-strip
# Tell configure what flags Android requires.
export CFLAGS="-fPIE -fPIC"
export LDFLAGS="-pie"
cd $GLOOX_PATH
./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
case ${ANDROID_ARCH} in
x86)
sed -ie 's/_ANDROID_ARCH=.*$/_ANDROID_ARCH="arch-x86"/' $OPENSSL_SETENV
sed -ie 's/_ANDROID_EABI=.*$/_ANDROID_EABI="x86-4.9"/' $OPENSSL_SETENV
;;
armv7)
sed -ie 's/_ANDROID_ARCH=.*$/_ANDROID_ARCH="arch-arm"/' $OPENSSL_SETENV
sed -ie 's/_ANDROID_EABI=.*$/_ANDROID_EABI="arm-linux-androideabi-4.9"/' $OPENSSL_SETENV
;;
esac
./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}
make depend
make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" build_libs -j$(nproc) || return
make -k CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" install_sw -j$(nproc)
cp -v libcrypto.so libssl.so $CUSTOM_ANDROID_TOOLCHAIN/lib
}
fi
......@@ -124,6 +111,28 @@ cdnew() {
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
echo "*****************************************"
echo "Building Kirigami"
......@@ -132,7 +141,7 @@ echo "*****************************************"
cdnew $KAIDAN_SOURCES/3rdparty/kirigami/build
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/ \
-DANDROID_NDK=$ANDROID_NDK_ROOT \
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \
......@@ -145,7 +154,7 @@ echo "*****************************************"
}
fi
if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-ldpi" ]; then
if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-xxxhdpi" ]; then
echo "*****************************************"
echo "Rendering logos"
echo "*****************************************"
......@@ -168,6 +177,8 @@ if [ ! -d "$KAIDAN_SOURCES/misc/android/res/mipmap-ldpi" ]; then
androidlogo xxxhdpi 192
fi
export PKG_CONFIG_PATH=$CUSTOM_ANDROID_TOOLCHAIN/lib/pkgconfig
echo "*****************************************"
echo "Building Kaidan"
echo "*****************************************"
......@@ -183,7 +194,7 @@ echo "*****************************************"
-DANDROID_SDK_BUILD_TOOLS_REVISION=$ANDROID_SDK_BUILD_TOOLS_REVISION \
-DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN \
-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)
}
......
......@@ -13,6 +13,7 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}"
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
KIRIGAMI_BUILD=/tmp/kirigami-linux-build
QXMPP_BUILD=/tmp/qxmpp-linux-build
echo "-- Starting $BUILD_TYPE build of Kaidan --"
......@@ -25,6 +26,11 @@ if [ ! -f "$KAIDAN_SOURCES/3rdparty/kirigami/.git" ] || [ ! -f "$KAIDAN_SOURCES/
git submodule update --init
fi
if [ ! -d "$KAIDAN_SOURCES/3rdparty/qxmpp/.git" ]; then
echo "Cloning QXmpp"
git clone https://github.com/qxmpp-project/qxmpp.git 3rdparty/qxmpp
fi
if [ ! -f "$KAIDAN_SOURCES/3rdparty/linuxdeployqt-continuous-x86_64.AppImage" ]; then
echo "Downloading linuxdeployqt"
wget -P $KAIDAN_SOURCES/3rdparty/ https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
......@@ -41,6 +47,24 @@ cdnew() {
export QT_SELECT=qt5
if [ ! -f "$QXMPP_BUILD/lib/pkgconfig/qxmpp.pc" ]; then
echo "*****************************************"
echo "Building QXmpp"
echo "*****************************************"
{
cdnew $KAIDAN_SOURCES/3rdparty/qxmpp/build
cmake .. \
-DCMAKE_PREFIX_PATH=$QT_LINUX \
-DBUILD_EXAMPLES=OFF \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$QXMPP_BUILD \
-DCMAKE_INSTALL_LIBDIR=$QXMPP_BUILD/lib
make -j$(nproc)
make install
rm -rf $KAIDAN_SOURCES/3rdparty/qxmpp/build
}
fi
if [ ! -f "$KIRIGAMI_BUILD/lib/libKF5Kirigami2.so" ]; then
echo "*****************************************"
echo "Building Kirigami"
......@@ -59,6 +83,8 @@ echo "*****************************************"
}
fi
export PKG_CONFIG_PATH=$QXMPP_BUILD/lib/pkgconfig
if [ ! -f "$KAIDAN_SOURCES/build/bin/kaidan" ]; then
echo "*****************************************"
echo "Building Kaidan"
......@@ -68,8 +94,8 @@ echo "*****************************************"
cmake .. \
-DECM_DIR=/usr/share/ECM/cmake \
-DCMAKE_PREFIX_PATH=$QT_LINUX \
-DKF5Kirigami2_DIR=$KIRIGAMI_BUILD/lib/cmake/KF5Kirigami2 -DI18N=1 \
-DCMAKE_PREFIX_PATH=$QT_LINUX\;$KIRIGAMI_BUILD\;$QXMPP_BUILD \
-DI18N=1 \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr
make -j$(nproc)
......
......@@ -13,6 +13,7 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}"
KAIDAN_SOURCES=$(dirname "$(greadlink -f "${0}")")/..
KIRIGAMI_BUILD=/tmp/kirigami-mac-build
QXMPP_BUILD=/tmp/qxmpp-mac-build
echo "-- Starting $BUILD_TYPE build of Kaidan --"
......@@ -25,6 +26,11 @@ if [ ! -f "$KAIDAN_SOURCES/3rdparty/kirigami/.git" ] || [ ! -f "$KAIDAN_SOURCES/
git submodule update --init
fi
if [ ! -d "$KAIDAN_SOURCES/3rdparty/qxmpp/.git" ]; then
echo "Cloning QXmpp"
git clone https://github.com/qxmpp-project/qxmpp.git 3rdparty/qxmpp
fi
cdnew() {
if [ -d "$1" ]; then
rm -rf "$1"
......@@ -33,6 +39,24 @@ cdnew() {
cd $1
}
export QT_SELECT=qt5
if [ ! -f "$QXMPP_BUILD/lib/pkgconfig/qxmpp.pc" ]; then
echo "*****************************************"
echo "Building QXmpp"
echo "*****************************************"
{
cdnew $KAIDAN_SOURCES/3rdparty/qxmpp/build
cmake .. \
-DCMAKE_PREFIX_PATH=$QT_MACOS \
-DBUILD_EXAMPLES=OFF \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$QXMPP_BUILD
make -j$(sysctl -n hw.logicalcpu)
make install
rm -rf $KAIDAN_SOURCES/3rdparty/qxmpp/build
}
fi
if [ ! -f "$KIRIGAMI_BUILD/lib/libKF5Kirigami2.dylib" ]; then
echo "*****************************************"
echo "Building Kirigami"
......@@ -45,53 +69,59 @@ echo "*****************************************"
-DECM_ADDITIONAL_FIND_ROOT_PATH=$QT_MACOS \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$KIRIGAMI_BUILD
make -j$(nproc)
make -j$(sysctl -n hw.logicalcpu)
make install
rm -rf $KAIDAN_SOURCES/3rdparty/kirigami/build
}
fi
if [ ! -f "$KAIDAN_SOURCES/misc/macos/kaidan.icns" ]; then
echo "*****************************************"
echo "Rendering logos"
echo "*****************************************"
if [ ! $(command -v inkscape) ] || [ ! $(command -v optipng) ]; then
echo "Icons can'be generated"
exit 1
fi
rendersvg() {
inkscape -z -e $2 -w $3 -h $3 -d $4 $1
optipng -quiet $2
}
macoslogo() {
rendersvg $KAIDAN_SOURCES/misc/kaidan-small-margin.svg "$KAIDAN_SOURCES/misc/macos/kaidan.iconset/icon_$1x$1.png" $1 72
rendersvg $KAIDAN_SOURCES/misc/kaidan-small-margin.svg "$KAIDAN_SOURCES/misc/macos/kaidan.iconset/icon_$(( $1 * 2 ))x$(( $1 * 2 ))@2x.png" $(( $1 * 2 )) 144
}
mkdir -p $KAIDAN_SOURCES/misc/macos/kaidan.iconset
macoslogo 16
macoslogo 32
macoslogo 128
macoslogo 256
macoslogo 512
iconutil --convert icns "$KAIDAN_SOURCES/misc/macos/kaidan.iconset"
fi
export PKG_CONFIG_PATH=$QXMPP_BUILD/lib/pkgconfig
if [ ! -f "$KAIDAN_SOURCES/build/bin/kaidan" ]; then
echo "*****************************************"
echo "Building Kaidan"
echo "*****************************************"
{
cdnew $KAIDAN_SOURCES/build
cmake .. \
-DECM_DIR=/usr/local/share/ECM/cmake \
-DCMAKE_PREFIX_PATH=$QT_MACOS \
-DECM_ADDITIONAL_FIND_ROOT_PATH=$QT_MACOS \
-DCMAKE_PREFIX_PATH=$QT_MACOS\;$KIRIGAMI_BUILD\;$QXMPP_BUILD \
-DKF5Kirigami2_DIR=$KIRIGAMI_BUILD/lib/cmake/KF5Kirigami2 -DI18N=1 \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
make -j$(nproc)
}
fi
if [ ! -f "$KAIDAN_SOURCES/misc/macos/kaidan.icns" ]; then
echo "*****************************************"
echo "Rendering logos"
echo "*****************************************"
rendersvg() {
inkscape -z -e $2 -w $3 -h $3 -d $4 $1
optipng -quiet $2
}
macoslogo() {
rendersvg $KAIDAN_SOURCES/misc/kaidan-small-margin.svg "$KAIDAN_SOURCES/misc/macos/kaidan.iconset/icon_$1x$1.png" $1 72
rendersvg $KAIDAN_SOURCES/misc/kaidan-small-margin.svg "$KAIDAN_SOURCES/misc/macos/kaidan.iconset/icon_$(( $1 * 2 ))x$(( $1 * 2 ))@2x.png" $(( $1 * 2 )) 144
}
mkdir -p $KAIDAN_SOURCES/misc/macos/kaidan.iconset
macoslogo 16
macoslogo 32
macoslogo 128
macoslogo 256
macoslogo 512
iconutil --convert icns "$KAIDAN_SOURCES/misc/macos/kaidan.iconset"
make -j$(sysctl -n hw.logicalcpu)
}
fi
echo "*****************************************"
......
......@@ -16,8 +16,6 @@ BUILD_TYPE="${BUILD_TYPE:-Debug}"
MXE_TARGET="${MXE_TARGET:-i686-w64-mingw32.static}"
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
KIRIGAMI_BUILD=/tmp/kirigami-linux-build
GLOOX_BUILD=/tmp/gloox-windows-build
echo "-- Starting $BUILD_TYPE build of Kaidan --"
......@@ -30,9 +28,9 @@ if [ ! -f "$KAIDAN_SOURCES/3rdparty/kirigami/.git" ] || [ ! -f "$KAIDAN_SOURCES/
git submodule update --init
fi
if [ ! -d "$GLOOX_BUILD" ]; then
echo "Cloning Gloox from SVN"
svn co svn://svn.camaya.net/gloox/branches/1.0 $GLOOX_BUILD
if [ ! -d "$KAIDAN_SOURCES/3rdparty/qxmpp/.git" ]; then
echo "Cloning QXmpp"
git clone https://github.com/qxmpp-project/qxmpp.git 3rdparty/qxmpp
fi