1 | /*! |
---|
2 | * \file os.h |
---|
3 | * \author Copyright © 2007-2014 Oleksii Serdiuk <contacts[at]oleksii[dot]name> |
---|
4 | * |
---|
5 | * $Id: $Format:%h %ai %an$ $ |
---|
6 | * $URL: http://tspsg.info/ $ |
---|
7 | * |
---|
8 | * \warning Arch detection works only for <b>GNU C</b>, <b>Visual Studio</b>, <b>Intel C/C++</b> and <b>MinGW32</b> compilers. |
---|
9 | * OS detection should work for any compiler. |
---|
10 | * |
---|
11 | * \brief Contains TSPSG target CPU architecture and OS detection. |
---|
12 | * |
---|
13 | * <b>TSPSG: TSP Solver and Generator</b> |
---|
14 | * |
---|
15 | * This file is part of TSPSG. |
---|
16 | * |
---|
17 | * TSPSG is free software: you can redistribute it and/or modify |
---|
18 | * it under the terms of the GNU General Public License as published by |
---|
19 | * the Free Software Foundation, either version 2 of the License, or |
---|
20 | * (at your option) any later version. |
---|
21 | * |
---|
22 | * TSPSG is distributed in the hope that it will be useful, |
---|
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
25 | * GNU General Public License for more details. |
---|
26 | * |
---|
27 | * You should have received a copy of the GNU General Public License |
---|
28 | * along with TSPSG. If not, see <http://www.gnu.org/licenses/>. |
---|
29 | */ |
---|
30 | |
---|
31 | #ifndef OS_H |
---|
32 | #define OS_H |
---|
33 | |
---|
34 | #include <QtGlobal> |
---|
35 | |
---|
36 | // Some target arch detection. |
---|
37 | /*! |
---|
38 | * \def ARCH |
---|
39 | * \brief The target CPU architecture TSPSG was built for. |
---|
40 | * \warning NOTE: Only for <b>GNU C</b>, <b>Visual Studio</b>, <b>Intel C/C++</b> and <b>MinGW32</b> compilers. |
---|
41 | */ |
---|
42 | #if defined(__amd64__) || defined(_M_X64) |
---|
43 | # define ARCH " (AMD 64-bit)" |
---|
44 | #elif defined(__ia64__) || defined(_M_IA64) |
---|
45 | # define ARCH " (Intel 64-bit)" |
---|
46 | #elif defined(__i386__) || defined(_M_IX86) || defined(_X86_) |
---|
47 | # define ARCH " (Intel x86)" |
---|
48 | #elif defined(__powerpc__) || defined(_M_PPC) |
---|
49 | # define ARCH " (PowerPC)" |
---|
50 | #elif defined(__arm__) || defined(_M_ARM) |
---|
51 | # define ARCH " (ARM)" |
---|
52 | #elif defined(__mips__) || defined(_M_MRX000) |
---|
53 | # define ARCH " (MIPS)" |
---|
54 | #else |
---|
55 | # define ARCH "" |
---|
56 | #endif // ARCH |
---|
57 | |
---|
58 | // Target OS detection. Done by Qt, so should work for any compiler. |
---|
59 | /*! |
---|
60 | * \def OS |
---|
61 | * \brief The target operating system TSPSG was built for. |
---|
62 | */ |
---|
63 | /*! |
---|
64 | * \def OSID |
---|
65 | * \brief The target operating system ID. |
---|
66 | * |
---|
67 | * This value will be used in task file metadata. |
---|
68 | */ |
---|
69 | #ifdef Q_OS_AIX |
---|
70 | # define OS "AIX" |
---|
71 | # define OSID quint8(1) |
---|
72 | #elif defined(Q_OS_BSDI) |
---|
73 | # define OS "BSD/OS" |
---|
74 | # define OSID quint8(2) |
---|
75 | #elif defined(Q_OS_CYGWIN) |
---|
76 | # define OS "Cygwin" |
---|
77 | # define OSID quint8(3) |
---|
78 | #elif defined(Q_OS_DARWIN) |
---|
79 | # define OS "Mac OS (Darwin)" |
---|
80 | # define OSID quint8(4) |
---|
81 | #elif defined(Q_OS_DGUX) |
---|
82 | # define OS "DG/UX" |
---|
83 | # define OSID quint8(5) |
---|
84 | #elif defined(Q_OS_DYNIX) |
---|
85 | # define OS "DYNIX/ptx" |
---|
86 | # define OSID quint8(6) |
---|
87 | #elif defined(Q_OS_FREEBSD) |
---|
88 | # define OS "FreeBSD" |
---|
89 | # define OSID quint8(7) |
---|
90 | #elif defined(Q_OS_HPUX) |
---|
91 | # define OS "HP-UX" |
---|
92 | # define OSID quint8(8) |
---|
93 | #elif defined(Q_OS_HURD) |
---|
94 | # define OS "GNU Hurd" |
---|
95 | # define OSID quint8(9) |
---|
96 | #elif defined(Q_OS_IRIX) |
---|
97 | # define OS "SGI Irix" |
---|
98 | # define OSID quint8(10) |
---|
99 | #elif defined(Q_OS_LINUX) |
---|
100 | # define OS "Linux" |
---|
101 | # define OSID quint8(11) |
---|
102 | #elif defined(Q_OS_LYNX) |
---|
103 | # define OS "LynxOS" |
---|
104 | # define OSID quint8(12) |
---|
105 | #elif defined(Q_OS_NETBSD) |
---|
106 | # define OS "NetBSD" |
---|
107 | # define OSID quint8(13) |
---|
108 | #elif defined(Q_OS_OPENBSD) |
---|
109 | # define OS "OpenBSD" |
---|
110 | # define OSID quint8(14) |
---|
111 | #elif defined(Q_OS_OS2EMX) |
---|
112 | # define OS "OS/2" |
---|
113 | # define OSID quint8(15) |
---|
114 | #elif defined(Q_OS_OSF) |
---|
115 | # define OS "HP Tru64 UNIX" |
---|
116 | # define OSID quint8(16) |
---|
117 | #elif defined(Q_OS_BLACKBERRY) |
---|
118 | # define OS "BlackBerry 10" |
---|
119 | # define OSID quint8(17) |
---|
120 | #elif defined(Q_OS_QNX) |
---|
121 | # define OS "QNX Neutrino" |
---|
122 | # define OSID quint8(18) |
---|
123 | #elif defined(Q_OS_RELIANT) |
---|
124 | # define OS "Reliant UNIX" |
---|
125 | # define OSID quint8(19) |
---|
126 | #elif defined(Q_OS_SCO) |
---|
127 | # define OS "SCO OpenServer 5" |
---|
128 | # define OSID quint8(20) |
---|
129 | #elif defined(Q_OS_SOLARIS) |
---|
130 | # define OS "Sun Solaris" |
---|
131 | # define OSID quint8(21) |
---|
132 | #elif defined(Q_OS_SYMBIAN) |
---|
133 | # define OS "Symbian" |
---|
134 | # define OSID quint8(22) |
---|
135 | #elif defined(Q_OS_ULTRIX) |
---|
136 | # define OS "DEC Ultrix" |
---|
137 | # define OSID quint8(23) |
---|
138 | #elif defined(Q_OS_UNIXWARE) |
---|
139 | # define OS "UnixWare 7/Open UNIX 8" |
---|
140 | # define OSID quint8(24) |
---|
141 | #elif defined(Q_OS_WIN32) |
---|
142 | # define OS "Windows" |
---|
143 | # define OSID quint8(25) |
---|
144 | #elif defined(Q_OS_WINCE_WM) |
---|
145 | # define OS "Windows Mobile" |
---|
146 | # define OSID quint8(26) |
---|
147 | #elif defined(Q_OS_WINCE) |
---|
148 | # define OS "Windows CE" |
---|
149 | # define OSID quint8(27) |
---|
150 | #elif defined(Q_OS_BSD4) |
---|
151 | # define OS "BSD 4.4" |
---|
152 | # define OSID quint8(253) |
---|
153 | #elif defined(Q_OS_UNIX) |
---|
154 | # define OS "UNIX BSD/SYSV" |
---|
155 | # define OSID quint8(254) |
---|
156 | #else |
---|
157 | # define OS "Unknown" |
---|
158 | # define OSID quint8(255) |
---|
159 | #endif // OS |
---|
160 | |
---|
161 | //! The target platform in the form OS ARCH |
---|
162 | #define PLATFROM OS ARCH |
---|
163 | |
---|
164 | /*! |
---|
165 | * \def COMPILER |
---|
166 | * \brief The compiler TSPSG was built with. |
---|
167 | */ |
---|
168 | #ifdef Q_CC_INTEL |
---|
169 | # define COMPILER "Intel C++" |
---|
170 | #elif defined(Q_CC_MSVC) |
---|
171 | # define COMPILER "Microsoft Visual C/C++" |
---|
172 | #elif defined(Q_CC_MINGW) |
---|
173 | # define COMPILER "MinGW GCC" |
---|
174 | #elif defined(Q_CC_GNU) |
---|
175 | # define COMPILER "GNU C++" |
---|
176 | #elif defined(Q_CC_GCCE) |
---|
177 | # define COMPILER "GCCE (Symbian GCCE builds)" |
---|
178 | #elif defined(Q_CC_RVCT) |
---|
179 | # define COMPILER "ARM Realview Compiler Suite" |
---|
180 | #elif defined(Q_CC_NOKIAX86) |
---|
181 | # define COMPILER "Nokia x86 (Symbian WINSCW builds)" |
---|
182 | #else |
---|
183 | # define COMPILER "Unknown" |
---|
184 | #endif |
---|
185 | |
---|
186 | #endif // OS_H |
---|