summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlibraryinfo.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-02-06 16:16:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-12 17:24:33 +0100
commit5ae5bebb93ec38e17c0dcb9bec47e0ebfbce4937 (patch)
tree2d4eb30148be80f8e75513e8ededffcce15cfd70 /src/corelib/global/qlibraryinfo.cpp
parent5adba7cba739a4befca86dca026753ea69605c31 (diff)
Added function returning build information to QLibraryInfo.
Useful for bug reports and test logs. [ChangeLog][QtCore] QLibraryInfo provides information on how Qt was built. Change-Id: I867197fd7d2e10bcdf01a8eb47c9c1e03647e2c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r--src/corelib/global/qlibraryinfo.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 6ad94b5067..ed1715ddb5 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -255,6 +255,57 @@ QLibraryInfo::buildDate()
}
#endif //QT_NO_DATESTRING
+#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
+# ifdef __apple_build_version__ // Apple clang has other version numbers
+# define COMPILER_STRING __clang_version__ " (Apple)"
+# else
+# define COMPILER_STRING __clang_version__
+# endif
+#elif defined(Q_CC_GNU)
+# define COMPILER_STRING "GCC " __VERSION__
+#elif defined(Q_CC_MSVC)
+# if _MSC_VER < 1600
+# define COMPILER_STRING "MSVC 2008"
+# elif _MSC_VER < 1700
+# define COMPILER_STRING "MSVC 2010"
+# elif _MSC_VER < 1800
+# define COMPILER_STRING "MSVC 2012"
+# elif _MSC_VER < 1900
+# define COMPILER_STRING "MSVC 2013"
+# else
+# define COMPILER_STRING "MSVC <unknown version>"
+# endif
+#else
+# define COMPILER_STRING "<unknown compiler>"
+#endif
+
+/*!
+ Returns a string describing how this version of Qt was built.
+
+ \internal
+
+ \since 5.3
+*/
+
+const char *QLibraryInfo::build()
+{
+ static const char data[] = "Qt " QT_VERSION_STR " (" __DATE__ "), "
+ COMPILER_STRING ", "
+#if QT_POINTER_SIZE == 4
+ "32"
+#else
+ "64"
+#endif
+ " bit, "
+#ifdef QT_NO_DEBUG
+ "release"
+#else
+ "debug"
+#endif
+ " build)";
+ return data;
+}
+
/*!
\since 5.0
Returns \c true if this build of Qt was built with debugging enabled, or