telepathy-qt: Added TP_QT_VERSION and TP_QT_VERSION_CHECK macros.
David Edmundson
davidedmundson at kemper.freedesktop.org
Mon Jan 26 10:57:27 PST 2015
Module: telepathy-qt
Branch: master
Commit: 099dd1c08450d35f699a553e2407356a8969122a
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=099dd1c08450d35f699a553e2407356a8969122a
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date: Sun Jan 4 22:25:29 2015 +0600
Added TP_QT_VERSION and TP_QT_VERSION_CHECK macros.
---
TelepathyQt/CMakeLists.txt | 4 +++-
TelepathyQt/{global.h => global.h.in} | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/TelepathyQt/CMakeLists.txt b/TelepathyQt/CMakeLists.txt
index 000c63b..0489975 100644
--- a/TelepathyQt/CMakeLists.txt
+++ b/TelepathyQt/CMakeLists.txt
@@ -7,6 +7,8 @@ set(LD_FLAGS "${LD_FLAGS} ${VISIBILITY_HIDDEN_FLAGS} ${COMPILER_COVERAGE_FLAGS}
# We are building Telepathy-Qt
add_definitions(-DBUILDING_TP_QT)
+configure_file(global.h.in ${CMAKE_CURRENT_BINARY_DIR}/global.h)
+
# Sources for Tp-Qt
set(telepathy_qt_SRCS
abstract-client.cpp
@@ -346,7 +348,7 @@ set(telepathy_qt_HEADERS
GenericPropertyFilter
generic-property-filter.h
Global
- global.h
+ ${CMAKE_CURRENT_BINARY_DIR}/global.h
HandledChannelNotifier
handled-channel-notifier.h
IncomingDBusTubeChannel
diff --git a/TelepathyQt/global.h b/TelepathyQt/global.h.in
similarity index 87%
rename from TelepathyQt/global.h
rename to TelepathyQt/global.h.in
index abb1c54..6b8ec44 100644
--- a/TelepathyQt/global.h
+++ b/TelepathyQt/global.h.in
@@ -29,6 +29,26 @@
#include <QtGlobal>
+#define TP_QT_MAJOR_VERSION @TP_QT_MAJOR_VERSION@
+#define TP_QT_MINOR_VERSION @TP_QT_MINOR_VERSION@
+#define TP_QT_MICRO_VERSION @TP_QT_MICRO_VERSION@
+#define TP_QT_VERSION ((TP_QT_MAJOR_VERSION<<16)|(TP_QT_MINOR_VERSION<<8)|(TP_QT_MICRO_VERSION))
+
+/**
+ * @def TP_QT_VERSION_CHECK
+ * @ingroup macros
+ *
+ * The TP_QT_VERSION_CHECK macro can be used to do condition compilation
+ * in TelepathyQt-based applications and libraries.
+ *
+ * \code
+ * #if (TP_QT_VERSION >= TP_QT_VERSION_CHECK(0, 9, 6))
+ * Tp::BaseConnectionAvatarsInterfacePtr avatarsIface;
+ * #endif
+ * \endcode
+ */
+#define TP_QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
+
#ifdef BUILDING_TP_QT
# define TP_QT_EXPORT Q_DECL_EXPORT
#else
More information about the telepathy-commits
mailing list