diff --git a/Common/3dParty/v8/v8.pri b/Common/3dParty/v8/v8.pri index 6a804160d2..388cbb982f 100644 --- a/Common/3dParty/v8/v8.pri +++ b/Common/3dParty/v8/v8.pri @@ -1,5 +1,4 @@ CORE_V8_PATH_OVERRIDE=$$PWD - !v8_version_60:CONFIG += v8_version_89 v8_version_89 { @@ -17,6 +16,15 @@ v8_version_89 { CORE_V8_PATH_INCLUDE = $$CORE_V8_PATH_OVERRIDE/v8 CORE_V8_PATH_LIBS = $$CORE_V8_PATH_INCLUDE/out.gn/$$CORE_BUILDS_PLATFORM_PREFIX/obj +core_android { + CORE_V8_PATH_INCLUDE = $$CORE_V8_PATH_OVERRIDE/android/v8 + + isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_arm64_v8a):CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/arm64-v8a + isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_armv7): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/armeabi-v7a + isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/x86 + isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86_64): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/x86_64 +} + INCLUDEPATH += \ $$CORE_V8_PATH_INCLUDE \ $$CORE_V8_PATH_INCLUDE/include @@ -66,3 +74,8 @@ core_mac { QMAKE_CXXFLAGS += -Wall -Wno-inconsistent-missing-override QMAKE_CFLAGS += -Wall -Wno-inconsistent-missing-override } + +core_android { + LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_nosnapshot -lv8_libsampler + LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc +} diff --git a/DesktopEditor/doctrenderer/doctrenderer.pro b/DesktopEditor/doctrenderer/doctrenderer.pro index 921ccff697..73c51d6844 100644 --- a/DesktopEditor/doctrenderer/doctrenderer.pro +++ b/DesktopEditor/doctrenderer/doctrenderer.pro @@ -15,18 +15,8 @@ include(../../Common/base.pri) ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network) #CONFIG += build_xp +core_android:DEFINES += DISABLE_MEMORY_LIMITATION -core_ios { - CONFIG += doct_renderer_empty -} -core_android { - DEFINES += DISABLE_MEMORY_LIMITATION - CONFIG += doct_renderer_empty -} - -doct_renderer_empty { -SOURCES += doctrenderer_empty.cpp -} else { HEADERS += \ config.h \ doctrenderer.h \ @@ -70,10 +60,6 @@ SOURCES += \ embed/TextMeasurerEmbed.cpp \ embed/Default.cpp -core_mac { - !use_v8:CONFIG += use_javascript_core -} - include($$PWD/js_internal/js_base.pri) !use_javascript_core { @@ -83,8 +69,8 @@ include($$PWD/js_internal/js_base.pri) embed/v8/v8_NativeBuilder.cpp \ embed/v8/v8_Graphics.cpp \ embed/v8/v8_Zip.cpp \ - embed/v8/v8_Pointer.cpp \ - embed/v8/v8_TextMeasurer.cpp + embed/v8/v8_Pointer.cpp \ + embed/v8/v8_TextMeasurer.cpp build_xp:DESTDIR=$$DESTDIR/xp } else { @@ -95,12 +81,11 @@ include($$PWD/js_internal/js_base.pri) embed/jsc/jsc_NativeControl.mm \ embed/jsc/jsc_NativeBuilder.mm \ embed/jsc/jsc_Zip.mm \ - embed/jsc/jsc_Pointer.mm \ - embed/jsc/jsc_TextMeasurer.mm + embed/jsc/jsc_Pointer.mm \ + embed/jsc/jsc_TextMeasurer.mm LIBS += -framework Foundation } -} include(../graphics/pro/textshaper.pri) diff --git a/DesktopEditor/doctrenderer/doctrenderer_empty.cpp b/DesktopEditor/doctrenderer/doctrenderer_empty.cpp deleted file mode 100644 index d2517b5a60..0000000000 --- a/DesktopEditor/doctrenderer/doctrenderer_empty.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * 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-6 Ernesta Birznieka-Upish - * 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 "doctrenderer.h" -#include "docbuilder.h" - -#ifdef BOOL -#undef BOOL -#endif - -#include - -namespace NSDoctRenderer -{ - CString::CString() {} - CString::CString(const CString& src) {} - CString& CString::operator=(const CString& src) { return *this; } - wchar_t* CString::c_str() const { return NULL; } - - CDocBuilderValue::CDocBuilderValue() {} - CDocBuilderValue::CDocBuilderValue(const CDocBuilderValue& src) {} - CDocBuilderValue& CDocBuilderValue::operator=(const CDocBuilderValue& src) { return *this; } - CDocBuilderValue::~CDocBuilderValue() {} - void* private_get_internal() { return NULL; } - - bool CDocBuilderValue::IsEmpty() { return true; } - void CDocBuilderValue::Clear() {} - - bool CDocBuilderValue::IsNull() { return false; } - bool CDocBuilderValue::IsUndefined() { return false; } - bool CDocBuilderValue::IsBool() { return false; } - bool CDocBuilderValue::IsInt() { return false; } - bool CDocBuilderValue::IsDouble() { return false; } - bool CDocBuilderValue::IsString() { return false; } - bool CDocBuilderValue::IsFunction() { return false; } - bool CDocBuilderValue::IsObject() { return false; } - bool CDocBuilderValue::IsArray() { return false; } - bool CDocBuilderValue::IsTypedArray() { return false; } - - unsigned int CDocBuilderValue::GetLength() { return 0; } - bool CDocBuilderValue::ToBool() { return false; } - int CDocBuilderValue::ToInt() { return 0; } - double CDocBuilderValue::ToDouble() { return 0; } - CString CDocBuilderValue::ToString() { return CString(); } - - CDocBuilderValue CDocBuilderValue::GetProperty(const wchar_t* name) { CDocBuilderValue ret; return ret; } - - CDocBuilderValue CDocBuilderValue::Get(const char* name) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Get(const wchar_t* name) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::operator[](const char* name) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::operator[](const wchar_t* name) { CDocBuilderValue ret; return ret; } - - CDocBuilderValue CDocBuilderValue::Get(const int& index) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::operator[](const int& index) { CDocBuilderValue ret; return ret; } - - void CDocBuilderValue::SetProperty(const wchar_t* name, CDocBuilderValue value) {} - void CDocBuilderValue::Set(const wchar_t* name, CDocBuilderValue value) {} - void CDocBuilderValue::Set(const int& index, CDocBuilderValue value) {} - - // primitives - CDocBuilderValue::CDocBuilderValue(const bool& value) {} - CDocBuilderValue::CDocBuilderValue(const int& value) {} - CDocBuilderValue::CDocBuilderValue(const unsigned int& value) {} - CDocBuilderValue::CDocBuilderValue(const double& value) {} - CDocBuilderValue::CDocBuilderValue(const char* value) {} - CDocBuilderValue::CDocBuilderValue(const wchar_t* value) {} - - CDocBuilderValue CDocBuilderValue::CreateUndefined() { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::CreateNull() { CDocBuilderValue ret; return ret; } - - CDocBuilderValue CDocBuilderValue::Call(const char* name) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5, CDocBuilderValue p6) { CDocBuilderValue ret; return ret; } - - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5, CDocBuilderValue p6) { CDocBuilderValue ret; return ret; } - - CDocBuilderContextScope::CDocBuilderContextScope() {} - CDocBuilderContextScope::CDocBuilderContextScope(const CDocBuilderContextScope& src) {} - CDocBuilderContextScope& CDocBuilderContextScope::operator=(const CDocBuilderContextScope& src) { return *this; } - CDocBuilderContextScope::~CDocBuilderContextScope() {} - void CDocBuilderContextScope::Close() {} - - CDocBuilderContext::CDocBuilderContext() {} - CDocBuilderContext::CDocBuilderContext(const CDocBuilderContext& src) {} - CDocBuilderContext& CDocBuilderContext::operator=(const CDocBuilderContext& src) { return *this; } - CDocBuilderContext::~CDocBuilderContext() {} - - CDocBuilderValue CDocBuilderContext::CreateUndefined() { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderContext::CreateNull() { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderContext::CreateObject() { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderContext::CreateArray(const int& length) { CDocBuilderValue ret; return ret; } - CDocBuilderValue CDocBuilderContext::CreateTypedArray(unsigned char* buffer, const int& length, const bool& externalize) { CDocBuilderValue ret; return ret; } - - CDocBuilderValue CDocBuilderContext::GetGlobal() { CDocBuilderValue ret; return ret; } - CDocBuilderContextScope CDocBuilderContext::CreateScope() { CDocBuilderContextScope ret; return ret; } - bool CDocBuilderContext::IsError() { return true; } -} - -namespace NSDoctRenderer -{ - CDocBuilder::CDocBuilder() {} - CDocBuilder::~CDocBuilder() {} - - int CDocBuilder::OpenFile(const wchar_t* path, const wchar_t* params) { return 0; } - bool CDocBuilder::CreateFile(const int& type) { return false; } - void CDocBuilder::SetTmpFolder(const wchar_t* folder) {} - int CDocBuilder::SaveFile(const int& type, const wchar_t* path, const wchar_t* params) { return 0; } - void CDocBuilder::CloseFile() {} - bool CDocBuilder::ExecuteCommand(const wchar_t* command, CDocBuilderValue* retValue) { return false; } - - bool CDocBuilder::Run(const wchar_t* path) { return false; } - - bool CDocBuilder::RunTextW(const wchar_t* commands) { return false; } - bool CDocBuilder::RunTextA(const char* commands) { return false; } - - void CDocBuilder::SetProperty(const char* param, const wchar_t* value) {} - void CDocBuilder::SetPropertyW(const wchar_t* param, const wchar_t* value) {} - - void CDocBuilder::WriteData(const wchar_t* path, const wchar_t* value, const bool& append) {} - bool CDocBuilder::IsSaveWithDoctrendererMode() { return false; } - - char* CDocBuilder::GetVersion() { return "0.0"; } - - CDocBuilderContext CDocBuilder::GetContext() - { - return CDocBuilderContext(); - } - - void CDocBuilder::Initialize(const wchar_t* directory) {} - void CDocBuilder::Dispose() {} -} - -namespace NSDoctRenderer -{ - CDoctrenderer::CDoctrenderer(const std::wstring& sAllFontsPath) {} - - CDoctrenderer::~CDoctrenderer() {} - - void CDoctrenderer::LoadConfig(const std::wstring& sConfigDir, const std::wstring& sAllFontsPath) - { - } - - bool CDoctrenderer::Execute(const std::wstring& strXml, std::wstring& strError) - { - return false; - } - - std::vector CDoctrenderer::GetImagesInChanges() - { - std::vector stub; - return stub; - } - - void CDoctrenderer::CreateCache(const std::wstring& sAllFontsPath, const std::wstring& sCacheDir) - { - } -} diff --git a/DesktopEditor/doctrenderer/js_internal/js_base.pri b/DesktopEditor/doctrenderer/js_internal/js_base.pri index b1a387b70c..0a3c8f4c8d 100644 --- a/DesktopEditor/doctrenderer/js_internal/js_base.pri +++ b/DesktopEditor/doctrenderer/js_internal/js_base.pri @@ -19,8 +19,11 @@ SOURCES += $$PWD/js_logger.cpp SOURCES += $$PWD/v8/v8_base.cpp core_mac:CONFIG += disable_v8_use_inspector - linux_arm64:CONFIG += disable_v8_use_inspector - build_xp::CONFIG += disable_v8_use_inspector + core_android:CONFIG += disable_v8_use_inspector + linux_arm64:CONFIG += disable_v8_use_inspector + build_xp::CONFIG += disable_v8_use_inspector + + core_android:CONFIG += v8_version_60 !disable_v8_use_inspector:CONFIG += v8_use_inspector diff --git a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h index e7453cb77a..a3ab16f946 100644 --- a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h +++ b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h @@ -50,7 +50,7 @@ v8::Local CreateV8String(v8::Isolate* i, const char* str, const int& len = -1); v8::Local CreateV8String(v8::Isolate* i, const std::string& str); -#ifdef __ANDROID__ +#ifdef ANDROID_LOGS #include #endif @@ -796,9 +796,7 @@ namespace NSJSBase } #endif -#ifndef __ANDROID__ - std::cerr << strException << std::endl; -#else +#ifdef ANDROID_LOGS LOGE("NSJSBase::CV8TryCatch::Check() - error:"); LOGE(std::to_string(nLineNumber).c_str()); LOGE(strCode.c_str());