[2bbe924ad8] | 1 | /*! |
---|
| 2 | * \file os.h |
---|
[0af510a462] | 3 | * \author Copyright © 2007-2012 Oleksii Serdiuk <contacts[at]oleksii[dot]name> |
---|
[2bbe924ad8] | 4 | * |
---|
[7ba743d983] | 5 | * $Id: $Format:%h %ai %an$ $ |
---|
| 6 | * $URL: http://tspsg.info/ $ |
---|
[2bbe924ad8] | 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 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 | |
---|
| 34 | // Some target arch detection. |
---|
| 35 | /*! |
---|
| 36 | * \def ARCH |
---|
| 37 | * \brief The target CPU architecture TSPSG was built for. |
---|
| 38 | * \warning NOTE: Only for <b>GNU C</b>, <b>Visual Studio</b>, <b>Intel C/C++</b> and <b>MinGW32</b> compilers. |
---|
| 39 | */ |
---|
| 40 | #if defined(__amd64__) || defined(_M_X64) |
---|
[9eb63a1598] | 41 | # define ARCH " (AMD 64-bit)" |
---|
[2bbe924ad8] | 42 | #elif defined(__ia64__) || defined(_M_IA64) |
---|
[9eb63a1598] | 43 | # define ARCH " (Intel 64-bit)" |
---|
[2bbe924ad8] | 44 | #elif defined(__i386__) || defined(_M_IX86) || defined(_X86_) |
---|
[9eb63a1598] | 45 | # define ARCH " (Intel x86)" |
---|
[2bbe924ad8] | 46 | #elif defined(__powerpc__) || defined(_M_PPC) |
---|
[9eb63a1598] | 47 | # define ARCH " (PowerPC)" |
---|
[2bbe924ad8] | 48 | #elif defined(__arm__) || defined(_M_ARM) |
---|
[9eb63a1598] | 49 | # define ARCH " (ARM)" |
---|
[2bbe924ad8] | 50 | #elif defined(__mips__) || defined(_M_MRX000) |
---|
[9eb63a1598] | 51 | # define ARCH " (MIPS)" |
---|
[2bbe924ad8] | 52 | #else |
---|
[9eb63a1598] | 53 | # define ARCH "" |
---|
[2bbe924ad8] | 54 | #endif // ARCH |
---|
| 55 | |
---|
| 56 | // Target OS detection. Done by Qt, so should work for any compiler. |
---|
| 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 | * |
---|
[b2e8e7ec71] | 65 | * This value will be used in task file metadata. |
---|
[2bbe924ad8] | 66 | */ |
---|
| 67 | #ifdef Q_OS_AIX |
---|
[9eb63a1598] | 68 | # define OS "AIX" |
---|
| 69 | # define OSID quint8(1) |
---|
[97e90f9be6] | 70 | #elif defined(Q_OS_BSDI) |
---|
[9eb63a1598] | 71 | # define OS "BSD/OS" |
---|
| 72 | # define OSID quint8(2) |
---|
[97e90f9be6] | 73 | #elif defined(Q_OS_CYGWIN) |
---|
[9eb63a1598] | 74 | # define OS "Cygwin" |
---|
| 75 | # define OSID quint8(3) |
---|
[97e90f9be6] | 76 | #elif defined(Q_OS_DARWIN) |
---|
[9eb63a1598] | 77 | # define OS "Mac OS (Darwin)" |
---|
| 78 | # define OSID quint8(4) |
---|
[97e90f9be6] | 79 | #elif defined(Q_OS_DGUX) |
---|
[9eb63a1598] | 80 | # define OS "DG/UX" |
---|
| 81 | # define OSID quint8(5) |
---|
[97e90f9be6] | 82 | #elif defined(Q_OS_DYNIX) |
---|
[9eb63a1598] | 83 | # define OS "DYNIX/ptx" |
---|
| 84 | # define OSID quint8(6) |
---|
[97e90f9be6] | 85 | #elif defined(Q_OS_FREEBSD) |
---|
[9eb63a1598] | 86 | # define OS "FreeBSD" |
---|
| 87 | # define OSID quint8(7) |
---|
[97e90f9be6] | 88 | #elif defined(Q_OS_HPUX) |
---|
[9eb63a1598] | 89 | # define OS "HP-UX" |
---|
| 90 | # define OSID quint8(8) |
---|
[97e90f9be6] | 91 | #elif defined(Q_OS_HURD) |
---|
[9eb63a1598] | 92 | # define OS "GNU Hurd" |
---|
| 93 | # define OSID quint8(9) |
---|
[97e90f9be6] | 94 | #elif defined(Q_OS_IRIX) |
---|
[9eb63a1598] | 95 | # define OS "SGI Irix" |
---|
| 96 | # define OSID quint8(10) |
---|
[97e90f9be6] | 97 | #elif defined(Q_OS_LINUX) |
---|
[9eb63a1598] | 98 | # define OS "Linux" |
---|
| 99 | # define OSID quint8(11) |
---|
[97e90f9be6] | 100 | #elif defined(Q_OS_LYNX) |
---|
[9eb63a1598] | 101 | # define OS "LynxOS" |
---|
| 102 | # define OSID quint8(12) |
---|
[97e90f9be6] | 103 | #elif defined(Q_OS_NETBSD) |
---|
[9eb63a1598] | 104 | # define OS "NetBSD" |
---|
| 105 | # define OSID quint8(13) |
---|
[97e90f9be6] | 106 | #elif defined(Q_OS_OPENBSD) |
---|
[9eb63a1598] | 107 | # define OS "OpenBSD" |
---|
| 108 | # define OSID quint8(14) |
---|
[97e90f9be6] | 109 | #elif defined(Q_OS_OS2EMX) |
---|
[9eb63a1598] | 110 | # define OS "OS/2" |
---|
| 111 | # define OSID quint8(15) |
---|
[97e90f9be6] | 112 | #elif defined(Q_OS_OSF) |
---|
[9eb63a1598] | 113 | # define OS "HP Tru64 UNIX" |
---|
| 114 | # define OSID quint8(16) |
---|
[97e90f9be6] | 115 | #elif defined(Q_OS_QNX) |
---|
[9eb63a1598] | 116 | # define OS "QNX Neutrino" |
---|
| 117 | # define OSID quint8(17) |
---|
[97e90f9be6] | 118 | #elif defined(Q_OS_RELIANT) |
---|
[9eb63a1598] | 119 | # define OS "Reliant UNIX" |
---|
| 120 | # define OSID quint8(18) |
---|
[97e90f9be6] | 121 | #elif defined(Q_OS_SCO) |
---|
[9eb63a1598] | 122 | # define OS "SCO OpenServer 5" |
---|
| 123 | # define OSID quint8(19) |
---|
[97e90f9be6] | 124 | #elif defined(Q_OS_SOLARIS) |
---|
[9eb63a1598] | 125 | # define OS "Sun Solaris" |
---|
| 126 | # define OSID quint8(20) |
---|
[97e90f9be6] | 127 | #elif defined(Q_OS_SYMBIAN) |
---|
[9eb63a1598] | 128 | # define OS "Symbian" |
---|
| 129 | # define OSID quint8(21) |
---|
[97e90f9be6] | 130 | #elif defined(Q_OS_ULTRIX) |
---|
[9eb63a1598] | 131 | # define OS "DEC Ultrix" |
---|
| 132 | # define OSID quint8(22) |
---|
[97e90f9be6] | 133 | #elif defined(Q_OS_UNIXWARE) |
---|
[9eb63a1598] | 134 | # define OS "UnixWare 7/Open UNIX 8" |
---|
| 135 | # define OSID quint8(23) |
---|
[97e90f9be6] | 136 | #elif defined(Q_OS_WIN32) |
---|
[9eb63a1598] | 137 | # define OS "Windows" |
---|
| 138 | # define OSID quint8(24) |
---|
[97e90f9be6] | 139 | #elif defined(Q_OS_WINCE_WM) |
---|
[9eb63a1598] | 140 | # define OS "Windows Mobile" |
---|
| 141 | # define OSID quint8(25) |
---|
[97e90f9be6] | 142 | #elif defined(Q_OS_WINCE) |
---|
[9eb63a1598] | 143 | # define OS "Windows CE" |
---|
| 144 | # define OSID quint8(26) |
---|
[97e90f9be6] | 145 | #elif defined(Q_OS_BSD4) |
---|
[9eb63a1598] | 146 | # define OS "BSD 4.4" |
---|
| 147 | # define OSID quint8(253) |
---|
[97e90f9be6] | 148 | #elif defined(Q_OS_UNIX) |
---|
[9eb63a1598] | 149 | # define OS "UNIX BSD/SYSV" |
---|
| 150 | # define OSID quint8(254) |
---|
[2bbe924ad8] | 151 | #else |
---|
[9eb63a1598] | 152 | # define OS "Unknown" |
---|
| 153 | # define OSID quint8(255) |
---|
[2bbe924ad8] | 154 | #endif // OS |
---|
| 155 | |
---|
[bbac1ebb13] | 156 | //! The target platform in the form OS ARCH |
---|
| 157 | #define PLATFROM OS ARCH |
---|
| 158 | |
---|
| 159 | /*! |
---|
| 160 | * \def COMPILER |
---|
| 161 | * \brief The compiler TSPSG was built with. |
---|
| 162 | */ |
---|
[97e90f9be6] | 163 | #ifdef Q_CC_INTEL |
---|
[9eb63a1598] | 164 | # define COMPILER "Intel C++" |
---|
[97e90f9be6] | 165 | #elif defined(Q_CC_MSVC) |
---|
[9eb63a1598] | 166 | # define COMPILER "Microsoft Visual C/C++" |
---|
[97e90f9be6] | 167 | #elif defined(Q_CC_MINGW) |
---|
[9eb63a1598] | 168 | # define COMPILER "MinGW GCC" |
---|
[bbac1ebb13] | 169 | #elif defined(Q_CC_GNU) |
---|
[9eb63a1598] | 170 | # define COMPILER "GNU C++" |
---|
[bbac1ebb13] | 171 | #elif defined(Q_CC_GCCE) |
---|
[9eb63a1598] | 172 | # define COMPILER "GCCE (Symbian GCCE builds)" |
---|
[bbac1ebb13] | 173 | #elif defined(Q_CC_RVCT) |
---|
[9eb63a1598] | 174 | # define COMPILER "ARM Realview Compiler Suite" |
---|
[bbac1ebb13] | 175 | #elif defined(Q_CC_NOKIAX86) |
---|
[9eb63a1598] | 176 | # define COMPILER "Nokia x86 (Symbian WINSCW builds)" |
---|
[bbac1ebb13] | 177 | #else |
---|
[9eb63a1598] | 178 | # define COMPILER "Unknown" |
---|
[bbac1ebb13] | 179 | #endif |
---|
| 180 | |
---|
[2bbe924ad8] | 181 | #endif // OS_H |
---|