OSDN Git Service

Added support for Visual Studio 2017.9 (v15.9.21).
[mutilities/MUtilities.git] / include / MUtils / Version.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 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.
14 //
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
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
20 //////////////////////////////////////////////////////////////////////////////////
21
22 #pragma once
23
24 //MUtils
25 #include <MUtils/Global.h>
26
27 //Qt
28 #include <QString>
29 #include <QDate>
30 #include <QTime>
31
32 namespace MUtils
33 {
34         class Version
35         {
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);
40
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);
44
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());
48
49                 //Compiler detection
50                 static const char *const compiler_version(void)
51                 {
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 == 1924)
71                                                 #if((_MSC_FULL_VER >= 192428314) && (_MSC_FULL_VER <= 192428314))
72                                                         "MSVC 2019.4";
73                                                 #else
74                                                         #error Compiler version is not supported yet!
75                                                 #endif
76                                         #elif (_MSC_VER == 1923)
77                                                 #if((_MSC_FULL_VER >= 192328105) && (_MSC_FULL_VER <= 192328105))
78                                                         "MSVC 2019.3";
79                                                 #else
80                                                         #error Compiler version is not supported yet!
81                                                 #endif
82                                         #elif (_MSC_VER == 1922)
83                                                 #if((_MSC_FULL_VER >= 192227905) && (_MSC_FULL_VER <= 192227905))
84                                                         "MSVC 2019.2";
85                                                 #else
86                                                         #error Compiler version is not supported yet!
87                                                 #endif
88                                         #elif (_MSC_VER == 1921)
89                                                 #if((_MSC_FULL_VER >= 192127702) && (_MSC_FULL_VER <= 192127702))
90                                                         "MSVC 2019.1";
91                                                 #else
92                                                         #error Compiler version is not supported yet!
93                                                 #endif
94                                         #elif (_MSC_VER == 1920)
95                                                 #if((_MSC_FULL_VER >= 192027508) && (_MSC_FULL_VER <= 192027508))
96                                                         "MSVC 2019.0";
97                                                 #else
98                                                         #error Compiler version is not supported yet!
99                                                 #endif
100                                         #elif (_MSC_VER == 1916)
101                                                 #if((_MSC_FULL_VER >= 191627024) && (_MSC_FULL_VER <= 191627038))
102                                                         "MSVC 2017.9";
103                                                 #else
104                                                         #error Compiler version is not supported yet!
105                                                 #endif
106                                         #elif (_MSC_VER == 1915)
107                                                 #if((_MSC_FULL_VER >= 191526726) && (_MSC_FULL_VER <= 191526732))
108                                                         "MSVC 2017.8";
109                                                 #else
110                                                         #error Compiler version is not supported yet!
111                                                 #endif
112                                         #elif (_MSC_VER == 1914)
113                                                 #if((_MSC_FULL_VER >= 191426430) && (_MSC_FULL_VER <= 191426433))
114                                                         "MSVC 2017.7";
115                                                 #else
116                                                         #error Compiler version is not supported yet!
117                                                 #endif
118                                         #elif (_MSC_VER == 1913)
119                                                 #if((_MSC_FULL_VER >= 191326128) && (_MSC_FULL_VER <= 191326132))
120                                                         "MSVC 2017.6";
121                                                 #else
122                                                         #error Compiler version is not supported yet!
123                                                 #endif
124                                         #elif (_MSC_VER == 1912)
125                                                 #if((_MSC_FULL_VER >= 191225830) && (_MSC_FULL_VER <= 191225835))
126                                                         "MSVC 2017.5";
127                                                 #else
128                                                         #error Compiler version is not supported yet!
129                                                 #endif
130                                         #elif (_MSC_VER == 1911)
131                                                 #if((_MSC_FULL_VER >= 191125542) && (_MSC_FULL_VER <= 191125547))
132                                                         "MSVC 2017.4";
133                                                 #elif((_MSC_FULL_VER >= 191125506) && (_MSC_FULL_VER <= 191125508))
134                                                         "MSVC 2017.3";
135                                                 #else
136                                                         #error Compiler version is not supported yet!
137                                                 #endif
138                                         #elif (_MSC_VER == 1910)
139                                                 #if ((_MSC_FULL_VER >= 191025017) && (_MSC_FULL_VER <= 191025019))
140                                                         "MSVC 2017.2";
141                                                 #else
142                                                         #error Compiler version is not supported yet!
143                                                 #endif
144                                         #elif (_MSC_VER == 1900)
145                                                 #if (_MSC_FULL_VER == 190023026)
146                                                         "MSVC 2015";
147                                                 #elif (_MSC_FULL_VER == 190023506)
148                                                         "MSVC 2015.1";
149                                                 #elif (_MSC_FULL_VER == 190023918)
150                                                         "MSVC 2015.2";
151                                                 #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
152                                                         "MSVC 2015.3";
153                                                 #else
154                                                         #error Compiler version is not supported yet!
155                                                 #endif
156                                         #elif (_MSC_VER == 1800)
157                                                 #if (_MSC_FULL_VER == 180021005)
158                                                         "MSVC 2013";
159                                                 #elif (_MSC_FULL_VER == 180030501)
160                                                         "MSVC 2013.2";
161                                                 #elif (_MSC_FULL_VER == 180030723)
162                                                         "MSVC 2013.3";
163                                                 #elif (_MSC_FULL_VER == 180031101)
164                                                         "MSVC 2013.4";
165                                                 #elif (_MSC_FULL_VER == 180040629)
166                                                         "MSVC 2013.5";
167                                                 #else
168                                                         #error Compiler version is not supported yet!
169                                                 #endif
170                                         #elif (_MSC_VER == 1700)
171                                                 #if (_MSC_FULL_VER == 170050727)
172                                                         "MSVC 2012";
173                                                 #elif (_MSC_FULL_VER == 170051106)
174                                                         "MSVC 2012.1";
175                                                 #elif (_MSC_FULL_VER == 170060315)
176                                                         "MSVC 2012.2";
177                                                 #elif (_MSC_FULL_VER == 170060610)
178                                                         "MSVC 2012.3";
179                                                 #elif (_MSC_FULL_VER == 170061030)
180                                                         "MSVC 2012.4";
181                                                 #else
182                                                         #error Compiler version is not supported yet!
183                                                 #endif
184                                         #elif (_MSC_VER == 1600)
185                                                 #if (_MSC_FULL_VER >= 160040219)
186                                                         "MSVC 2010-SP1";
187                                                 #else
188                                                         "MSVC 2010";
189                                                 #endif
190                                         #else
191                                                 #error Compiler is not supported!
192                                         #endif
193                                 #else
194                                         #error Compiler is not supported!
195                                 #endif
196                         return COMPILER_VERS;
197                 }
198
199                 //Architecture detection
200                 static const char *const compiler_arch(void)
201                 {
202                         static const char *const COMPILER_ARCH =
203                                 #if defined(_M_X64)
204                                         "x64";
205                                 #elif defined(_M_IX86)
206                                         "x86";
207                                 #else
208                                         #error Architecture is not supported!
209                                 #endif
210                         return COMPILER_ARCH;
211                 }
212         
213         private:
214                 //Raw Build date
215                 static const char *const build_date_raw(void)
216                 {
217                         static const char *const RAW_BUILD_DATE = __DATE__;
218                         return RAW_BUILD_DATE;
219                 }
220
221                 //Raw Build time
222                 static const char *const build_time_raw(void)
223                 {
224                         static const char *const RAW_BUILD_TIME = __TIME__;
225                         return RAW_BUILD_TIME;
226                 }
227
228                 //Disable construction
229                 Version(void)           { throw 666; }
230                 Version(const Version&) { throw 666; }
231         };
232 }
233
234 ///////////////////////////////////////////////////////////////////////////////