u_setDataDirectory to define path to ICU data.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-11-28 16:42:06 +02:00
parent 866a801f38
commit 50b929ea48
9 changed files with 38 additions and 12 deletions

View File

@ -43,9 +43,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(flags);
Q_INIT_RESOURCE(style);
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(APPIMAGE)
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
@ -53,6 +51,8 @@ int main(int argc, char *argv[])
VAbstractApplication::SetICUData(argc, argv);
#endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
#endif
@ -64,8 +64,6 @@ int main(int argc, char *argv[])
MApplication app(argc, argv);
app.InitOptions();
qDebug() << "ICU_DATA: " << qgetenv("ICU_DATA");
if (FvUpdater::IsStaledTestBuild())
{
qWarning() << QApplication::translate("Tape",

View File

@ -430,6 +430,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing
} else {

View File

@ -47,9 +47,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(toolicon);
Q_INIT_RESOURCE(style);
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(APPIMAGE)
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
@ -57,6 +55,8 @@ int main(int argc, char *argv[])
VAbstractApplication::SetICUData(argc, argv);
#endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
#endif
@ -73,8 +73,6 @@ int main(int argc, char *argv[])
VApplication app(argc, argv);
app.InitOptions();
qDebug() << "ICU_DATA: " << qgetenv("ICU_DATA");
if (FvUpdater::IsStaledTestBuild())
{
qWarning() << QApplication::translate("Valentina",

View File

@ -682,6 +682,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing
} else {

View File

@ -49,9 +49,14 @@
# include <unistd.h>
#endif
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
# include "unicode/putil.h"
#endif
namespace
{
QString ApplicationFilePath(int &argc, char **argv)
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
QString ApplicationFilePath(const int &argc, char **argv)
{
if (argc)
{
@ -109,6 +114,7 @@ QString ApplicationFilePath(int &argc, char **argv)
#endif
return QString();
}
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
}
const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
@ -340,6 +346,7 @@ bool VAbstractApplication::IsPatternMessage(const QString &message) const
return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature);
}
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::SetICUData(int &argc, char **argv)
{
@ -348,8 +355,9 @@ void VAbstractApplication::SetICUData(int &argc, char **argv)
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
*/
const QString appDirPath = QFileInfo(ApplicationFilePath(argc, argv)).path();
qputenv("ICU_DATA", QString(appDirPath + QStringLiteral("/../share/icu")).toUtf8());
u_setDataDirectory(QString(appDirPath + QStringLiteral("/../share/icu")).toUtf8());
}
#endif // defined(Q_OS_LINUX)
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_OS_WIN)

View File

@ -129,7 +129,9 @@ public:
static const QString patternMessageSignature;
bool IsPatternMessage(const QString &message) const;
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
static void SetICUData(int &argc, char ** argv);
#endif
protected:
QUndoStack *undoStack;

View File

@ -188,6 +188,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
TAPE_TEST_FILES += \
tst_tape/keiko.vit \
tst_tape/empty.vit \

View File

@ -163,3 +163,7 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
INCLUDEPATH += $${PWD}/../../libs/qmuparser
DEPENDPATH += $${PWD}/../../libs/qmuparser
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}

View File

@ -226,6 +226,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
DATA_RESOURCE = share/test_data.qrc # External Binary Resource
!exists($${OUT_PWD}/$${DESTDIR}/test_data.rcc) {