1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#include "qtdiag.h"
30
31#include <QtGui/QGuiApplication>
32#include <QtCore/QCommandLineParser>
33
34#include <iostream>
35#include <string>
36
37QT_USE_NAMESPACE
38
39int main(int argc, char **argv)
40{
41 QGuiApplication app(argc, argv);
42
43 QCoreApplication::setApplicationName(QStringLiteral("qtdiag"));
44 QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
45 QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
46 QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
47
48 QCommandLineParser commandLineParser;
49 const QCommandLineOption noGlOption(QStringLiteral("no-gl"), QStringLiteral("Do not output GL information"));
50 const QCommandLineOption glExtensionOption(QStringLiteral("gl-extensions"), QStringLiteral("List GL extensions"));
51 const QCommandLineOption fontOption(QStringLiteral("fonts"), QStringLiteral("Output list of fonts"));
52 const QCommandLineOption noVkOption(QStringLiteral("no-vulkan"), QStringLiteral("Do not output Vulkan information"));
53 const QCommandLineOption noRhiOption(QStringLiteral("no-rhi"), QStringLiteral("Do not output RHI information"));
54 commandLineParser.setApplicationDescription(QStringLiteral("Prints diagnostic output about the Qt library."));
55 commandLineParser.addOption(commandLineOption: noGlOption);
56 commandLineParser.addOption(commandLineOption: glExtensionOption);
57 commandLineParser.addOption(commandLineOption: fontOption);
58 commandLineParser.addOption(commandLineOption: noVkOption);
59 commandLineParser.addOption(commandLineOption: noRhiOption);
60 commandLineParser.addHelpOption();
61 commandLineParser.process(app);
62 unsigned flags = commandLineParser.isSet(option: noGlOption) ? 0u : unsigned(QtDiagGl);
63 if (commandLineParser.isSet(option: glExtensionOption))
64 flags |= QtDiagGlExtensions;
65 if (commandLineParser.isSet(option: fontOption))
66 flags |= QtDiagFonts;
67 if (!commandLineParser.isSet(option: noVkOption))
68 flags |= QtDiagVk;
69 if (!commandLineParser.isSet(option: noRhiOption))
70 flags |= QtDiagRhi;
71
72 std::wcout << qtDiag(flags).toStdWString();
73 std::wcout.flush();
74 return 0;
75}
76

source code of qttools/src/qtdiag/main.cpp