[2bbe924ad8] | 1 | /*! |
---|
| 2 | * \file os.h |
---|
[21c03af787] | 3 | * \author Copyright © 2007-2013 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 | |
---|
[87b8a22768] | 34 | #include <QtGlobal> |
---|
| 35 | |
---|
[2bbe924ad8] | 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) |
---|
[9eb63a1598] | 43 | # define ARCH " (AMD 64-bit)" |
---|
[2bbe924ad8] | 44 | #elif defined(__ia64__) || defined(_M_IA64) |
---|
[9eb63a1598] | 45 | # define ARCH " (Intel 64-bit)" |
---|
[2bbe924ad8] | 46 | #elif defined(__i386__) || defined(_M_IX86) || defined(_X86_) |
---|
[9eb63a1598] | 47 | # define ARCH " (Intel x86)" |
---|
[2bbe924ad8] | 48 | #elif defined(__powerpc__) || defined(_M_PPC) |
---|
[9eb63a1598] | 49 | # define ARCH " (PowerPC)" |
---|
[2bbe924ad8] | 50 | #elif defined(__arm__) || defined(_M_ARM) |
---|
[9eb63a1598] | 51 | # define ARCH " (ARM)" |
---|
[2bbe924ad8] | 52 | #elif defined(__mips__) || defined(_M_MRX000) |
---|
[9eb63a1598] | 53 | # define ARCH " (MIPS)" |
---|
[2bbe924ad8] | 54 | #else |
---|
[9eb63a1598] | 55 | # define ARCH "" |
---|
[2bbe924ad8] | 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 | * |
---|
[b2e8e7ec71] | 67 | * This value will be used in task file metadata. |
---|
[2bbe924ad8] | 68 | */ |
---|
| 69 | #ifdef Q_OS_AIX |
---|
[9eb63a1598] | 70 | # define OS "AIX" |
---|
| 71 | # define OSID quint8(1) |
---|
[97e90f9be6] | 72 | #elif defined(Q_OS_BSDI) |
---|
[9eb63a1598] | 73 | # define OS "BSD/OS" |
---|
| 74 | # define OSID quint8(2) |
---|
[97e90f9be6] | 75 | #elif defined(Q_OS_CYGWIN) |
---|
[9eb63a1598] | 76 | # define OS "Cygwin" |
---|
| 77 | # define OSID quint8(3) |
---|
[97e90f9be6] | 78 | #elif defined(Q_OS_DARWIN) |
---|
[9eb63a1598] | 79 | # define OS "Mac OS (Darwin)" |
---|
| 80 | # define OSID quint8(4) |
---|
[97e90f9be6] | 81 | #elif defined(Q_OS_DGUX) |
---|
[9eb63a1598] | 82 | # define OS "DG/UX" |
---|
| 83 | # define OSID quint8(5) |
---|
[97e90f9be6] | 84 | #elif defined(Q_OS_DYNIX) |
---|
[9eb63a1598] | 85 | # define OS "DYNIX/ptx" |
---|
| 86 | # define OSID quint8(6) |
---|
[97e90f9be6] | 87 | #elif defined(Q_OS_FREEBSD) |
---|
[9eb63a1598] | 88 | # define OS "FreeBSD" |
---|
| 89 | # define OSID quint8(7) |
---|
[97e90f9be6] | 90 | #elif defined(Q_OS_HPUX) |
---|
[9eb63a1598] | 91 | # define OS "HP-UX" |
---|
| 92 | # define OSID quint8(8) |
---|
[97e90f9be6] | 93 | #elif defined(Q_OS_HURD) |
---|
[9eb63a1598] | 94 | # define OS "GNU Hurd" |
---|
| 95 | # define OSID quint8(9) |
---|
[97e90f9be6] | 96 | #elif defined(Q_OS_IRIX) |
---|
[9eb63a1598] | 97 | # define OS "SGI Irix" |
---|
| 98 | # define OSID quint8(10) |
---|
[97e90f9be6] | 99 | #elif defined(Q_OS_LINUX) |
---|
[9eb63a1598] | 100 | # define OS "Linux" |
---|
| 101 | # define OSID quint8(11) |
---|
[97e90f9be6] | 102 | #elif defined(Q_OS_LYNX) |
---|
[9eb63a1598] | 103 | # define OS "LynxOS" |
---|
| 104 | # define OSID quint8(12) |
---|
[97e90f9be6] | 105 | #elif defined(Q_OS_NETBSD) |
---|
[9eb63a1598] | 106 | # define OS "NetBSD" |
---|
| 107 | # define OSID quint8(13) |
---|
[97e90f9be6] | 108 | #elif defined(Q_OS_OPENBSD) |
---|
[9eb63a1598] | 109 | # define OS "OpenBSD" |
---|
| 110 | # define OSID quint8(14) |
---|
[97e90f9be6] | 111 | #elif defined(Q_OS_OS2EMX) |
---|
[9eb63a1598] | 112 | # define OS "OS/2" |
---|
| 113 | # define OSID quint8(15) |
---|
[97e90f9be6] | 114 | #elif defined(Q_OS_OSF) |
---|
[9eb63a1598] | 115 | # define OS "HP Tru64 UNIX" |
---|
| 116 | # define OSID quint8(16) |
---|
[97e90f9be6] | 117 | #elif defined(Q_OS_QNX) |
---|
[9eb63a1598] | 118 | # define OS "QNX Neutrino" |
---|
| 119 | # define OSID quint8(17) |
---|
[97e90f9be6] | 120 | #elif defined(Q_OS_RELIANT) |
---|
[9eb63a1598] | 121 | # define OS "Reliant UNIX" |
---|
| 122 | # define OSID quint8(18) |
---|
[97e90f9be6] | 123 | #elif defined(Q_OS_SCO) |
---|
[9eb63a1598] | 124 | # define OS "SCO OpenServer 5" |
---|
| 125 | # define OSID quint8(19) |
---|
[97e90f9be6] | 126 | #elif defined(Q_OS_SOLARIS) |
---|
[9eb63a1598] | 127 | # define OS "Sun Solaris" |
---|
| 128 | # define OSID quint8(20) |
---|
[97e90f9be6] | 129 | #elif defined(Q_OS_SYMBIAN) |
---|
[9eb63a1598] | 130 | # define OS "Symbian" |
---|
| 131 | # define OSID quint8(21) |
---|
[97e90f9be6] | 132 | #elif defined(Q_OS_ULTRIX) |
---|
[9eb63a1598] | 133 | # define OS "DEC Ultrix" |
---|
| 134 | # define OSID quint8(22) |
---|
[97e90f9be6] | 135 | #elif defined(Q_OS_UNIXWARE) |
---|
[9eb63a1598] | 136 | # define OS "UnixWare 7/Open UNIX 8" |
---|
| 137 | # define OSID quint8(23) |
---|
[97e90f9be6] | 138 | #elif defined(Q_OS_WIN32) |
---|
[9eb63a1598] | 139 | # define OS "Windows" |
---|
| 140 | # define OSID quint8(24) |
---|
[97e90f9be6] | 141 | #elif defined(Q_OS_WINCE_WM) |
---|
[9eb63a1598] | 142 | # define OS "Windows Mobile" |
---|
| 143 | # define OSID quint8(25) |
---|
[97e90f9be6] | 144 | #elif defined(Q_OS_WINCE) |
---|
[9eb63a1598] | 145 | # define OS "Windows CE" |
---|
| 146 | # define OSID quint8(26) |
---|
[97e90f9be6] | 147 | #elif defined(Q_OS_BSD4) |
---|
[9eb63a1598] | 148 | # define OS "BSD 4.4" |
---|
| 149 | # define OSID quint8(253) |
---|
[97e90f9be6] | 150 | #elif defined(Q_OS_UNIX) |
---|
[9eb63a1598] | 151 | # define OS "UNIX BSD/SYSV" |
---|
| 152 | # define OSID quint8(254) |
---|
[2bbe924ad8] | 153 | #else |
---|
[9eb63a1598] | 154 | # define OS "Unknown" |
---|
| 155 | # define OSID quint8(255) |
---|
[2bbe924ad8] | 156 | #endif // OS |
---|
| 157 | |
---|
[bbac1ebb13] | 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 | */ |
---|
[97e90f9be6] | 165 | #ifdef Q_CC_INTEL |
---|
[9eb63a1598] | 166 | # define COMPILER "Intel C++" |
---|
[97e90f9be6] | 167 | #elif defined(Q_CC_MSVC) |
---|
[9eb63a1598] | 168 | # define COMPILER "Microsoft Visual C/C++" |
---|
[97e90f9be6] | 169 | #elif defined(Q_CC_MINGW) |
---|
[9eb63a1598] | 170 | # define COMPILER "MinGW GCC" |
---|
[bbac1ebb13] | 171 | #elif defined(Q_CC_GNU) |
---|
[9eb63a1598] | 172 | # define COMPILER "GNU C++" |
---|
[bbac1ebb13] | 173 | #elif defined(Q_CC_GCCE) |
---|
[9eb63a1598] | 174 | # define COMPILER "GCCE (Symbian GCCE builds)" |
---|
[bbac1ebb13] | 175 | #elif defined(Q_CC_RVCT) |
---|
[9eb63a1598] | 176 | # define COMPILER "ARM Realview Compiler Suite" |
---|
[bbac1ebb13] | 177 | #elif defined(Q_CC_NOKIAX86) |
---|
[9eb63a1598] | 178 | # define COMPILER "Nokia x86 (Symbian WINSCW builds)" |
---|
[bbac1ebb13] | 179 | #else |
---|
[9eb63a1598] | 180 | # define COMPILER "Unknown" |
---|
[bbac1ebb13] | 181 | #endif |
---|
| 182 | |
---|
[2bbe924ad8] | 183 | #endif // OS_H |
---|