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