Added project/solution files for VS2017.
[MUtilities.git] / include / MUtils / Version.h
blob81dd6c408bf8a60afc3f880b58eaa8f77ddf33de
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.
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 #if defined(__INTEL_COMPILER)
53 #if (__INTEL_COMPILER >= 1500)
54 static const char *const COMPILER_VERS = "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
55 #elif (__INTEL_COMPILER >= 1400)
56 static const char *const COMPILER_VERS = "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
57 #elif (__INTEL_COMPILER >= 1300)
58 static const char *const COMPILER_VERS = "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
59 #elif (__INTEL_COMPILER >= 1200)
60 static const char *const COMPILER_VERS = "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
61 #elif (__INTEL_COMPILER >= 1100)
62 static const char *const COMPILER_VERS = "ICL 11.x";
63 #elif (__INTEL_COMPILER >= 1000)
64 static const char *const COMPILER_VERS = "ICL 10.x";
65 #else
66 #error Compiler is not supported!
67 #endif
68 #elif defined(_MSC_VER)
69 #if (_MSC_VER == 1910)
70 #if ((_MSC_FULL_VER >= 191025017) && (_MSC_FULL_VER <= 191025019))
71 static const char *const COMPILER_VERS = "MSVC 2017.2";
72 #else
73 #error Compiler version is not supported yet!
74 #endif
75 #elif (_MSC_VER == 1900)
76 #if (_MSC_FULL_VER == 190023026)
77 static const char *const COMPILER_VERS = "MSVC 2015";
78 #elif (_MSC_FULL_VER == 190023506)
79 static const char *const COMPILER_VERS = "MSVC 2015.1";
80 #elif (_MSC_FULL_VER == 190023918)
81 static const char *const COMPILER_VERS = "MSVC 2015.2";
82 #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
83 static const char *const COMPILER_VERS = "MSVC 2015.3";
84 #else
85 #error Compiler version is not supported yet!
86 #endif
87 #elif (_MSC_VER == 1800)
88 #if (_MSC_FULL_VER == 180021005)
89 static const char *const COMPILER_VERS = "MSVC 2013";
90 #elif (_MSC_FULL_VER == 180030501)
91 static const char *const COMPILER_VERS = "MSVC 2013.2";
92 #elif (_MSC_FULL_VER == 180030723)
93 static const char *const COMPILER_VERS = "MSVC 2013.3";
94 #elif (_MSC_FULL_VER == 180031101)
95 static const char *const COMPILER_VERS = "MSVC 2013.4";
96 #elif (_MSC_FULL_VER == 180040629)
97 static const char *const COMPILER_VERS = "MSVC 2013.5";
98 #else
99 #error Compiler version is not supported yet!
100 #endif
101 #elif (_MSC_VER == 1700)
102 #if (_MSC_FULL_VER == 170050727)
103 static const char *const COMPILER_VERS = "MSVC 2012";
104 #elif (_MSC_FULL_VER == 170051106)
105 static const char *const COMPILER_VERS = "MSVC 2012.1";
106 #elif (_MSC_FULL_VER == 170060315)
107 static const char *const COMPILER_VERS = "MSVC 2012.2";
108 #elif (_MSC_FULL_VER == 170060610)
109 static const char *const COMPILER_VERS = "MSVC 2012.3";
110 #elif (_MSC_FULL_VER == 170061030)
111 static const char *const COMPILER_VERS = "MSVC 2012.4";
112 #else
113 #error Compiler version is not supported yet!
114 #endif
115 #elif (_MSC_VER == 1600)
116 #if (_MSC_FULL_VER >= 160040219)
117 static const char *const COMPILER_VERS = "MSVC 2010-SP1";
118 #else
119 static const char *const COMPILER_VERS = "MSVC 2010";
120 #endif
121 #elif (_MSC_VER == 1500)
122 #if (_MSC_FULL_VER >= 150030729)
123 static const char *const COMPILER_VERS = "MSVC 2008-SP1";
124 #else
125 static const char *const COMPILER_VERS = "MSVC 2008";
126 #endif
127 #else
128 #error Compiler is not supported!
129 #endif
130 #else
131 #error Compiler is not supported!
132 #endif
134 return COMPILER_VERS;
137 //Architecture detection
138 static const char *const compiler_arch(void)
140 #if defined(_M_X64)
141 static const char *const COMPILER_ARCH = "x64";
142 #elif defined(_M_IX86)
143 static const char *const COMPILER_ARCH = "x86";
144 #else
145 #error Architecture is not supported!
146 #endif
148 return COMPILER_ARCH;
151 private:
152 //Raw Build date
153 static const char *const build_date_raw(void)
155 static const char *const RAW_BUILD_DATE = __DATE__;
156 return RAW_BUILD_DATE;
159 //Raw Build time
160 static const char *const build_time_raw(void)
162 static const char *const RAW_BUILD_TIME = __TIME__;
163 return RAW_BUILD_TIME;
166 //Disable construction
167 Version(void) { throw 666; }
168 Version(const Version&) { throw 666; }
172 ///////////////////////////////////////////////////////////////////////////////