A repository to test and demonstrate different project structures where there is an application that has a QML module and using other external QML modules.
Although the the official Qt documentation states that dynamic linking is possible, the examples and other resources available on the internet mostly seem to prefer static linking of QML modules into the application binary.
See the resources chapter for links to other examples and documentation on this topic.
In this example the module is statically linked into the App binary
via the module's plugin library. The project has a "standard" directory
structure that matches the QML module URIs relative to the root folder
of the example. For example: the ModuleA has the URI Modules.ModuleA
so it is located in the StaticLinkingExample\Modules\ModuleA folder.
In this example the module is dynamically linked into the App binary
via the module's backing library. The project has a "standard" directory
structure that matches the QML module URIs relative to the root folder
of the example. For example: the ModuleA has the URI Modules.ModuleA
so it is located in the DynamicLinkingExample\Modules\ModuleA folder.
In this example the module is dynamically linked into the App binary
via the module's backing library. The project has a "custom" directory
structure that does not match the QML module URIs relative to the root
folder of the example. For example: the ModuleA has the URI
Modules.ModuleA but it is located in the
DynamicLinkingCustomStructureExample\sources\Modules\ModuleA folder.
In this example the module is dynamically linked into the App binary
via the module's backing library. The project has a "custom" directory
structure that does not match the QML module URIs relative to the root
folder of the example. For example: the ModuleA has the URI
Modules.ModuleA but it is located in the
DynamicLinkingCustomStructureModernExample\sources\Modules\ModuleA folder.
The difference between this and the non-modern example is, that here the
module dependencies are declared via the DEPENDENCIES TARGET which helps
the toolchain finding them.
- qt_add_qml_module | Qt Qml | Qt 6.10.2
- Building a QML application | Build with CMake | Qt 6.10.2
- Building a reusable QML module | Build with CMake | Qt 6.10.2
- Writing QML Modules | Qt Qml | Qt 6.10.2
- QML Modules for the Masses - YouTube
- Modern QML modules | Qt Qml | Qt 6.10.2
- CMake and Qt. qt_add_qml_module in Practice | #QtWS22 - YouTube
- Correct way to make QML modules Qt 6.5-6.9 | Qt Forum
- How does Qt expect me to link QML modules? - Stack Overflow
- somcosoftware/qt_add_qml_module_example - GitHub