Changeset 41 in tspsg-svn for trunk/src/os.h


Ignore:
Timestamp:
Jul 21, 2009, 10:15:43 AM (15 years ago)
Author:
laleppa
Message:

Expanded from "bitness" to some arch detection.
NOTE: Should work only for GNU C, Visual Studio, Intel C/C++ and MinGW32 compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os.h

    r40 r41  
    2525#define OS_H
    2626
    27 #if defined(__amd64__) || defined(_M_X64) || defined(__ia64__) || defined(_M_IA64)
    28         #define BITS " (64-bit)"
     27// Some target arch detection.
     28// NOTE: Only for GNU C, Visual Studio, Intel C/C++ and MinGW32 compilers
     29#if defined(__amd64__) || defined(_M_X64)
     30        #define ARCH " (AMD 64-bit)"
     31#elif defined(__ia64__) || defined(_M_IA64)
     32        #define ARCH " (Intel 64-bit)"
    2933#elif defined(__i386__) || defined(_M_IX86) || defined(_X86_)
    30         #define BITS " (32-bit)"
     34        #define ARCH " (Intel x86)"
     35#elif defined(__powerpc__) || defined(_M_PPC)
     36        #define ARCH " (PowerPC)"
     37#elif defined(__arm__) || defined(_M_ARM)
     38        #define ARCH " (ARM)"
     39#elif defined(__mips__) || defined(_M_MRX000)
     40        #define ARCH " (MIPS)"
    3141#else
    32         #define BITS ""
    33 #endif // BITS
     42        #define ARCH ""
     43#endif // ARCH
    3444
    3545#ifdef Q_OS_AIX
    36         #define OS "AIX"BITS
     46        #define OS "AIX"ARCH
    3747        #define OSID quint8(1)
    3848#elif defined Q_OS_BSD4
    39         #define OS "BSD 4.4"BITS
     49        #define OS "BSD 4.4"ARCH
    4050        #define OSID quint8(2)
    4151#elif defined Q_OS_BSDI
    42         #define OS "BSD/OS"BITS
     52        #define OS "BSD/OS"ARCH
    4353        #define OSID quint8(3)
    4454#elif defined Q_OS_CYGWIN
    45         #define OS "Cygwin"BITS
     55        #define OS "Cygwin"ARCH
    4656        #define OSID quint8(4)
    4757#elif defined Q_OS_DARWIN
    48         #define OS "Darwin OS"BITS
     58        #define OS "Darwin OS"ARCH
    4959        #define OSID quint8(5)
    5060#elif defined Q_OS_DGUX
    51         #define OS "DG/UX"BITS
     61        #define OS "DG/UX"ARCH
    5262        #define OSID quint8(6)
    5363#elif defined Q_OS_DYNIX
    54         #define OS "DYNIX/ptx"BITS
     64        #define OS "DYNIX/ptx"ARCH
    5565        #define OSID quint8(7)
    5666#elif defined Q_OS_FREEBSD
    57         #define OS "FreeBSD"BITS
     67        #define OS "FreeBSD"ARCH
    5868        #define OSID quint8(8)
    5969#elif defined Q_OS_HPUX
    60         #define OS "HP-UX"BITS
     70        #define OS "HP-UX"ARCH
    6171        #define OSID quint8(9)
    6272#elif defined Q_OS_HURD
    63         #define OS "GNU Hurd"BITS
     73        #define OS "GNU Hurd"ARCH
    6474        #define OSID quint8(10)
    6575#elif defined Q_OS_IRIX
    66         #define OS "SGI Irix"BITS
     76        #define OS "SGI Irix"ARCH
    6777        #define OSID quint8(11)
    6878#elif defined Q_OS_LINUX
    69         #define OS "Linux"BITS
     79        #define OS "Linux"ARCH
    7080        #define OSID quint8(12)
    7181#elif defined Q_OS_LYNX
    72         #define OS "LynxOS"BITS
     82        #define OS "LynxOS"ARCH
    7383        #define OSID quint8(13)
    7484#elif defined Q_OS_MSDOS
    75         #define OS "MS-DOS"BITS
     85        #define OS "MS-DOS"ARCH
    7686        #define OSID quint8(14)
    7787#elif defined Q_OS_NETBSD
    78         #define OS "NetBSD"BITS
     88        #define OS "NetBSD"ARCH
    7989        #define OSID quint8(15)
    8090#elif defined Q_OS_OS2
    81         #define OS "OS/2"BITS
     91        #define OS "OS/2"ARCH
    8292        #define OSID quint8(16)
    8393#elif defined Q_OS_OPENBSD
    84         #define OS "OpenBSD"BITS
     94        #define OS "OpenBSD"ARCH
    8595        #define OSID quint8(17)
    8696#elif defined Q_OS_OS2EMX
    87         #define OS "OS/2"BITS
     97        #define OS "OS/2"ARCH
    8898        #define OSID quint8(18)
    8999#elif defined Q_OS_OSF
    90         #define OS "HP Tru64 UNIX"BITS
     100        #define OS "HP Tru64 UNIX"ARCH
    91101        #define OSID quint8(19)
    92102#elif defined Q_OS_QNX6
    93         #define OS "QNX RTP 6.1"BITS
     103        #define OS "QNX RTP 6.1"ARCH
    94104        #define OSID quint8(20)
    95105#elif defined Q_OS_QNX
    96         #define OS "QNX"BITS
     106        #define OS "QNX"ARCH
    97107        #define OSID quint8(21)
    98108#elif defined Q_OS_RELIANT
    99         #define OS "Reliant UNIX"BITS
     109        #define OS "Reliant UNIX"ARCH
    100110        #define OSID quint8(22)
    101111#elif defined Q_OS_SCO
    102         #define OS "SCO OpenServer 5"BITS
     112        #define OS "SCO OpenServer 5"ARCH
    103113        #define OSID quint8(23)
    104114#elif defined Q_OS_SOLARIS
    105         #define OS "Sun Solaris"BITS
     115        #define OS "Sun Solaris"ARCH
    106116        #define OSID quint8(24)
    107117#elif defined Q_OS_ULTRIX
    108         #define OS "DEC Ultrix"BITS
     118        #define OS "DEC Ultrix"ARCH
    109119        #define OSID quint8(25)
    110120#elif defined Q_OS_UNIX
    111         #define OS "UNIX BSD/SYSV"BITS
     121        #define OS "UNIX BSD/SYSV"ARCH
    112122        #define OSID quint8(26)
    113123#elif defined Q_OS_UNIXWARE
    114         #define OS "UnixWare 7/Open UNIX 8"BITS
     124        #define OS "UnixWare 7/Open UNIX 8"ARCH
    115125        #define OSID quint8(27)
    116126#elif defined Q_OS_WIN32
    117         #define OS "Windows"BITS
     127        #define OS "Windows"ARCH
    118128        #define OSID quint8(28)
    119129#elif defined Q_OS_WINCE
    120         #define OS "Windows CE"
     130        #define OS "Windows CE"ARCH
    121131        #define OSID quint8(29)
    122132#else
    123         #define OS "Unknown"BITS
     133        #define OS "Unknown"ARCH
    124134        #define OSID quint8(255)
    125135#endif // OS
Note: See TracChangeset for help on using the changeset viewer.