Seamly2D
Code documentation
projectversion.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file projectversion.cpp
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 8 7, 2015
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #include "projectversion.h"
53 
54 #include <qcompilerdetection.h>
55 #include <QCoreApplication>
56 #include <QLatin1Char>
57 #include <QLatin1String>
58 #include <QObject>
59 #include <QStaticStringData>
60 #include <QString>
61 #include <QStringData>
62 #include <QStringDataPtr>
63 #include <QSysInfo>
64 #include <QtGlobal>
65 
66 // Start: Do not edit here, use scripts/version.sh to update
67 extern const int MAJOR_VERSION = 0;
68 extern const int MINOR_VERSION = 6;
69 extern const int DEBUG_VERSION = 0;
70 extern const int SUPER_MINOR__VERSION = 1;
71 // End: Do not edit here
72 
73 extern const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION)
75 
76 //---------------------------------------------------------------------------------------------------------------------
77 QString compilerString()
78 {
79 #if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them
80  QString iccCompact;
81 #ifdef __INTEL_CLANG_COMPILER
82  iccCompact = QLatin1String("Clang");
83 #elif defined(__INTEL_MS_COMPAT_LEVEL)
84  iccCompact = QLatin1String("Microsoft");
85 #elif defined(__GNUC__)
86  iccCompact = QLatin1String("GCC");
87 #else
88  iccCompact = QLatin1String("no");
89 #endif
90  QString iccVersion;
91  if (__INTEL_COMPILER >= 1300)
92  {
93  iccVersion = QString::number(__INTEL_COMPILER/100);
94  }
95  else
96  {
97  iccVersion = QLatin1String(__INTEL_COMPILER);
98  }
99 #ifdef __INTEL_COMPILER_UPDATE
100  return QLatin1String("Intel(R) C++ ") + iccVersion + QLatin1String(".") + QLatin1String(__INTEL_COMPILER_UPDATE) +
101  QLatin1String(" build ") + QLatin1String(__INTEL_COMPILER_BUILD_DATE) + QLatin1String(" [") +
102  QLatin1String(iccCompact) + QLatin1String(" compatibility]");
103 #else
104  return QLatin1String("Intel(R) C++ ") + iccVersion + QLatin1String(" build ") +
105  QLatin1String(__INTEL_COMPILER_BUILD_DATE) + QLatin1String(" [") + iccCompact +
106  QLatin1String(" compatibility]");
107 #endif
108 #elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
109  QString isAppleString;
110 #if defined(__apple_build_version__) // Apple clang has other version numbers
111  isAppleString = QLatin1String(" (Apple)");
112 #endif
113  return QLatin1String("Clang " ) + QString::number(__clang_major__) + QLatin1Char('.')
114  + QString::number(__clang_minor__) + isAppleString;
115 #elif defined(Q_CC_GNU)
116  return QLatin1String("GCC " ) + QLatin1String(__VERSION__);
117 #elif defined(Q_CC_MSVC)
118  if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
119  {
120  return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
121  }
122  if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
123  {
124  return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
125  }
126 #else
127  return QStringLiteral("<unknown compiler>");
128 #endif
129 }
130 
131 //---------------------------------------------------------------------------------------------------------------------
133 {
134  return QCoreApplication::tr("Based on Qt %1 (%2, %3 bit)").arg(QLatin1String(qVersion()), compilerString(),
135  QString::number(QSysInfo::WordSize));
136 }
const int MAJOR_VERSION
QString compilerString()
const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION) .arg(DEBUG_VERSION).arg(SUPER_MINOR__VERSION))
const int DEBUG_VERSION
const int SUPER_MINOR__VERSION
const int MINOR_VERSION
QString buildCompatibilityString()