summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-08-21 13:45:56 +0200
committerMichal Klocek <michal.klocek@qt.io>2021-08-30 19:48:05 +0200
commit63306e724aa9a0c12c50a57742776214baf03521 (patch)
tree37c456cd7cc78e3d1ab2ef87ad4a7a099ae030bb
parent68e724bf48eab90aca310d700b4aad0127b61d35 (diff)
Fix issue of not working dictionary conversion
Test and examples are no longer included as external projects, this created and issue that convert_dict tool does not work during build time due to not installed resources. Before we supported converting dictionaries in a prefix build, by supplying the path to the ICU data file located in the Qt build path. The tool had wrapper script generated which set QT_WEBENGINE_ICU_DATA_DIR. This was done using QT_TOOL_ENV: icu_data_dir.name = QT_WEBENGINE_ICU_DATA_DIR icu_data_dir.value = $$OUT_PWD/../../../src/core/$$getConfigDir() QT_TOOL_ENV = icu_data_dir load(qt_tool) Add workaround for that issue with cmake by setting env variable with relative path to resources in build tree. Make example more exciting for new comers and add generator expression which guards the setting based on module build. Note this is temporary solution and webengine cmake api should be introduced to wrap the conversion tasks in some nice look public api based on qt_internal_wrap_tool_command. Disable example on windows, since on one of coin winodws machines we get error "Exit code 0xc0000135". Task-number: QTBUG-95590 Change-Id: I44664cbcc85b00ec66657e583929a0fba7bde65b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit b4915805b9527864e2475acfb29f7a029f3325ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--CMakeLists.txt2
-rw-r--r--examples/webenginewidgets/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/spellchecker/CMakeLists.txt10
-rw-r--r--tests/auto/widgets/spellchecking/CMakeLists.txt4
4 files changed, 13 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f80888064..c78610c2c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,5 +22,5 @@ find_package(Qt6 ${PROJECT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS
Gui Widgets Network OpenGL OpenGLWidgets Quick Qml PrintSupport
WebChannel Positioning QuickControls2 Test QuickWidgets QuickTest WebSockets
)
-
+set(WEBENGINE_MODULE_BUILD TRUE)
qt_build_repo()
diff --git a/examples/webenginewidgets/CMakeLists.txt b/examples/webenginewidgets/CMakeLists.txt
index 651a01344..a0dc6330d 100644
--- a/examples/webenginewidgets/CMakeLists.txt
+++ b/examples/webenginewidgets/CMakeLists.txt
@@ -16,6 +16,7 @@ if(QT_FEATURE_webengine_printing_and_pdf)
add_subdirectory(printme)
add_subdirectory(html2pdf)
endif()
-if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING AND NOT QT_FEATURE_webengine_native_spellchecker)
+if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING
+ AND NOT QT_FEATURE_webengine_native_spellchecker AND NOT WIN32)
add_subdirectory(spellchecker)
endif()
diff --git a/examples/webenginewidgets/spellchecker/CMakeLists.txt b/examples/webenginewidgets/spellchecker/CMakeLists.txt
index f05cd74fe..5cec0087d 100644
--- a/examples/webenginewidgets/spellchecker/CMakeLists.txt
+++ b/examples/webenginewidgets/spellchecker/CMakeLists.txt
@@ -65,14 +65,18 @@ else()
set(spellcheckerDir ${CMAKE_CURRENT_BINARY_DIR}/qtwebengine_dictionaries)
endif()
+# note setting QT_WEBENGINE_ICU_DATA below is not required if this example
+# is not compiled as part of qtwebengine module build
+
foreach(dictFile ${dicts})
get_filename_component(dictName ${dictFile} NAME_WE)
add_custom_command(TARGET spellchecker
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${spellcheckerDir}
- COMMAND $<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qwebengine_convert_dict>
- ${CMAKE_CURRENT_SOURCE_DIR}/dict/${dictFile}
- ${spellcheckerDir}/${dictName}.bdic
+ 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"
)
endforeach()
diff --git a/tests/auto/widgets/spellchecking/CMakeLists.txt b/tests/auto/widgets/spellchecking/CMakeLists.txt
index afed7e28b..8e1a165c5 100644
--- a/tests/auto/widgets/spellchecking/CMakeLists.txt
+++ b/tests/auto/widgets/spellchecking/CMakeLists.txt
@@ -31,7 +31,9 @@ foreach(dictFile ${dicts})
add_custom_command(TARGET tst_spellchecking
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${spellcheckerDir}
- COMMAND $<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qwebengine_convert_dict>
+ 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"