1 | /*! |
---|
2 | * \file os.h |
---|
3 | * \author Copyright © 2007-2013 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_QNX) |
---|
118 | # define OS "QNX Neutrino" |
---|
119 | # define OSID quint8(17) |
---|
120 | #elif defined(Q_OS_RELIANT) |
---|
121 | # define OS "Reliant UNIX" |
---|
122 | # define OSID quint8(18) |
---|
123 | #elif defined(Q_OS_SCO) |
---|
124 | # define OS "SCO OpenServer 5" |
---|
125 | # define OSID quint8(19) |
---|
126 | #elif defined(Q_OS_SOLARIS) |
---|
127 | # define OS "Sun Solaris" |
---|
128 | # define OSID quint8(20) |
---|
129 | #elif defined(Q_OS_SYMBIAN) |
---|
130 | # define OS "Symbian" |
---|
131 | # define OSID quint8(21) |
---|
132 | #elif defined(Q_OS_ULTRIX) |
---|
133 | # define OS "DEC Ultrix" |
---|
134 | # define OSID quint8(22) |
---|
135 | #elif defined(Q_OS_UNIXWARE) |
---|
136 | # define OS "UnixWare 7/Open UNIX 8" |
---|
137 | # define OSID quint8(23) |
---|
138 | #elif defined(Q_OS_WIN32) |
---|
139 | # define OS "Windows" |
---|
140 | # define OSID quint8(24) |
---|
141 | #elif defined(Q_OS_WINCE_WM) |
---|
142 | # define OS "Windows Mobile" |
---|
143 | # define OSID quint8(25) |
---|
144 | #elif defined(Q_OS_WINCE) |
---|
145 | # define OS "Windows CE" |
---|
146 | # define OSID quint8(26) |
---|
147 | #elif defined(Q_OS_BSD4) |
---|
148 | # define OS "BSD 4.4" |
---|
149 | # define OSID quint8(253) |
---|
150 | #elif defined(Q_OS_UNIX) |
---|
151 | # define OS "UNIX BSD/SYSV" |
---|
152 | # define OSID quint8(254) |
---|
153 | #else |
---|
154 | # define OS "Unknown" |
---|
155 | # define OSID quint8(255) |
---|
156 | #endif // OS |
---|
157 | |
---|
158 | //! The target platform in the form OS ARCH |
---|
159 | #define PLATFROM OS ARCH |
---|
160 | |
---|
161 | /*! |
---|
162 | * \def COMPILER |
---|
163 | * \brief The compiler TSPSG was built with. |
---|
164 | */ |
---|
165 | #ifdef Q_CC_INTEL |
---|
166 | # define COMPILER "Intel C++" |
---|
167 | #elif defined(Q_CC_MSVC) |
---|
168 | # define COMPILER "Microsoft Visual C/C++" |
---|
169 | #elif defined(Q_CC_MINGW) |
---|
170 | # define COMPILER "MinGW GCC" |
---|
171 | #elif defined(Q_CC_GNU) |
---|
172 | # define COMPILER "GNU C++" |
---|
173 | #elif defined(Q_CC_GCCE) |
---|
174 | # define COMPILER "GCCE (Symbian GCCE builds)" |
---|
175 | #elif defined(Q_CC_RVCT) |
---|
176 | # define COMPILER "ARM Realview Compiler Suite" |
---|
177 | #elif defined(Q_CC_NOKIAX86) |
---|
178 | # define COMPILER "Nokia x86 (Symbian WINSCW builds)" |
---|
179 | #else |
---|
180 | # define COMPILER "Unknown" |
---|
181 | #endif |
---|
182 | |
---|
183 | #endif // OS_H |
---|