summaryrefslogtreecommitdiffstats
path: root/examples/webenginewidgets
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-10-25 13:23:44 +0200
committerMichal Klocek <michal.klocek@qt.io>2021-11-17 20:45:40 +0100
commit3a2dd40b179405da84c85d5877a6e2678b36ce8a (patch)
tree8c881aa86ea6d897b56d03dc12482a1516e8ac0e /examples/webenginewidgets
parent23cc5bb2588100c6053d9d11b20778724cdbd6e7 (diff)
Add cmake api for 'bdict' dictionary conversion
Fix spellchecker example and test to use new api. Note we should not use qt6 prefix in cmake api in examples. Change-Id: Ib800bf2b7bd83e10060fa01ccd8d4a262752e09b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'examples/webenginewidgets')
-rw-r--r--examples/webenginewidgets/spellchecker/CMakeLists.txt35
1 files changed, 6 insertions, 29 deletions
diff --git a/examples/webenginewidgets/spellchecker/CMakeLists.txt b/examples/webenginewidgets/spellchecker/CMakeLists.txt
index 16bb677c5..1a0c76b06 100644
--- a/examples/webenginewidgets/spellchecker/CMakeLists.txt
+++ b/examples/webenginewidgets/spellchecker/CMakeLists.txt
@@ -39,7 +39,7 @@ set(spellchecker_resource_files
"data/style.css"
)
-qt6_add_resources(spellchecker "spellchecker"
+qt_add_resources(spellchecker "spellchecker"
PREFIX
"/"
BASE
@@ -55,38 +55,15 @@ install(TARGETS spellchecker
)
file(GLOB_RECURSE dicts
- RELATIVE ${CMAKE_CURRENT_LIST_DIR}/dict
+ ABSOLUTE ${CMAKE_CURRENT_LIST_DIR}/dict
*/*.dic
)
-if(QT_GENERATOR_IS_MULTI_CONFIG)
- set(spellcheckerDir ${CMAKE_CURRENT_BINARY_DIR}/dict/qtwebengine_dictionaries)
-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 ${CMAKE_COMMAND} -E env
- $<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qwebengine_convert_dict>
- ${CMAKE_CURRENT_SOURCE_DIR}/dict/${dictFile} ${spellcheckerDir}/${dictName}.bdic
- COMMENT "Running qwebengine_convert_dict"
+ qt_add_webengine_dictionary(
+ TARGET spellchecker
+ SOURCE "${dictFile}"
+ OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endforeach()
-# copy dictionaries to $<CONFIG> build dir
-if(QT_GENERATOR_IS_MULTI_CONFIG)
- add_custom_command(TARGET spellchecker
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo Copying dictionares
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/dict
- ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
- )
-endif()
-