Static build qml module depends _qmlcache _resources_2 _resources_1 targets
-
I am creating a qml module as a library like:
qt6_add_qml_module(nodeConection ~ URI imports ~ VERSION 1.0 ~ SOURCES ~ src/nodeConnection.cpp include/nodeConnection.hpp ~ QML_FILES ~ qml/Node_Connections.qml ~ )
and exporting the target like
install(TARGETS nodeConection EXPORT nodeConectionTargets DESTINATION bin )
this work with shared builds but when using webassembly (static build) the backing target library depends on 3 more targets with name "target_qmlcache", "target_resources_2", "target_resources_1". How can I export the targets depending on the build type?
Where are the sources of this cmake qml macros like "qt_add_qml_module".
-
It seems i need to add to qt_add_qml_module the [OUTPUT_TARGETS out_targets_var]
and export the additional targets in out_targets_var variable .If the backing target is a static library and that static library will be installed, OUTPUT_TARGETS should be given to provide a variable in which to store a list of additional targets that will also need to be installed. These additional targets are generated internally by qt_add_qml_module() and are referenced by the backing target's linking requirements as part of ensuring that resources are set up and loaded correctly.
-
Also I have not found the way to export a qml module target and link in some application target using wasm.
If in the main application i set
engine.addImportPath(QCoreApplication::applicationDirPath() + "/_deps/nodeconection-build/"); 12 qDebug()<<engine.importPathList();
the output of that qDebug() tells me that it added "/_deps/nodeconection-build/" when using qt gcc but when using wasm it do not add that import directory.
The only way i found to use qt_add_qml_module in wasm is to create all the modules in the main cmake file where the qt_add_executable is used.
This is bad, because i want to export my custom qml modules and link to my main target so my modules are reusable. Using shared libraries(qt_gcc) this works nicely but with wasm is a mess. There is no example on this.
-
I need to add an imported module to The Qt Resource System, to then be able to import the module by adding
engine.addImportPath(":/my.company.com/imports");
if i create the module using qt_add_qml_module, how can i add the module to "The Qt Resource System"? Or how can i add the import path of that module using
engine.addImportPath(":/my.company.com/imports");
or mayb ei need to use a qurl path to webassembly be able to import that like
engine.addImportPath(QUrl(u"qrc:/_deps/nodeconection-build/"_qs).toEncoded());
Could be also relate that webassembly is like crosscompilation and the path are different?
-
It seems i need to add to qt_add_qml_module the [OUTPUT_TARGETS out_targets_var]
and export the additional targets in out_targets_var variable .If the backing target is a static library and that static library will be installed, OUTPUT_TARGETS should be given to provide a variable in which to store a list of additional targets that will also need to be installed. These additional targets are generated internally by qt_add_qml_module() and are referenced by the backing target's linking requirements as part of ensuring that resources are set up and loaded correctly.