Use the qmlprojectexporter to export the QML sources, image assets and fonts into compilable c++ code. It parses a
.qmlproject file listing the assets with exporting options, and converts them. In addition, qmlprojectexporter also exports plaintext lists of the imported and exported files, for convenient automatic use by a 3rd party build system, such as CMake.
Using qmlprojectexporter with a CMake build system is straightforward and the Qul CMake macro qul_add_target already takes care of calling qmlprojectexporter with the right parameters, and it requires defining the "QML_PROJECT" argument followed by a qmlproject file as shown next.
qul_add_target(my_project QML_PROJECT my_project.qmlproject)
When using qmlprojectexporter, the following CMake macros are not needed as they are handled by the qmlprojectexporter call.
Also setting the following target properties from CMake is not required
app_target_setup_os(myproject) // With a Main.qml (specified only as Main) being the entrypoint app_target_default_entrypoint(swipe_game_qmlproject Main)
When using a build system other than CMake it is still possible to use qmlprojectexporter directly. And afterwards, handling the generated assets files with a build system of choice.
qmlprojectexporter --outdir output_directory myproject.qmlproject
Note: Look at the QmlProject reference for the extended list of qmlprojectexporter commandline options
This executable was introduced in QmlProject API 1.3.
Available under certain Qt licenses.
Find out more.