66#include " buildconfig.h"
77
88#include < QCoreApplication>
9- #include < QDateTime>
10- #include < QDir>
11- #include < QFile>
12- #include < QFileInfo>
139#include < QLocale>
1410#include < QOperatingSystemVersion>
15- #include < QStandardPaths>
16- #include < QStringBuilder>
1711#include < QStringList>
1812#include < QSysInfo>
1913#include < QtGlobal>
@@ -38,25 +32,12 @@ namespace swift::config
3832 return s;
3933 }
4034
41- bool CBuildConfig::isKnownExecutableName (const QString &executable)
42- {
43- return executable == CBuildConfig::swiftCoreExecutableName () ||
44- executable == CBuildConfig::swiftDataExecutableName () ||
45- executable == CBuildConfig::swiftGuiExecutableName ();
46- }
47-
48- bool CBuildConfig::isRunningOnWindows10 ()
49- {
50- if (!CBuildConfig::isRunningOnWindowsNtPlatform ()) { return false ; }
51- return (QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows10);
52- }
53-
5435 const QString &CBuildConfig::getPlatformString ()
5536 {
5637 static const QString p ([] {
57- if (CBuildConfig::isRunningOnLinuxPlatform ()) return QString (" Linux" );
58- if (CBuildConfig::isRunningOnMacOSPlatform ()) return QString (" MacOS" );
59- if (CBuildConfig::isRunningOnWindowsNtPlatform ())
38+ if constexpr (CBuildConfig::isRunningOnLinuxPlatform ()) return QString (" Linux" );
39+ if constexpr (CBuildConfig::isRunningOnMacOSPlatform ()) return QString (" MacOS" );
40+ if constexpr (CBuildConfig::isRunningOnWindowsNtPlatform ())
6041 {
6142 if (CBuildConfig::buildWordSize () == 32 ) return QString (" Win32" );
6243 if (CBuildConfig::buildWordSize () == 64 ) return QString (" Win64" );
@@ -70,7 +51,7 @@ namespace swift::config
7051 {
7152 bool isLocalDeveloperBuildImpl ()
7253 {
73- if (!CBuildConfig::isDebugBuild ()) { return false ; }
54+ if constexpr (!CBuildConfig::isDebugBuild ()) { return false ; }
7455 const QString p = QCoreApplication::applicationDirPath ().toLower ();
7556
7657 // guessing, feel free to add path checks
@@ -91,46 +72,29 @@ namespace swift::config
9172 return v ? QStringLiteral (" yes" ) : QStringLiteral (" no" );
9273 }
9374
94- const QString &CBuildConfig::compiledWithInfo ( bool shortVersion )
75+ const QString &CBuildConfig::compiledWithInfoShort ( )
9576 {
96- if (shortVersion)
97- {
98- static QString infoShort;
99- if (infoShort.isEmpty ())
100- {
101- QStringList sl;
102- if (CBuildConfig::isCompiledWithCore ()) { sl << " Core" ; }
103- if (CBuildConfig::isCompiledWithSound ()) { sl << " Sound" ; }
104- if (CBuildConfig::isCompiledWithInput ()) { sl << " Input" ; }
105- if (CBuildConfig::isCompiledWithGui ()) { sl << " Gui" ; }
106- if (CBuildConfig::isCompiledWithFs9Support ()) { sl << " FS9" ; }
107- if (CBuildConfig::isCompiledWithFsxSupport ()) { sl << " FSX" ; }
108- if (CBuildConfig::isCompiledWithXPlaneSupport ()) { sl << " XPlane" ; }
109- if (CBuildConfig::isCompiledWithP3DSupport ()) { sl << " P3D" ; }
110- if (CBuildConfig::isCompiledWithFGSupport ()) { sl << " FG" ; }
111- infoShort = sl.join (" , " );
112- if (infoShort.isEmpty ()) { infoShort = " <none>" ; }
113- }
114- return infoShort;
115- }
116- else
117- {
118- static QString infoLong;
119- if (infoLong.isEmpty ())
120- {
121- infoLong = infoLong.append (" Core: " ).append (boolToYesNo (isCompiledWithCore ()));
122- infoLong = infoLong.append (" Input: " ).append (boolToYesNo (isCompiledWithInput ()));
123- infoLong = infoLong.append (" Sound: " ).append (boolToYesNo (isCompiledWithSound ()));
124- infoLong = infoLong.append (" GUI: " ).append (boolToYesNo (isCompiledWithGui ()));
125-
126- infoLong = infoLong.append (" FS9: " ).append (boolToYesNo (isCompiledWithFs9Support ()));
127- infoLong = infoLong.append (" FSX: " ).append (boolToYesNo (isCompiledWithFsxSupport ()));
128- infoLong = infoLong.append (" P3D: " ).append (boolToYesNo (isCompiledWithP3DSupport ()));
129- infoLong = infoLong.append (" XPlane: " ).append (boolToYesNo (isCompiledWithXPlaneSupport ()));
130- infoLong = infoLong.append (" FG: " ).append (boolToYesNo (isCompiledWithFGSupport ()));
131- }
132- return infoLong;
133- }
77+ static QString infoShort;
78+ QStringList sl;
79+ if constexpr (CBuildConfig::isCompiledWithFs9Support ()) { sl << " FS9" ; }
80+ if constexpr (CBuildConfig::isCompiledWithFsxSupport ()) { sl << " FSX" ; }
81+ if constexpr (CBuildConfig::isCompiledWithXPlaneSupport ()) { sl << " XPlane" ; }
82+ if constexpr (CBuildConfig::isCompiledWithP3DSupport ()) { sl << " P3D" ; }
83+ if constexpr (CBuildConfig::isCompiledWithFGSupport ()) { sl << " FG" ; }
84+ infoShort = sl.join (" , " );
85+ if (infoShort.isEmpty ()) { infoShort = " <none>" ; }
86+ return infoShort;
87+ }
88+
89+ const QString &CBuildConfig::compiledWithInfoLong ()
90+ {
91+ static QString infoLong;
92+ infoLong = infoLong.append (" FS9: " ).append (boolToYesNo (isCompiledWithFs9Support ()));
93+ infoLong = infoLong.append (" FSX: " ).append (boolToYesNo (isCompiledWithFsxSupport ()));
94+ infoLong = infoLong.append (" P3D: " ).append (boolToYesNo (isCompiledWithP3DSupport ()));
95+ infoLong = infoLong.append (" XPlane: " ).append (boolToYesNo (isCompiledWithXPlaneSupport ()));
96+ infoLong = infoLong.append (" FG: " ).append (boolToYesNo (isCompiledWithFGSupport ()));
97+ return infoLong;
13498 }
13599
136100 const QString &CBuildConfig::gitHubRepoUrl ()
0 commit comments