[Interest] CMake - List Sources: qt_add_executable vs qt_add_qml_module
ekke
ekke at ekkes-corner.org
Tue Jan 30 13:06:17 CET 2024
Hi Mike,
Am 30.01.24 um 12:24 schrieb Mike Trahearn:
> If your sources are intended to be part of the QML module, that is,
> available to QML having imported Main_Module, then you should put your
> sources under the module. If the sources are just assistant to your
> main.cpp and have no need to be used in QML then they can go under the
> application.
> Sources under the application cannot be published (easily) to QML.
I'm using my sources in QML (Q_PROPERTY, Q_INVOKABLE, ...), also have to
refactor all my qmlRegisterType, all my contextProperties... - doing
this step-by-step - have 20 mobile business apps ported from 5.15 to 6.6 ;-)
So I'll list my sources under the module
>
> Modularising your application into meaningful modules will help you
> identify what goes where.
yep.
>
> You should also come up with a good module URI dot notation semantic
> for your modules which will help organise your QML imports statements
> and source folder structure.
I know about the URI dot notation semantic. Have named this module
"Main_Module" because the module will be loaded and executed at the
start of the app and will never be re-used from another app. Upcoming
modules will be something like "Ekke.Login", "Ekke.Camera" ...
>
> Hope that helps.
>
thx
ekke
>
>
> ------------------------------------------------------------------------
> *From:* Interest <interest-bounces at qt-project.org> on behalf of ekke
> <ekke at ekkes-corner.org>
> *Sent:* Tuesday, January 30, 2024 8:05:32 PM
> *To:* interest at qt-project.org <interest at qt-project.org>
> *Subject:* [Interest] CMake - List Sources: qt_add_executable vs
> qt_add_qml_module
> ... ported my apps from 5.15 to 6.6, now on my way from QMake to CMake
>
> App is not modularized yet (ToDo for later ;-)
> So I only have ONE QML Module directly loaded at start:
>
> main.cpp:
> engine.loadFromModule("Main_Module", "Main");
>
> qt_add_executable(my_app
> main.cpp
> )
>
> include(my_qml_files.cmake)
>
> qt_add_qml_module(my_app
> URI Main_Module
> QML_FILES ${myqmlfiles}
> ... RESOURCES, SOURCES...
> )
>
> I can list all my other cpp SOURCES in qt_add_executable or in
> qt_add_qml_module,
> what is recommended in this case ?
>
> thx
>
> ekke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240130/b48670d8/attachment.htm>
More information about the Interest
mailing list