summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-10-19 12:30:05 +0200
committerMichal Klocek <michal.klocek@qt.io>2021-10-28 11:42:35 +0200
commitf2dc94aca3ca8417e73bf914fe3fd3b59eefc19f (patch)
tree000ce64de0d74a47094a2a5b99a30e941db42fcd
parentc733f89eaf0c6bf70ab35666a4ef38490abca828 (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. Pick-to: 6.2 Change-Id: I2fd5ecf6c99ae1d003a1ac1c7bce2bb61a05f73f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--CMakeLists.txt1
-rw-r--r--examples/webenginewidgets/spellchecker/CMakeLists.txt1
-rw-r--r--src/core/api/CMakeLists.txt1
-rw-r--r--src/core/tools/CMakeLists.txt10
-rw-r--r--src/core/tools/main.cpp15
-rw-r--r--tests/auto/widgets/spellchecking/CMakeLists.txt1
6 files changed, 21 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35248b6f9..95f5cdfc2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,5 +27,4 @@ if(MATRIX_BUILD AND NOT MATRIX_SUBBUILD AND NOT QT_SUPERBUILD)
return()
endif()
-set(WEBENGINE_MODULE_BUILD TRUE)
qt_build_repo()
diff --git a/examples/webenginewidgets/spellchecker/CMakeLists.txt b/examples/webenginewidgets/spellchecker/CMakeLists.txt
index 5cec0087d..16bb677c5 100644
--- a/examples/webenginewidgets/spellchecker/CMakeLists.txt
+++ b/examples/webenginewidgets/spellchecker/CMakeLists.txt
@@ -74,7 +74,6 @@ foreach(dictFile ${dicts})
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${spellcheckerDir}
COMMAND ${CMAKE_COMMAND} -E env
- $<IF:$<BOOL:${WEBENGINE_MODULE_BUILD}>,QT_WEBENGINE_ICU_DATA_DIR=${CMAKE_CURRENT_BINARY_DIR}/../../../resources,CMAKE=AWESOME>
$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qwebengine_convert_dict>
${CMAKE_CURRENT_SOURCE_DIR}/dict/${dictFile} ${spellcheckerDir}/${dictName}.bdic
COMMENT "Running qwebengine_convert_dict"
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 5297bb509..63cb234d6 100644
--- a/src/core/tools/CMakeLists.txt
+++ b/src/core/tools/CMakeLists.txt
@@ -20,5 +20,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();
diff --git a/tests/auto/widgets/spellchecking/CMakeLists.txt b/tests/auto/widgets/spellchecking/CMakeLists.txt
index 8e1a165c5..a0cd4d052 100644
--- a/tests/auto/widgets/spellchecking/CMakeLists.txt
+++ b/tests/auto/widgets/spellchecking/CMakeLists.txt
@@ -32,7 +32,6 @@ foreach(dictFile ${dicts})
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${spellcheckerDir}
COMMAND ${CMAKE_COMMAND} -E env
- $<IF:$<BOOL:${WEBENGINE_MODULE_BUILD}>,QT_WEBENGINE_ICU_DATA_DIR=${CMAKE_CURRENT_BINARY_DIR}/../../../../resources,CMAKE=AWESOME>
$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qwebengine_convert_dict>
${CMAKE_CURRENT_SOURCE_DIR}/dict/${dictFile}
${spellcheckerDir}/${dictName}.bdic