Added support for VS2022 Update-10.
[MUtilities.git] / include / MUtils / Version.h
blob3efa44b2e0bc2694aaf96d1f7994f03bdec9c00c
1 ///////////////////////////////////////////////////////////////////////////////
2 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2023 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
20 //////////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 //MUtils
25 #include <MUtils/Global.h>
27 //Qt
28 #include <QString>
29 #include <QDate>
30 #include <QTime>
32 namespace MUtils
34 class Version
36 public:
37 //Get Library Version Numbers
38 MUTILS_API static const quint32 &lib_version_major(void);
39 MUTILS_API static const quint32 &lib_version_minor(void);
41 //Get Library Build Date/Time
42 MUTILS_API static const QDate lib_build_date(void);
43 MUTILS_API static const QTime lib_build_time(void);
45 //Get Application Build Date/Time
46 MUTILS_API static const QDate app_build_date(const char *const date_str = build_date_raw());
47 MUTILS_API static const QTime app_build_time(const char *const time_str = build_time_raw());
49 //Compiler detection
50 static const char *const compiler_version(void)
52 static const char *const COMPILER_VERS =
53 #if defined(__INTEL_COMPILER)
54 #if (__INTEL_COMPILER >= 1500)
55 "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
56 #elif (__INTEL_COMPILER >= 1400)
57 "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
58 #elif (__INTEL_COMPILER >= 1300)
59 "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
60 #elif (__INTEL_COMPILER >= 1200)
61 "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
62 #elif (__INTEL_COMPILER >= 1100)
63 "ICL 11.x";
64 #elif (__INTEL_COMPILER >= 1000)
65 "ICL 10.x";
66 #else
67 #error Compiler is not supported!
68 #endif
69 #elif defined(_MSC_VER)
70 #if (_MSC_VER == 1940)
71 "MSVC 2022.10";
72 #elif (_MSC_VER == 1939)
73 "MSVC 2022.9";
74 #elif (_MSC_VER == 1938)
75 "MSVC 2022.8";
76 #elif (_MSC_VER == 1937)
77 "MSVC 2022.7";
78 #elif (_MSC_VER == 1936)
79 "MSVC 2022.6";
80 #elif (_MSC_VER == 1933)
81 "MSVC 2022.3";
82 #elif (_MSC_VER == 1932)
83 "MSVC 2022.2";
84 #elif (_MSC_VER == 1931)
85 "MSVC 2022.1";
86 #elif (_MSC_VER == 1930)
87 #if (_MSC_FULL_VER <= 193030706)
88 "MSVC 2022.0";
89 #else
90 #error Compiler version is not supported yet!
91 #endif
92 #elif (_MSC_VER == 1929)
93 #if (_MSC_FULL_VER < 192930133)
94 "MSVC 2019.10";
95 #else
96 "MSVC 2019.11";
97 #endif
98 #elif (_MSC_VER == 1928)
99 #if (_MSC_FULL_VER < 192829910)
100 "MSVC 2019.8";
101 #else
102 "MSVC 2019.9";
103 #endif
104 #elif (_MSC_VER == 1927)
105 "MSVC 2019.7";
106 #elif (_MSC_VER == 1926)
107 "MSVC 2019.6";
108 #elif (_MSC_VER == 1925)
109 "MSVC 2019.5";
110 #elif (_MSC_VER == 1924)
111 "MSVC 2019.4";
112 #elif (_MSC_VER == 1923)
113 "MSVC 2019.3";
114 #elif (_MSC_VER == 1922)
115 "MSVC 2019.2";
116 #elif (_MSC_VER == 1921)
117 "MSVC 2019.1";
118 #elif (_MSC_VER == 1920)
119 "MSVC 2019.0";
120 #elif (_MSC_VER == 1916)
121 "MSVC 2017.9";
122 #elif (_MSC_VER == 1915)
123 "MSVC 2017.8";
124 #elif (_MSC_VER == 1914)
125 "MSVC 2017.7";
126 #elif (_MSC_VER == 1913)
127 "MSVC 2017.6";
128 #elif (_MSC_VER == 1912)
129 "MSVC 2017.5";
130 #elif (_MSC_VER == 1911)
131 "MSVC 2017.4";
132 #elif (_MSC_VER == 1910)
133 "MSVC 2017.2";
134 #elif (_MSC_VER == 1900)
135 #if (_MSC_FULL_VER == 190023026)
136 "MSVC 2015";
137 #elif (_MSC_FULL_VER == 190023506)
138 "MSVC 2015.1";
139 #elif (_MSC_FULL_VER == 190023918)
140 "MSVC 2015.2";
141 #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
142 "MSVC 2015.3";
143 #else
144 #error Compiler version is not supported yet!
145 #endif
146 #elif (_MSC_VER == 1800)
147 #if (_MSC_FULL_VER == 180021005)
148 "MSVC 2013";
149 #elif (_MSC_FULL_VER == 180030501)
150 "MSVC 2013.2";
151 #elif (_MSC_FULL_VER == 180030723)
152 "MSVC 2013.3";
153 #elif (_MSC_FULL_VER == 180031101)
154 "MSVC 2013.4";
155 #elif (_MSC_FULL_VER == 180040629)
156 "MSVC 2013.5";
157 #else
158 #error Compiler version is not supported yet!
159 #endif
160 #elif (_MSC_VER == 1700)
161 #if (_MSC_FULL_VER == 170050727)
162 "MSVC 2012";
163 #elif (_MSC_FULL_VER == 170051106)
164 "MSVC 2012.1";
165 #elif (_MSC_FULL_VER == 170060315)
166 "MSVC 2012.2";
167 #elif (_MSC_FULL_VER == 170060610)
168 "MSVC 2012.3";
169 #elif (_MSC_FULL_VER == 170061030)
170 "MSVC 2012.4";
171 #else
172 #error Compiler version is not supported yet!
173 #endif
174 #elif (_MSC_VER == 1600)
175 #if (_MSC_FULL_VER >= 160040219)
176 "MSVC 2010-SP1";
177 #else
178 "MSVC 2010";
179 #endif
180 #else
181 #error Compiler is not supported!
182 #endif
183 #else
184 #error Compiler is not supported!
185 #endif
186 return COMPILER_VERS;
189 //Architecture detection
190 static const char *const compiler_arch(void)
192 static const char *const COMPILER_ARCH =
193 #if defined(_M_X64)
194 "x64";
195 #elif defined(_M_IX86)
196 "x86";
197 #else
198 #error Architecture is not supported!
199 #endif
200 return COMPILER_ARCH;
203 private:
204 //Raw Build date
205 static const char *const build_date_raw(void)
207 static const char *const RAW_BUILD_DATE = __DATE__;
208 return RAW_BUILD_DATE;
211 //Raw Build time
212 static const char *const build_time_raw(void)
214 static const char *const RAW_BUILD_TIME = __TIME__;
215 return RAW_BUILD_TIME;
218 //Disable construction
219 Version(void) { throw 666; }
220 Version(const Version&) { throw 666; }
224 ///////////////////////////////////////////////////////////////////////////////