OSDN Git Service

Added support for VS2017 version 15.3.4.
[mutilities/MUtilities.git] / include / MUtils / Version.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2017 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 == 1911)
71                                                 #if((_MSC_FULL_VER == 191125508) || (_MSC_FULL_VER == 191125506))
72                                                         "MSVC 2017.3";
73                                                 #else
74                                                         #error Compiler version is not supported yet!
75                                                 #endif
76                                         #elif (_MSC_VER == 1910)
77                                                 #if ((_MSC_FULL_VER >= 191025017) && (_MSC_FULL_VER <= 191025019))
78                                                         "MSVC 2017.2";
79                                                 #else
80                                                         #error Compiler version is not supported yet!
81                                                 #endif
82                                         #elif (_MSC_VER == 1900)
83                                                 #if (_MSC_FULL_VER == 190023026)
84                                                         "MSVC 2015";
85                                                 #elif (_MSC_FULL_VER == 190023506)
86                                                         "MSVC 2015.1";
87                                                 #elif (_MSC_FULL_VER == 190023918)
88                                                         "MSVC 2015.2";
89                                                 #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
90                                                         "MSVC 2015.3";
91                                                 #else
92                                                         #error Compiler version is not supported yet!
93                                                 #endif
94                                         #elif (_MSC_VER == 1800)
95                                                 #if (_MSC_FULL_VER == 180021005)
96                                                         "MSVC 2013";
97                                                 #elif (_MSC_FULL_VER == 180030501)
98                                                         "MSVC 2013.2";
99                                                 #elif (_MSC_FULL_VER == 180030723)
100                                                         "MSVC 2013.3";
101                                                 #elif (_MSC_FULL_VER == 180031101)
102                                                         "MSVC 2013.4";
103                                                 #elif (_MSC_FULL_VER == 180040629)
104                                                         "MSVC 2013.5";
105                                                 #else
106                                                         #error Compiler version is not supported yet!
107                                                 #endif
108                                         #elif (_MSC_VER == 1700)
109                                                 #if (_MSC_FULL_VER == 170050727)
110                                                         "MSVC 2012";
111                                                 #elif (_MSC_FULL_VER == 170051106)
112                                                         "MSVC 2012.1";
113                                                 #elif (_MSC_FULL_VER == 170060315)
114                                                         "MSVC 2012.2";
115                                                 #elif (_MSC_FULL_VER == 170060610)
116                                                         "MSVC 2012.3";
117                                                 #elif (_MSC_FULL_VER == 170061030)
118                                                         "MSVC 2012.4";
119                                                 #else
120                                                         #error Compiler version is not supported yet!
121                                                 #endif
122                                         #elif (_MSC_VER == 1600)
123                                                 #if (_MSC_FULL_VER >= 160040219)
124                                                         "MSVC 2010-SP1";
125                                                 #else
126                                                         "MSVC 2010";
127                                                 #endif
128                                         #elif (_MSC_VER == 1500)
129                                                 #if (_MSC_FULL_VER >= 150030729)
130                                                         "MSVC 2008-SP1";
131                                                 #else
132                                                         "MSVC 2008";
133                                                 #endif
134                                         #else
135                                                 #error Compiler is not supported!
136                                         #endif
137                                 #else
138                                         #error Compiler is not supported!
139                                 #endif
140                         return COMPILER_VERS;
141                 }
142
143                 //Architecture detection
144                 static const char *const compiler_arch(void)
145                 {
146                         static const char *const COMPILER_ARCH =
147                                 #if defined(_M_X64)
148                                         "x64";
149                                 #elif defined(_M_IX86)
150                                         "x86";
151                                 #else
152                                         #error Architecture is not supported!
153                                 #endif
154                         return COMPILER_ARCH;
155                 }
156         
157         private:
158                 //Raw Build date
159                 static const char *const build_date_raw(void)
160                 {
161                         static const char *const RAW_BUILD_DATE = __DATE__;
162                         return RAW_BUILD_DATE;
163                 }
164
165                 //Raw Build time
166                 static const char *const build_time_raw(void)
167                 {
168                         static const char *const RAW_BUILD_TIME = __TIME__;
169                         return RAW_BUILD_TIME;
170                 }
171
172                 //Disable construction
173                 Version(void)           { throw 666; }
174                 Version(const Version&) { throw 666; }
175         };
176 }
177
178 ///////////////////////////////////////////////////////////////////////////////