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>
This commit is contained in:
parent
5adba7cba7
commit
5ae5bebb93
@ -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
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
static QDate buildDate();
|
||||
#endif //QT_NO_DATESTRING
|
||||
|
||||
static const char * build();
|
||||
|
||||
static bool isDebugBuild();
|
||||
|
||||
enum LibraryLocation
|
||||
|
@ -116,10 +116,8 @@ int main(int argc, char **argv)
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
const QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
|
||||
std::cout << "Qt " << QT_VERSION_STR << " on \"" << QGuiApplication::platformName().toStdString() << "\" "
|
||||
<< QSysInfo::WordSize << " bit/"
|
||||
std::cout << QLibraryInfo::build() << " on \"" << QGuiApplication::platformName().toStdString() << "\" "
|
||||
<< (QSysInfo::ByteOrder == QSysInfo::LittleEndian ? "little endian" : "big endian") << '/'
|
||||
<< (QLibraryInfo::isDebugBuild() ? "debug" : "release")
|
||||
<< '\n';
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
Loading…
Reference in New Issue
Block a user