[X2Go-Commits] [x2goplasmabindings] 03/04: CMakeLists.txt: detect if ECMQmlModule is available and, if not, emulate its behavior for older platforms.
git-admin at x2go.org
git-admin at x2go.org
Thu Aug 10 03:27:09 CEST 2023
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goplasmabindings.
commit bc32869240f6b6f763cbe53cfdcfb034ec56d885
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Aug 10 03:24:13 2023 +0200
CMakeLists.txt: detect if ECMQmlModule is available and, if not, emulate its behavior for older platforms.
---
CMakeLists.txt | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
debian/changelog | 2 +
2 files changed, 122 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3368dd..b347e22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,14 @@ if (USE_PLASMA5)
include (KDECompilerSettings NO_POLICY_SCOPE)
include (FeatureSummary)
include (ECMInstallIcons)
- include (ECMQmlModule)
+
+ # ECMQmlModule might not be available on all platforms.
+ set (ECMQmlModule_path "")
+ set (HAVE_ECMQMLMODULE FALSE)
+ include (ECMQmlModule OPTIONAL RESULT_VARIABLE ECMQmlModule_path)
+ if (NOT ECMQmlModule_path STREQUAL "NOTFOUND")
+ set (HAVE_ECMQMLMODULE TRUE)
+ endif (ECMQmlModule_path STREQUAL "NOTFOUND")
find_package (
KF5 REQUIRED COMPONENTS
@@ -79,22 +86,125 @@ endif (USE_PLASMA5)
# Now make sure all files get to the right place
if (USE_PLASMA5)
- ecm_add_qml_module (
- org.x2go.plasmoid URI org.x2go.plasmoid
- )
+ if (HAVE_ECMQMLMODULE)
+ ecm_add_qml_module (
+ X2GoPlasmoidPlugin URI "org.x2go.plasmoid"
+ )
+ else (HAVE_ECMQMLMODULE)
+ add_library (X2GoPlasmoidPlugin)
+ set_target_properties (X2GoPlasmoidPlugin PROPERTIES
+ AUTOMOC_MOC_OPTIONS -Muri="org.x2go.plasmoid"
+ )
+ endif (HAVE_ECMQMLMODULE)
target_sources (
- org.x2go.plasmoid PRIVATE
+ X2GoPlasmoidPlugin PRIVATE
${x2goplasmoid_SRCS}
)
target_link_libraries (
- org.x2go.plasmoid
+ X2GoPlasmoidPlugin
Qt::Core
Qt::Qml
)
- ecm_finalize_qml_module (
- org.x2go.plasmoid DESTINATION
- ${KDE_INSTALL_QMLDIR}
- )
+ if (HAVE_ECMQMLMODULE)
+ ecm_finalize_qml_module (
+ X2GoPlasmoidPlugin DESTINATION
+ ${KDE_INSTALL_QMLDIR}
+ )
+ else (HAVE_ECMQMLMODULE)
+ set (qmldir_template_ "# This file was automatically generated and should not be modified")
+ string (APPEND qmldir_template_ "\nmodule org.x2go.plasmoid")
+ string (APPEND qmldir_template_ "\nplugin X2GoPlasmoidPlugin")
+ string (APPEND qmldir_template_ "\nclassname X2GoPlasmoidPlugin")
+ string (APPEND qmldir_template_ "\n")
+
+ set (
+ qmldir_path_
+ "${CMAKE_CURRENT_BINARY_DIR}/X2GoPlasmoidPlugin_qmldir"
+ )
+ file (WRITE "${qmldir_path_}" "${qmldir_template_}")
+
+ string (REPLACE "." "/" plugin_path_ "org.x2go.plasmoid")
+
+ if (NOT BUILD_SHARED_LIBS)
+ set (qrc_template_ "<!-- This file was automatically generated and should not be modified -->")
+ string (APPEND qrc_template_ "\n<RCC>\n<qresource prefix=\"/qt-project.org/imports/${plugin_path_}\">")
+ string (APPEND qrc_template_ "\n<file alias=\"qmldir\">${qmldir_path_}</file>")
+ string (APPEND qrc_template_ "\n</qresource>\n</RCC>\n")
+ file (WRITE
+ "${CMAKE_CURRENT_BINARY_DIR}/X2GoPlasmoidPlugin.qrc"
+ "${qrc_template_}"
+ )
+ qt_add_resources (
+ qrc_output_
+ "${CMAKE_CURRENT_BINARY_DIR}/X2GoPlasmoidPlugin.qrc"
+ )
+ target_sources (X2GoPlasmoidPlugin PRIVATE ${qrc_output_})
+
+ set (CPP_RESOURCE_INIT "#include <qglobal.h>\n#include<QDebug> \n void initQmlResourceX2GoPlasmoidPlugin () {Q_INIT_RESOURCE(X2GoPlasmoidPlugin); qWarning()<<Q_FUNC_INFO;};")
+ file (WRITE X2GoPlasmoidPlugin_init.cpp "${CPP_RESOURCE_INIT}")
+ target_sources (
+ X2GoPlasmoidPlugin
+ PRIVATE X2GoPlasmoidPlugin_init.cpp
+ )
+ target_compile_definitions (
+ X2GoPlasmoidPlugin PRIVATE
+ -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=initQmlResourceX2GoPlasmoidPlugin
+ -DQT_STATICPLUGIN=1
+ )
+ install (TARGETS X2GoPlasmoidPlugin DESTINATION
+ ${KDE_INSTALL_QMLDIR}/${plugin_path_}
+ )
+ else (NOT BUILD_SHARED_LIBS)
+ get_target_property (
+ runtime_output_dir_
+ X2GoPlasmoidPlugin RUNTIME_OUTPUT_DIRECTORY
+ )
+ if (NOT ${runtime_output_dir_})
+ if ("${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" STREQUAL "")
+ set (runtime_output_dir_ ${CMAKE_CURRENT_BINARY_DIR})
+ else ("${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" STREQUAL "")
+ set (runtime_output_dir_ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+ endif ("${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" STREQUAL "")
+ endif (NOT ${runtime_output_dir_})
+
+ add_custom_command (
+ TARGET X2GoPlasmoidPlugin
+ POST_BUILD
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${runtime_output_dir_}/${plugin_path_}
+ BYPRODUCTS ${runtime_output_dir_}/${plugin_path_}
+ )
+
+ install (
+ FILES ${plugin_path_}
+ DESTINATION
+ ${KDE_INSTALL_QMLDIR}/${plugin_path_}
+ RENAME "qmldir"
+ )
+
+ add_custom_command (
+ TARGET X2GoPlasmoidPlugin
+ POST_BUILD
+ WORKING_DIRECTORY ${runtime_output_dir_}
+ COMMAND ${CMAKE_COMMAND} -E copy ${plugin_path_}
+ ${plugin_path_}/qmldir
+ )
+
+ install (
+ TARGETS X2GoPlasmoidPlugin
+ DESTINATION ${KDE_INSTALL_QMLDIR}/${plugin_path_}
+ )
+
+ add_custom_command (
+ TARGET X2GoPlasmoidPlugin
+ POST_BUILD
+ WORKING_DIRECTORY ${runtime_output_dir_}
+ COMMAND ${CMAKE_COMMAND} -E copy
+ $<TARGET_FILE:X2GoPlasmoidPlugin> ${plugin_path_}
+ )
+ endif (NOT BUILD_SHARED_LIBS)
+ endif (HAVE_ECMQMLMODULE)
else (USE_PLASMA5)
kde4_add_plugin(
org.x2go.plasmoid
diff --git a/debian/changelog b/debian/changelog
index 4477bc6..369c30f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,8 @@ x2goplasmabindings (3.0.2.3-0x2go1) UNRELEASED; urgency=medium
- CMakeLists.txt: rework building of org.x2go.plasmoid library in Plasma5
mode, based upon QML.
- x2goplasmoidkf5.cpp: fix moc include.
+ - CMakeLists.txt: detect if ECMQmlModule is available and, if not, emulate
+ its behavior for older platforms.
* x2goplasmabindings.spec:
+ Prepare for Plasma 5 support.
+ Stop duplicating Group tag.
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goplasmabindings.git
More information about the x2go-commits
mailing list