Add ECMAddQmlModule
AcceptedPublic

Authored by kossebau on May 3 2019, 8:43 AM.

Details

Reviewers
apol
Group Reviewers
Plasma
Summary

Having to maintain and sync the module identifier in multiple places and
variants runs the chance of missing one place when changing it.
Also is having to explicitly writing the qmldir file cumbersome when the
buildsystem already has all needed information.

The built-in support for generating/updating a qmltypes file in the sources
merges the main functionality of ECMGenerateQmlTypes,

Diff Detail

Repository
R240 Extra CMake Modules
Branch
addinstallqmlplugin
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12758
Build 12776: arc lint + arc unit
kossebau created this revision.May 3 2019, 8:43 AM
Restricted Application added projects: Frameworks, Build System. · View Herald TranscriptMay 3 2019, 8:43 AM
Restricted Application added subscribers: kde-buildsystem, kde-frameworks-devel. · View Herald Transcript
kossebau requested review of this revision.May 3 2019, 8:43 AM

Possibly the ECMGenerateQmlTypes could be also merged somehow, but I have no experience with that, so leaving to someone else to improve here.

kossebau updated this revision to Diff 57450.May 3 2019, 9:33 AM

Add DEPENDS & DESIGNERSUPPORTED, nothing complicated there (besides going
for asking string with pair of identifier & version, to avoid any arg clash
& make parsing easier)

kossebau edited the summary of this revision. (Show Details)May 3 2019, 9:33 AM
apol added a subscriber: apol.May 3 2019, 11:21 AM

wouldn't it be almost as complex to file(WRITE ... qmldir)? Most of the code is to construct the file.

In D20984#460128, @apol wrote:

wouldn't it be almost as complex to file(WRITE ... qmldir)? Most of the code is to construct the file.

You mean, replace file(GENERATE with file(WRITE ... qmldir)? Might be an idea now given the code has grown, will give a try later today.

kossebau updated this revision to Diff 57457.May 3 2019, 12:58 PM

Use file(WRITE/APPEND) over file(GENERATE), for less intermediate vars

kossebau updated this revision to Diff 57459.May 3 2019, 1:05 PM

get rid of newer list(TRANSFORM)

kossebau updated this revision to Diff 57481.May 3 2019, 4:14 PM

Add also support for TYPEINFO, merging main logic of ecm_generate_qmltypes

This allows e.g. to replace

install(TARGETS platformcomponentsplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/platformcomponents)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/platformcomponents)

ecm_generate_qmltypes(org.kde.plasma.platformcomponents 2.0 DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/platformcomponents)

and the file qmldir

module org.kde.plasma.platformcomponents
plugin platformcomponentsplugin

with this code

ecm_install_qmlplugin(platformcomponentsplugin
    IDENTIFIER org.kde.plasma.platformcomponents
    DESTINATION ${KDE_INSTALL_QMLDIR}
    TYPEINFO plugins.qmltypes
    VERSION 2.0
)

which avoids the need for repeating and ensures consistent data, even more
when creating new plugins or changing names.

kossebau updated this revision to Diff 58490.May 22 2019, 5:51 PM

Renamed to ECMAddQmlModule, with more helper macros for non-C++ parts

kossebau retitled this revision from Add ECMInstallQmlModules, with ecm_install_qmlplugin as start to Add ECMAddQmlModule.May 22 2019, 6:05 PM
kossebau edited the summary of this revision. (Show Details)
kossebau updated this revision to Diff 59700.Jun 13 2019, 12:21 AM
  • add options to take identifiers/type names from file base names
  • add option to specify version suffix to install path
apol accepted this revision.Jun 13 2019, 12:33 AM
This revision is now accepted and ready to land.Jun 13 2019, 12:33 AM