diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-30 15:28:19 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-12-01 11:20:24 +0100 |
commit | 7a7edf14ecf062f0514e23b455a9220443554c6c (patch) | |
tree | 074b5b4b34428d077b5116b88c6ca4e0850dc9b2 | |
parent | 6b68117dc2048a164a2372f1659e5f90855aeb1a (diff) |
Allow passing --direct-calls to the qmlcachegen implementation
qmlcachegenplus has an argument --direct-calls which instructs it to
call methods of known C++ types directly rather than through the JS
engine or the metaobject. This is faster but requires that all those
types are visible to the generated code. Introduce a way to pass this
option on a per-target base.
Adjust qmlcachegen to ignore the option.
Change-Id: I474e577e4a197f6ca4c8b8e868dfd39983e77041
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 6 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index f942238572..3f23a4f63d 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -942,6 +942,11 @@ function(_qt_internal_quick_compiler_process_resources target resource_name) set(chained_resource_name "${resource_name}_qmlcache") endif() + get_target_property(direct_calls ${target} QT_QMLCACHEGEN_DIRECT_CALLS) + if (direct_calls) + list(APPEND qmlcachegen_extra_args "--direct-calls") + endif() + foreach(file IN LISTS qml_files) get_filename_component(file_absolute ${file} ABSOLUTE) file(RELATIVE_PATH file_relative ${CMAKE_CURRENT_SOURCE_DIR} ${file_absolute}) @@ -969,6 +974,7 @@ function(_qt_internal_quick_compiler_process_resources target resource_name) COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::qmlcachegen --resource-path "${file_resource_path}" + ${qmlcachegen_extra_args} -o "${compiled_file}" "${file_absolute}" DEPENDS diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index f3dbd8bdd9..e4077f0831 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -103,6 +103,8 @@ int main(int argc, char **argv) QCoreApplication::translate("main", "Required to generate qmlcache_loader without qrc files. This is the name of the Qt resource the input files belong to."), QCoreApplication::translate("main", "compiled-file-list")); parser.addOption(resourceNameOption); + QCommandLineOption directCallsOption(QStringLiteral("direct-calls"), QCoreApplication::translate("main", "This option is ignored.")); + parser.addOption(directCallsOption); QCommandLineOption outputFileOption(QStringLiteral("o"), QCoreApplication::translate("main", "Output file name"), QCoreApplication::translate("main", "file name")); parser.addOption(outputFileOption); |