Commit ce0c627a authored by David Faure's avatar David Faure
Browse files

Add macro EXPORT_KONTACT_PLUGIN_WITH_JSON

Summary: Needed for D28608

Reviewers: winterz, mlaurent

Reviewed By: mlaurent

Subscribers: kossebau, kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D28609
parent 59b742e0
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.14.41") set(PIM_VERSION "5.14.42")
project(KontactInterface VERSION ${PIM_VERSION}) project(KontactInterface VERSION ${PIM_VERSION})
...@@ -20,7 +20,7 @@ include(ECMGeneratePriFile) ...@@ -20,7 +20,7 @@ include(ECMGeneratePriFile)
include(ECMSetupVersion) include(ECMSetupVersion)
include(FeatureSummary) include(FeatureSummary)
include(ECMQtDeclareLoggingCategory) include(ECMQtDeclareLoggingCategory)
include(ECMSetupQtPluginMacroNames)
...@@ -35,6 +35,15 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX KONTACTINTERFACE ...@@ -35,6 +35,15 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX KONTACTINTERFACE
SOVERSION 5 SOVERSION 5
) )
ecm_setup_qtplugin_macro_names(
JSON_NONE
EXPORT_KONTACT_PLUGIN
JSON_ARG3
EXPORT_KONTACT_PLUGIN_WITH_JSON
CONFIG_CODE_VARIABLE
PACKAGE_SETUP_AUTOMOC_VARIABLES
)
########### Find packages ########### ########### Find packages ###########
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
CoreAddons CoreAddons
......
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(KF5Parts "@KF5_MIN_VERSION@") find_dependency(KF5Parts "@KF5_MIN_VERSION@")
if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") @PACKAGE_SETUP_AUTOMOC_VARIABLES@
# CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros.
# 3.10+ lets us provide more macro names that require automoc.
# KF5 >= 5.42 takes care itself of adding its macros in its cmake config files
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "EXPORT_KONTACT_PLUGIN")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/KF5KontactInterfaceTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/KF5KontactInterfaceTargets.cmake")
...@@ -46,7 +46,12 @@ class Part; ...@@ -46,7 +46,12 @@ class Part;
} }
/** /**
Exports Kontact plugin. Increase this version number whenever you make a change in the API.
*/
#define KONTACT_PLUGIN_VERSION 10
/**
Exports Kontact plugin. Deprecated in favour of EXPORT_KONTACT_PLUGIN_WITH_JSON
*/ */
#define EXPORT_KONTACT_PLUGIN( pluginclass, pluginname ) \ #define EXPORT_KONTACT_PLUGIN( pluginclass, pluginname ) \
class Instance \ class Instance \
...@@ -59,9 +64,20 @@ class Part; ...@@ -59,9 +64,20 @@ class Part;
( QString(), Instance::createInstance ); ) ( QString(), Instance::createInstance ); )
/** /**
Increase this version number whenever you make a change in the API. Exports Kontact plugin.
@param pluginclass the class to instanciate (must derive from KontactInterface::Plugin
@param jsonFile filename of the JSON file, generated from a .desktop file
*/ */
#define KONTACT_PLUGIN_VERSION 10 #define EXPORT_KONTACT_PLUGIN_WITH_JSON( pluginclass, jsonFile ) \
class Instance \
{ \
public: \
static QObject *createInstance( QWidget *, QObject *parent, const QVariantList &list ) \
{ return new pluginclass( static_cast<KontactInterface::Core*>( parent ), list ); } \
}; \
K_PLUGIN_FACTORY_WITH_JSON( KontactPluginFactory, jsonFile, registerPlugin< pluginclass > \
( QString(), Instance::createInstance ); ) \
K_EXPORT_PLUGIN_VERSION(KONTACT_PLUGIN_VERSION)
namespace KontactInterface namespace KontactInterface
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment