summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-10-19 12:30:05 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-28 15:31:03 +0000
commitfd9ea99947a22484aba900fa181507c0535c8c74 (patch)
tree332433a06ffff9ef68d92267eb01d867ea5cf193 /src
parent03aa3ebb91683eb48c263d8d6575d5935e5352e2 (diff)
Fix some issues with icu for dict tool
The dict tool can be run during the build, therefore copy just in case icu data file to tool application path, so it does not require installation and can run no matter if it is a prefix non prefix build. Guard for webengine_system_icu since there is no icu file in that case. Remove awesome looking genex from examples. Change-Id: I2fd5ecf6c99ae1d003a1ac1c7bce2bb61a05f73f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit f2dc94aca3ca8417e73bf914fe3fd3b59eefc19f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/api/CMakeLists.txt1
-rw-r--r--src/core/tools/CMakeLists.txt10
-rw-r--r--src/core/tools/main.cpp15
3 files changed, 21 insertions, 5 deletions
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
index 4ef5d0c67..f878f3465 100644
--- a/src/core/api/CMakeLists.txt
+++ b/src/core/api/CMakeLists.txt
@@ -121,6 +121,7 @@ endforeach()
if (NOT QT_FEATURE_webengine_system_icu)
get_filename_component(icuFile ${buildDir}/${config}/${arch}/icudtl.dat REALPATH)
list(APPEND resourceFiles ${icuFile})
+ set_target_properties(WebEngineCore PROPERTIES ICUDTL_FILE ${icuFile})
endif()
if(QT_FEATURE_framework)
diff --git a/src/core/tools/CMakeLists.txt b/src/core/tools/CMakeLists.txt
index e16bfb926..8f764c94b 100644
--- a/src/core/tools/CMakeLists.txt
+++ b/src/core/tools/CMakeLists.txt
@@ -19,5 +19,15 @@ if(QT_FEATURE_webengine_spellchecker)
qt_internal_extend_target(${dict_target_name} CONDITION GCC OR CLANG
COMPILE_OPTIONS -Wno-unused-parameter
)
+ if(NOT QT_FEATURE_webengine_system_icu AND QT_WILL_INSTALL)
+ # tool can be called durig build so copy icu file
+ get_target_property(icuFile WebEngineCore ICUDTL_FILE)
+ addCopyCommand(${dict_target_name} "${icuFile}"
+ "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}")
+ endif()
+ qt_internal_extend_target(${dict_target_name}
+ CONDITION NOT QT_FEATURE_webengine_system_icu
+ DEFINES USE_ICU_FILE
+ )
endif()
diff --git a/src/core/tools/main.cpp b/src/core/tools/main.cpp
index d79132510..a977fc22d 100644
--- a/src/core/tools/main.cpp
+++ b/src/core/tools/main.cpp
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
"en-US.bdic\n\n";
return 1;
}
-
+#if defined(USE_ICU_FILE)
bool icuDataDirFound = false;
QString icuDataDir = QLibraryInfo::path(QLibraryInfo::DataPath)
% QLatin1String("/resources");
@@ -160,6 +160,8 @@ int main(int argc, char *argv[])
// (e.g. for the case when the tool is ran during build phase, and regular installed
// ICU data file is not available).
const QString icuPossibleEnvDataDir = qEnvironmentVariable("QT_WEBENGINE_ICU_DATA_DIR");
+ const QString appPath = QCoreApplication::applicationDirPath();
+ QLatin1String icuDataFilePath("/icudtl.dat");
if (!icuPossibleEnvDataDir.isEmpty() && QFileInfo::exists(icuPossibleEnvDataDir)) {
icuDataDir = icuPossibleEnvDataDir;
icuDataDirFound = true;
@@ -173,21 +175,24 @@ int main(int argc, char *argv[])
}
#endif
// Try to find the ICU data directory in the installed Qt location.
- else if (QFileInfo::exists(icuDataDir)) {
+ else if (QFileInfo::exists(icuDataDir + icuDataFilePath)) {
+ icuDataDirFound = true;
+ } else if (QFileInfo::exists(appPath + icuDataFilePath)) {
+ // during build icudtl file can be simply in application directory
+ icuDataDir = appPath;
icuDataDirFound = true;
}
-
if (icuDataDirFound) {
base::PathService::Override(base::DIR_QT_LIBRARY_DATA, toFilePath(icuDataDir));
} else {
QTextStream out(stdout);
out << "Couldn't find ICU data directory. Please check that the following path exists: "
<< icuDataDir
- << "\nAlternatively provide the directory path via the QT_WEBENGINE_ICU_DAT_DIR "
+ << "\nAlternatively provide the directory path via the QT_WEBENGINE_ICU_DATA_DIR "
"environment variable.\n\n";
return 1;
}
-
+#endif // USE_ICU_FILE
base::AtExitManager exit_manager;
base::i18n::InitializeICU();