From 76377cdf5d0658672bea5cc84f1c7d5657b8aea2 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 9 Dec 2015 12:14:38 +0100 Subject: Make the KAppTemplate CMake module global templates are very useful as teaching tool in order to make a minimal application that uses a certain framework. templates in the KAppTemplate repository will always get forgotten (plus kapptemplate is not really necessary as they work in kdevelop as well) An ideal situation would be frameworks having templates in their own repos with templates of barebone apps using the main framework features. In order to do that, the cmake stuff needed in order to correctly install a template needs to be ported to a place avaiable to all frameworks REVIEW:126185 --- docs/kde-module/KDEPackageAppTemplates.rst | 1 + kde-modules/KDEInstallDirs.cmake | 4 + kde-modules/KDEPackageAppTemplates.cmake | 124 +++++++++++++++++++++ tests/CMakeLists.txt | 9 ++ tests/KDEPackageAppTemplatesTest/CMakeLists.txt | 12 ++ tests/KDEPackageAppTemplatesTest/check.cmake.in | 37 ++++++ .../qml-plasmoid/CMakeLists.txt | 10 ++ .../qml-plasmoid/Messages.sh | 2 + .../KDEPackageAppTemplatesTest/qml-plasmoid/README | 32 ++++++ .../package/contents/images/pairs.svgz | Bin 0 -> 103064 bytes .../qml-plasmoid/package/contents/ui/main.qml | 28 +++++ .../qml-plasmoid/package/metadata.desktop | 67 +++++++++++ .../qml-plasmoid/qml-plasmoid.kdevtemplate | 74 ++++++++++++ .../qml-plasmoid/qml-plasmoid.png | Bin 0 -> 35613 bytes 14 files changed, 400 insertions(+) create mode 100644 docs/kde-module/KDEPackageAppTemplates.rst create mode 100644 kde-modules/KDEPackageAppTemplates.cmake create mode 100644 tests/KDEPackageAppTemplatesTest/CMakeLists.txt create mode 100644 tests/KDEPackageAppTemplatesTest/check.cmake.in create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/CMakeLists.txt create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/Messages.sh create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/README create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/package/contents/images/pairs.svgz create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/package/contents/ui/main.qml create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/package/metadata.desktop create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/qml-plasmoid.kdevtemplate create mode 100644 tests/KDEPackageAppTemplatesTest/qml-plasmoid/qml-plasmoid.png diff --git a/docs/kde-module/KDEPackageAppTemplates.rst b/docs/kde-module/KDEPackageAppTemplates.rst new file mode 100644 index 00000000..283bae4e --- /dev/null +++ b/docs/kde-module/KDEPackageAppTemplates.rst @@ -0,0 +1 @@ +.. ecm-module:: ../../kde-modules/KDEPackageAppTemplates.cmake diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake index 086b5b28..ebd48fa8 100644 --- a/kde-modules/KDEInstallDirs.cmake +++ b/kde-modules/KDEInstallDirs.cmake @@ -72,6 +72,8 @@ # ``KXMLGUI5DIR`` # knotify description files (``DATAROOTDIR/kxmlgui5``) # [``KXMLGUI_INSTALL_DIR``] +# ``KTEMPLATESDIR`` +# Kapptemplate and Kdevelop templates (``kdevappwizard/templates``) # ``KNOTIFY5RCDIR`` # knotify description files (``DATAROOTDIR/knotifications5``) # [``KNOTIFYRC_INSTALL_DIR``] @@ -513,6 +515,8 @@ _define_relative(KNOTIFY5RCDIR DATAROOTDIR "knotifications5" _define_relative(KXMLGUI5DIR DATAROOTDIR "kxmlgui5" "kxmlgui .rc files" KXMLGUI_INSTALL_DIR) +_define_relative(KTEMPLATESDIR DATAROOTDIR "kdevappwizard/templates" + "Kapptemplate and Kdevelop templates") # Cross-desktop or other system things _define_relative(ICONDIR DATAROOTDIR "icons" diff --git a/kde-modules/KDEPackageAppTemplates.cmake b/kde-modules/KDEPackageAppTemplates.cmake new file mode 100644 index 00000000..c0eb8b90 --- /dev/null +++ b/kde-modules/KDEPackageAppTemplates.cmake @@ -0,0 +1,124 @@ +#.rst: +# KDETemplateGenerator +# ------------------- +# +# Packages KApptemplate/KDevelop compatible application templates +# +# This module provides a functionality to package in a tarball and +# install project templates compatible with the format used by +# KApptemplate and KDevelop. Useful for providing minimal examples +# for the usage of the KDE Frameworks. +# +# This module provides the following function: +# +# kde_package_app_templates( TEMPLATES template1 [template2] [...] INSTALL_DIR directory) +# +# INSTALL_DIR is the directory to install the template package to. +# In most cases you will want to use the variable KDE_INSTALL_KTEMPLATESDIR +# from :kde-module:`KDEInstallDirs`. +# +# TEMPLATES lists subdirectories containing template files; +# each ``