summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-07-20 12:44:16 +0200
committerLars Knoll <lars.knoll@qt.io>2016-08-19 04:27:06 +0000
commit48b4e0bf6f1cc4ce4831c2212d57f00fe792468f (patch)
tree6a9bd7ef1de478683e098561d1189e81b1894004 /src/corelib/global
parentde1da50557a8a641f0620b1e4c490fc1f36b70c9 (diff)
Improve library version handling
Output the version as a define into the private config header as a define using a hex number. Like that we can easily do version checks on libraries using the QT_LIBRARY_VERSION(lib) and QT_VERSION_CHECK() macros. Change-Id: I6dc4ac6550886ca95c5542b6e75cd933ed079d76 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal_p.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h
index e8d822b6c6..e75d87b384 100644
--- a/src/corelib/global/qglobal_p.h
+++ b/src/corelib/global/qglobal_p.h
@@ -48,5 +48,14 @@
#include "qglobal.h"
#include "qglobal_p.h" // include self to avoid syncqt warning - no-op
+#ifndef QT_BOOTSTRAPPED
+#include <QtCore/private/qconfig_p.h>
+#endif
+
+#define QT_LIBRARY_VERSION(lib) QT_LIBRARY_VERSION_##lib
+#define QT_LIBRARY_VERSION_MAJOR(lib) (QT_LIBRARY_VERSION_##lib >> 16)
+#define QT_LIBRARY_VERSION_MINOR(lib) ((QT_LIBRARY_VERSION_##lib >> 8) & 0xff)
+#define QT_LIBRARY_VERSION_PATCH(lib) (QT_LIBRARY_VERSION_##lib & 0xff)
+
#endif // QGLOBAL_P_H