[e0fcac5f2c] | 1 | /*! |
---|
| 2 | * \file os.h |
---|
[1757eb594b] | 3 | * \author Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name> |
---|
[993d5af6f6] | 4 | * |
---|
| 5 | * $Id$ |
---|
| 6 | * $URL$ |
---|
| 7 | * |
---|
[e0fcac5f2c] | 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 | * |
---|
[993d5af6f6] | 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 3 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 | |
---|
[b5c9bcb585] | 34 | // Some target arch detection. |
---|
[bc1b8837b6] | 35 | /*! |
---|
| 36 | * \def ARCH |
---|
| 37 | * \brief The target CPU architecture TSPSG was built for. |
---|
[85ad815b0b] | 38 | * \warning NOTE: Only for <b>GNU C</b>, <b>Visual Studio</b>, <b>Intel C/C++</b> and <b>MinGW32</b> compilers. |
---|
[bc1b8837b6] | 39 | */ |
---|
[b5c9bcb585] | 40 | #if defined(__amd64__) || defined(_M_X64) |
---|
| 41 | #define ARCH " (AMD 64-bit)" |
---|
| 42 | #elif defined(__ia64__) || defined(_M_IA64) |
---|
| 43 | #define ARCH " (Intel 64-bit)" |
---|
[b968056ce3] | 44 | #elif defined(__i386__) || defined(_M_IX86) || defined(_X86_) |
---|
[b5c9bcb585] | 45 | #define ARCH " (Intel x86)" |
---|
| 46 | #elif defined(__powerpc__) || defined(_M_PPC) |
---|
| 47 | #define ARCH " (PowerPC)" |
---|
| 48 | #elif defined(__arm__) || defined(_M_ARM) |
---|
| 49 | #define ARCH " (ARM)" |
---|
| 50 | #elif defined(__mips__) || defined(_M_MRX000) |
---|
| 51 | #define ARCH " (MIPS)" |
---|
[690f6939a7] | 52 | #else |
---|
[b5c9bcb585] | 53 | #define ARCH "" |
---|
| 54 | #endif // ARCH |
---|
[690f6939a7] | 55 | |
---|
[85ad815b0b] | 56 | // Target OS detection. Done by Qt, so should work for any compiler. |
---|
[bc1b8837b6] | 57 | /*! |
---|
| 58 | * \def OS |
---|
| 59 | * \brief The target operating system TSPSG was built for. |
---|
| 60 | */ |
---|
| 61 | /*! |
---|
| 62 | * \def OSID |
---|
| 63 | * \brief The target operating system ID. |
---|
| 64 | * |
---|
| 65 | * This value is used in task file metadata. |
---|
| 66 | */ |
---|
[993d5af6f6] | 67 | #ifdef Q_OS_AIX |
---|
[b5c9bcb585] | 68 | #define OS "AIX"ARCH |
---|
[993d5af6f6] | 69 | #define OSID quint8(1) |
---|
| 70 | #elif defined Q_OS_BSD4 |
---|
[b5c9bcb585] | 71 | #define OS "BSD 4.4"ARCH |
---|
[993d5af6f6] | 72 | #define OSID quint8(2) |
---|
| 73 | #elif defined Q_OS_BSDI |
---|
[b5c9bcb585] | 74 | #define OS "BSD/OS"ARCH |
---|
[993d5af6f6] | 75 | #define OSID quint8(3) |
---|
| 76 | #elif defined Q_OS_CYGWIN |
---|
[b5c9bcb585] | 77 | #define OS "Cygwin"ARCH |
---|
[993d5af6f6] | 78 | #define OSID quint8(4) |
---|
| 79 | #elif defined Q_OS_DARWIN |
---|
[b5c9bcb585] | 80 | #define OS "Darwin OS"ARCH |
---|
[993d5af6f6] | 81 | #define OSID quint8(5) |
---|
| 82 | #elif defined Q_OS_DGUX |
---|
[b5c9bcb585] | 83 | #define OS "DG/UX"ARCH |
---|
[993d5af6f6] | 84 | #define OSID quint8(6) |
---|
| 85 | #elif defined Q_OS_DYNIX |
---|
[b5c9bcb585] | 86 | #define OS "DYNIX/ptx"ARCH |
---|
[993d5af6f6] | 87 | #define OSID quint8(7) |
---|
| 88 | #elif defined Q_OS_FREEBSD |
---|
[b5c9bcb585] | 89 | #define OS "FreeBSD"ARCH |
---|
[993d5af6f6] | 90 | #define OSID quint8(8) |
---|
| 91 | #elif defined Q_OS_HPUX |
---|
[b5c9bcb585] | 92 | #define OS "HP-UX"ARCH |
---|
[993d5af6f6] | 93 | #define OSID quint8(9) |
---|
| 94 | #elif defined Q_OS_HURD |
---|
[b5c9bcb585] | 95 | #define OS "GNU Hurd"ARCH |
---|
[993d5af6f6] | 96 | #define OSID quint8(10) |
---|
| 97 | #elif defined Q_OS_IRIX |
---|
[b5c9bcb585] | 98 | #define OS "SGI Irix"ARCH |
---|
[993d5af6f6] | 99 | #define OSID quint8(11) |
---|
| 100 | #elif defined Q_OS_LINUX |
---|
[b5c9bcb585] | 101 | #define OS "Linux"ARCH |
---|
[993d5af6f6] | 102 | #define OSID quint8(12) |
---|
| 103 | #elif defined Q_OS_LYNX |
---|
[b5c9bcb585] | 104 | #define OS "LynxOS"ARCH |
---|
[993d5af6f6] | 105 | #define OSID quint8(13) |
---|
| 106 | #elif defined Q_OS_MSDOS |
---|
[b5c9bcb585] | 107 | #define OS "MS-DOS"ARCH |
---|
[993d5af6f6] | 108 | #define OSID quint8(14) |
---|
| 109 | #elif defined Q_OS_NETBSD |
---|
[b5c9bcb585] | 110 | #define OS "NetBSD"ARCH |
---|
[993d5af6f6] | 111 | #define OSID quint8(15) |
---|
| 112 | #elif defined Q_OS_OS2 |
---|
[b5c9bcb585] | 113 | #define OS "OS/2"ARCH |
---|
[993d5af6f6] | 114 | #define OSID quint8(16) |
---|
| 115 | #elif defined Q_OS_OPENBSD |
---|
[b5c9bcb585] | 116 | #define OS "OpenBSD"ARCH |
---|
[993d5af6f6] | 117 | #define OSID quint8(17) |
---|
| 118 | #elif defined Q_OS_OS2EMX |
---|
[b5c9bcb585] | 119 | #define OS "OS/2"ARCH |
---|
[993d5af6f6] | 120 | #define OSID quint8(18) |
---|
| 121 | #elif defined Q_OS_OSF |
---|
[b5c9bcb585] | 122 | #define OS "HP Tru64 UNIX"ARCH |
---|
[993d5af6f6] | 123 | #define OSID quint8(19) |
---|
| 124 | #elif defined Q_OS_QNX6 |
---|
[b5c9bcb585] | 125 | #define OS "QNX RTP 6.1"ARCH |
---|
[993d5af6f6] | 126 | #define OSID quint8(20) |
---|
| 127 | #elif defined Q_OS_QNX |
---|
[b5c9bcb585] | 128 | #define OS "QNX"ARCH |
---|
[993d5af6f6] | 129 | #define OSID quint8(21) |
---|
| 130 | #elif defined Q_OS_RELIANT |
---|
[b5c9bcb585] | 131 | #define OS "Reliant UNIX"ARCH |
---|
[993d5af6f6] | 132 | #define OSID quint8(22) |
---|
| 133 | #elif defined Q_OS_SCO |
---|
[b5c9bcb585] | 134 | #define OS "SCO OpenServer 5"ARCH |
---|
[993d5af6f6] | 135 | #define OSID quint8(23) |
---|
| 136 | #elif defined Q_OS_SOLARIS |
---|
[b5c9bcb585] | 137 | #define OS "Sun Solaris"ARCH |
---|
[993d5af6f6] | 138 | #define OSID quint8(24) |
---|
| 139 | #elif defined Q_OS_ULTRIX |
---|
[b5c9bcb585] | 140 | #define OS "DEC Ultrix"ARCH |
---|
[993d5af6f6] | 141 | #define OSID quint8(25) |
---|
| 142 | #elif defined Q_OS_UNIX |
---|
[b5c9bcb585] | 143 | #define OS "UNIX BSD/SYSV"ARCH |
---|
[993d5af6f6] | 144 | #define OSID quint8(26) |
---|
| 145 | #elif defined Q_OS_UNIXWARE |
---|
[b5c9bcb585] | 146 | #define OS "UnixWare 7/Open UNIX 8"ARCH |
---|
[993d5af6f6] | 147 | #define OSID quint8(27) |
---|
| 148 | #elif defined Q_OS_WIN32 |
---|
[b5c9bcb585] | 149 | #define OS "Windows"ARCH |
---|
[993d5af6f6] | 150 | #define OSID quint8(28) |
---|
| 151 | #elif defined Q_OS_WINCE |
---|
[b5c9bcb585] | 152 | #define OS "Windows CE"ARCH |
---|
[993d5af6f6] | 153 | #define OSID quint8(29) |
---|
| 154 | #else |
---|
[b5c9bcb585] | 155 | #define OS "Unknown"ARCH |
---|
[993d5af6f6] | 156 | #define OSID quint8(255) |
---|
[690f6939a7] | 157 | #endif // OS |
---|
[993d5af6f6] | 158 | |
---|
| 159 | #endif // OS_H |
---|