From 608fe34edb4b4d70a2ba6eca6a925f58fee52074 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Thu, 29 Dec 2022 19:53:26 +0100 Subject: cmake: Use generate_export_header() instead of doing manually This is going to make it easier for us to maintain things. It's also consistent with the new QXmppOmemo module. This requires CMake 3.7 now. Closes #523. --- src/base/QXmppBuildConstants.h.in | 33 --------------------------------- src/base/QXmppGlobal.h | 32 ++++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 43 deletions(-) delete mode 100644 src/base/QXmppBuildConstants.h.in (limited to 'src/base') diff --git a/src/base/QXmppBuildConstants.h.in b/src/base/QXmppBuildConstants.h.in deleted file mode 100644 index 787752da..00000000 --- a/src/base/QXmppBuildConstants.h.in +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: 2010 Manjeet Dahiya -// SPDX-FileCopyrightText: 2017 Niels Ole Salscheider -// SPDX-FileCopyrightText: 2019 Linus Jahn -// -// SPDX-License-Identifier: LGPL-2.1-or-later - -#ifndef QXMPPBUILDCONSTANTS_H -#define QXMPPBUILDCONSTANTS_H - -#include - -#define QXMPP_BUILD_SHARED @QXMPP_BUILD_SHARED@ - -/// -/// This macro expands a numeric value of the form 0xMMNNPP (MM = -/// major, NN = minor, PP = patch) that specifies QXmpp's version -/// number. For example, if you compile your application against -/// QXmpp 1.2.3, the QXMPP_VERSION macro will expand to 0x010203. -/// -/// You can use QXMPP_VERSION to use the latest QXmpp features where -/// available. -/// -#define QXMPP_VERSION QT_VERSION_CHECK(@PROJECT_VERSION_MAJOR@, @PROJECT_VERSION_MINOR@, @PROJECT_VERSION_PATCH@) - -/// -/// Returns the version of QXmpp used at compile time as a string. -/// -inline QLatin1String QXmppVersion() -{ - return QLatin1String("@PROJECT_VERSION@"); -} - -#endif // QXMPPBUILDCONSTANTS_H diff --git a/src/base/QXmppGlobal.h b/src/base/QXmppGlobal.h index 95867a2c..74f2b599 100644 --- a/src/base/QXmppGlobal.h +++ b/src/base/QXmppGlobal.h @@ -8,20 +8,32 @@ #ifndef QXMPPGLOBAL_H #define QXMPPGLOBAL_H -#include "QXmppBuildConstants.h" +#include "qxmpp_export.h" -#if QXMPP_BUILD_SHARED -#if defined(QXMPP_BUILD) -#define QXMPP_EXPORT Q_DECL_EXPORT -#else -#define QXMPP_EXPORT Q_DECL_IMPORT -#endif -#else -#define QXMPP_EXPORT -#endif +#include #define QXMPP_AUTOTEST_EXPORT +/// +/// This macro expands a numeric value of the form 0xMMNNPP (MM = +/// major, NN = minor, PP = patch) that specifies QXmpp's version +/// number. For example, if you compile your application against +/// QXmpp 1.2.3, the QXMPP_VERSION macro will expand to 0x010203. +/// +/// You can use QXMPP_VERSION to use the latest QXmpp features where +/// available. +/// +#define QXMPP_VERSION QT_VERSION_CHECK(QXMPP_VERSION_MAJOR, QXMPP_VERSION_MINOR, QXMPP_VERSION_PATCH) + +/// +/// Returns the version of QXmpp used at compile time as a string. +/// +inline QLatin1String QXmppVersion() +{ + return QLatin1String( + QT_STRINGIFY(QXMPP_VERSION_MAJOR) "." QT_STRINGIFY(QXMPP_VERSION_MINOR) "." QT_STRINGIFY(QXMPP_VERSION_PATCH)); +} + // This sets which deprecated functions should still be usable // It works exactly like QT_DISABLE_DEPRECATED_BEFORE #ifndef QXMPP_DISABLE_DEPRECATED_BEFORE -- cgit v1.2.3