Merge remote-tracking branch 'origin/feature/develop-and' into develop

Add support android build
This commit is contained in:
Oleg Korshul
2020-04-19 15:37:56 +03:00
11 changed files with 195 additions and 33 deletions

View File

@ -18,6 +18,10 @@ core_windows:DEFINES -= UNICODE _UNICODE
DEFINES += CRYPTOPP_DISABLE_ASM
core_android {
INCLUDEPATH += $$(ANDROID_NDK_ROOT)/sources/android/cpufeatures
}
HEADERS += \
../3way.h \
../adler32.h \

View File

@ -240,8 +240,11 @@ core_ios {
}
}
core_android {
equals(QT_ARCH, arm): CORE_BUILDS_PLATFORM_PREFIX = android_arm
equals(QT_ARCH, i386): CORE_BUILDS_PLATFORM_PREFIX = android_x86
CORE_BUILDS_PLATFORM_PREFIX = $$join(ANDROID_TARGET_ARCH, ANDROID_TARGET_ARCH, "android_", "")
!core_android_no_unistd {
DEFINES += HAVE_UNISTD_H
}
}
core_debug {
@ -380,3 +383,5 @@ defineTest(ADD_DEPENDENCY) {
export(LIBS)
}
ADD_INC_PATH = $$(ADDITIONAL_INCLUDE_PATH)
!isEmpty(ADD_INC_PATH):INCLUDEPATH += $$ADD_INC_PATH

View File

@ -68,6 +68,21 @@ core_ios {
LIBS += -framework Foundation
}
core_android {
DEFINES += USE_FILE32API
SOURCES += ./FileDownloader/FileDownloader_curl.cpp
CONFIG += use_external_download
use_external_download {
DEFINES += USE_EXTERNAL_DOWNLOAD
} else {
include(../Common/3dParty/curl/curl.pri)
}
DEFINES += NOT_USE_PTHREAD_CANCEL
}
# CONFIG
HEADERS += ./kernel_config.h

View File

@ -10,10 +10,6 @@
* Copyright 1997-2007 by Dave Coffin, dcoffin a cybercom o net
*/
#ifdef __ANDROID__
#include <swab.h>
#endif
#include "ximaraw.h"
#include "../../common/File.h"

View File

@ -45,9 +45,30 @@
#if defined(_LINUX) || defined(__APPLE__)
#include <setjmp.h>
#include <sys/types.h>
#define _swab swab
#define _getcwd getcwd
#include <time.h>
#ifdef __ANDROID__
#include <unistd.h>
#if __ANDROID_API__ < 28
static void swab(const char* __src, char* __dst, ssize_t __byte_count)
{
ssize_t len = __byte_count;
if (1 == (len & 1))
{
__dst[len - 1] = __src[len - 1];
len -= 1;
}
for (ssize_t i = 0; i < len; i += 2)
{
__dst[i] = __src[i + 1];
__dst[i + 1] = __src[i];
}
}
#endif
#define _swab swab
#endif
#endif
#define DCR_VERSION "8.93"

View File

@ -31,6 +31,9 @@ ADD_DEPENDENCY(graphics, kernel, UnicodeConverter)
core_ios {
CONFIG += doct_renderer_empty
}
core_android {
CONFIG += doct_renderer_empty
}
doct_renderer_empty {
SOURCES += doctrenderer_empty.cpp

View File

@ -30,7 +30,7 @@
*
*/
#ifdef __ANDROID__
#if defined(__ANDROID__) && !defined (NOT_USE_PTHREAD_CANCEL)
#include <pthread_setcanceltype.h>
#endif
@ -111,9 +111,11 @@ namespace NSThreads
};
#else
void* CBaseThread::__ThreadProc(void* pv)
{
{
#ifndef NOT_USE_PTHREAD_CANCEL
int old_thread_type;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old_thread_type);
#endif
CBaseThread* pThis = (CBaseThread*)pv;
pThis->ThreadProc();

View File

@ -21,7 +21,7 @@ DEFINES -= \
UNICODE \
_UNICODE
core_linux {
!core_windows {
DEFINES += \
HAVE_UNISTD_H \
HAVE_MBSTATE_T \
@ -31,27 +31,8 @@ core_linux {
UNIX \
HAVE_STDINCLUDES
}
core_mac {
DEFINES += \
HAVE_UNISTD_H \
HAVE_MBSTATE_T \
GCONTAINER_NO_MEMBER_TEMPLATES="1" \
HAS_WCHAR \
HAVE_WCHAR_H \
UNIX \
HAVE_STDINCLUDES
}
core_ios {
DEFINES += \
HAVE_UNISTD_H \
HAVE_MBSTATE_T \
GCONTAINER_NO_MEMBER_TEMPLATES="1" \
HAS_WCHAR \
HAVE_WCHAR_H \
UNIX \
HAVE_STDINCLUDES
core_android {
DEFINES += HAS_MBSTATE="1"
}
core_windows {

View File

@ -25,6 +25,9 @@ DEFINES += NOMINMAX
core_linux {
QMAKE_CXXFLAGS += -Wno-narrowing
}
core_android {
QMAKE_CXXFLAGS += -Wno-narrowing
}
core_windows {
DEFINES -= UNICODE

View File

@ -22,10 +22,16 @@ core_ios {
CONFIG += bundle_dylibs
}
include(../Common/3dParty/icu/icu.pri)
core_android {
CONFIG += core_disable_icu
SOURCES += UnicodeConverter_internal_android.cpp
}
!core_disable_icu {
include(../Common/3dParty/icu/icu.pri)
SOURCES += \
UnicodeConverter.cpp
UnicodeConverter.cpp
HEADERS +=\
UnicodeConverter.h

View File

@ -0,0 +1,126 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "./UnicodeConverter.h"
#include "../DesktopEditor/common/File.h"
namespace NSUnicodeConverter
{
class CUnicodeConverter_Private
{
public:
CUnicodeConverter_Private()
{
}
~CUnicodeConverter_Private()
{
}
std::string SASLprepToUtf8(const wchar_t* sInput, const unsigned int& nInputLen)
{
// TODO:
return "";
}
std::string fromUnicode(const wchar_t* sInput, const unsigned int& nInputLen, const char* converterName)
{
std::string sRes = "";
if (sRes.empty() && nInputLen > 0)
{
std::wstring ws(sInput, nInputLen);
sRes = std::string(ws.begin(), ws.end());
}
return sRes;
}
std::wstring toUnicode(const char* sInput, const unsigned int& nInputLen, int nCodePage, bool isExact)
{
std::wstring sRes = L"";
if (!isExact && sRes.empty() && nInputLen > 0)
{
std::string ws(sInput, nInputLen);
sRes = std::wstring(ws.begin(), ws.end());
}
return sRes;
}
std::wstring toUnicode(const char* sInput, const unsigned int& nInputLen, const char* converterName, bool isExact)
{
std::wstring sRes = L"";
if (isExact && sRes.empty() && nInputLen > 0)
{
std::string ws(sInput, nInputLen);
sRes = std::wstring(ws.begin(), ws.end());
}
return sRes;
}
};
}
namespace NSUnicodeConverter
{
CUnicodeConverter::CUnicodeConverter()
{
m_pInternal = new CUnicodeConverter_Private();
}
CUnicodeConverter::~CUnicodeConverter()
{
delete m_pInternal;
}
std::string CUnicodeConverter::fromUnicode(const wchar_t* sInput, const unsigned int& nInputLen, const char* converterName)
{
return m_pInternal->fromUnicode(sInput, nInputLen, converterName);
}
std::string CUnicodeConverter::fromUnicode(const std::wstring &sInput, const char *converterName)
{
return this->fromUnicode(sInput.c_str(), (unsigned int)sInput.size(), converterName);
}
std::wstring CUnicodeConverter::toUnicode(const char* sInput, const unsigned int& nInputLen, const char* converterName, bool isExact)
{
return m_pInternal->toUnicode(sInput, nInputLen, converterName, isExact);
}
std::wstring CUnicodeConverter::toUnicode(const std::string &sInput, const char *converterName, bool isExact)
{
return this->toUnicode(sInput.c_str(), (unsigned int)sInput.size(), converterName, isExact);
}
std::wstring CUnicodeConverter::toUnicode(const char* sInput, const unsigned int& nInputLen, int nCodePage, bool isExact)
{
return m_pInternal->toUnicode(sInput, nInputLen, nCodePage, isExact);
}
std::wstring CUnicodeConverter::toUnicode(const std::string &sInput, int nCodePage, bool isExact)
{
return this->toUnicode(sInput.c_str(), (unsigned int)sInput.size(), nCodePage, isExact);
}
std::string CUnicodeConverter::SASLprepToUtf8(const std::wstring &sSrc)
{
return m_pInternal->SASLprepToUtf8(sSrc.c_str(), sSrc.length());
}
}