Port to ecm_add_qml_module

Reduces some boilerplate
This commit is contained in:
Nicolas Fella 2022-09-11 01:17:14 +02:00
parent 4ecf463cd1
commit ed3ae873a7
5 changed files with 14 additions and 1124 deletions

View file

@ -38,6 +38,7 @@ include(GenerateExportHeader)
include(ECMGenerateQmlTypes)
include(KDEClangFormat)
include(KDEGitCommitHooks)
include(ECMQmlModule)
if (NOT SAILFISHOS)
include(ECMQMLModules)
endif()

View file

@ -1,36 +1,27 @@
add_library(kdeconnectdeclarativeplugin SHARED
ecm_add_qml_module(kdeconnectdeclarativeplugin URI "org.kde.kdeconnect" VERSION 1.0)
target_sources(kdeconnectdeclarativeplugin PRIVATE
kdeconnectdeclarativeplugin.cpp
responsewaiter.cpp
objectfactory.cpp
pointerlocker.cpp
resources.qrc
)
target_link_libraries(kdeconnectdeclarativeplugin
Qt5::Qml
kdeconnectinterfaces
kdeconnectcore
)
ecm_target_qml_sources(kdeconnectdeclarativeplugin
SOURCES
qml/DBusProperty.qml
qml/PluginChecker.qml
qml/RemoteKeyboard.qml
VERSION 1.0)
if (TARGET KF5::WaylandClient)
target_sources(kdeconnectdeclarativeplugin PRIVATE pointerlockerwayland.cpp)
target_link_libraries(kdeconnectdeclarativeplugin KF5::WaylandClient)
target_link_libraries(kdeconnectdeclarativeplugin PRIVATE KF5::WaylandClient)
target_compile_definitions(kdeconnectdeclarativeplugin PRIVATE -DWITH_WAYLAND=1)
else()
target_compile_definitions(kdeconnectdeclarativeplugin PRIVATE -DWITH_WAYLAND=0)
endif()
install(TARGETS kdeconnectdeclarativeplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kdeconnect)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kdeconnect)
target_link_libraries(kdeconnectdeclarativeplugin PRIVATE Qt::Quick kdeconnectinterfaces kdeconnectcore)
ecm_generate_qmltypes(org.kde.kdeconnect 1.0 DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kdeconnect)
# So qml apps using this plugin can be run from build/bin directory
add_custom_target(copy_to_build_dir_bin)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/kdeconnect)
add_custom_command(TARGET copy_to_build_dir_bin
COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_BINARY_DIR}/bin/org/kde/kdeconnect/)
add_dependencies(kdeconnectdeclarativeplugin copy_to_build_dir_bin)
set_target_properties(kdeconnectdeclarativeplugin
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/kdeconnect/
)
ecm_finalize_qml_module(kdeconnectdeclarativeplugin DESTINATION ${KDE_INSTALL_QMLDIR})

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
module org.kde.kdeconnect
DBusProperty 1.0 qrc:///kdeconnect/qml/DBusProperty.qml
PluginChecker 1.0 qrc:///kdeconnect/qml/PluginChecker.qml
RemoteKeyboard 1.0 qrc:///kdeconnect/qml/RemoteKeyboard.qml
plugin kdeconnectdeclarativeplugin

View file

@ -1,7 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/kdeconnect">
<file>qml/DBusProperty.qml</file>
<file>qml/PluginChecker.qml</file>
<file>qml/RemoteKeyboard.qml</file>
</qresource>
</RCC>