From 1041cc529cadb22895a066f434f1269931b89e1a Mon Sep 17 00:00:00 2001 From: tma Date: Sat, 5 Nov 2005 00:29:40 +0000 Subject: * Centralise architecture defines in q_platform.h git-svn-id: svn://svn.icculus.org/quake3/trunk@273 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/qcommon/common.c | 4 +- code/qcommon/q_platform.h | 104 +++++++++++++++++++++++++++++----------------- 2 files changed, 67 insertions(+), 41 deletions(-) (limited to 'code/qcommon') diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 2386098..fac8cba 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2348,7 +2348,7 @@ Com_Init void Com_Init( char *commandLine ) { char *s; - Com_Printf( "%s %s %s\n", Q3_VERSION, CPUSTRING, __DATE__ ); + Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ ); if ( setjmp (abortframe) ) { Sys_Error ("Error during initialization"); @@ -2455,7 +2455,7 @@ void Com_Init( char *commandLine ) { Cmd_AddCommand ("changeVectors", MSG_ReportChangeVectors_f ); Cmd_AddCommand ("writeconfig", Com_WriteConfig_f ); - s = va("%s %s %s", Q3_VERSION, CPUSTRING, __DATE__ ); + s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ ); com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO ); Sys_Init(); diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h index cf8a031..3339394 100644 --- a/code/qcommon/q_platform.h +++ b/code/qcommon/q_platform.h @@ -71,33 +71,31 @@ float FloatSwap (const float *f); #undef QDECL #define QDECL __cdecl -// buildstring will be incorporated into the version string #ifdef _MSC_VER -#ifdef NDEBUG +#define OS_STRING "win_msvc" + #ifdef _M_IX86 -#define CPUSTRING "win-x86" +#define ARCH_STRING "x86" #elif defined _M_ALPHA -#define CPUSTRING "win-AXP" -#endif +#define ARCH_STRING "AXP" #else -#ifdef _M_IX86 -#define CPUSTRING "win-x86-debug" -#elif defined _M_ALPHA -#define CPUSTRING "win-AXP-debug" -#endif +#error "Unsupported architecture" #endif + #elif defined __MINGW32__ -#ifdef NDEBUG +#define OS_STRING "win_mingw" + #ifdef __i386__ -#define CPUSTRING "mingw-x86" -#endif +#define ARCH_STRING "x86" #else -#ifdef __i386__ -#define CPUSTRING "mingw-x86-debug" -#endif +#error "Unsupported architecture" #endif + +#else +#error "Unsupported compiler" #endif + #define ID_INLINE __inline static ID_INLINE short BigShort( short l) { return ShortSwap(l); } @@ -120,12 +118,14 @@ static ID_INLINE float BigFloat(const float l) { return FloatSwap(&l); } #define stricmp strcasecmp #define ID_INLINE inline +#define OS_STRING "macosx" + #ifdef __ppc__ -#define CPUSTRING "MacOSX-ppc" +#define ARCH_STRING "ppc" #elif defined __i386__ -#define CPUSTRING "MacOSX-i386" +#define ARCH_STRING "i386" #else -#define CPUSTRING "MacOSX-other" +#error "Unsupported architecture" #endif #define PATH_SEP '/' @@ -174,7 +174,8 @@ static ID_INLINE float LittleFloat(const float l) { return FloatSwap(&l); } #include #define ID_INLINE inline -#define CPUSTRING "MacOS-PPC" +#define OS_STRING "macos" +#define ARCH_STRING "ppc" #define PATH_SEP ':' @@ -200,24 +201,38 @@ static ID_INLINE float LittleFloat(const float l) { return FloatSwap(&l); } #define ID_INLINE inline -#ifdef __i386__ -#define CPUSTRING "linux-i386" -#elif defined __axp__ -#define CPUSTRING "linux-alpha" +#define OS_STRING "linux" + +#if defined __i386__ +#define ARCH_STRING "i386" #elif defined __x86_64__ -#define CPUSTRING "linux-x86_64" +#define ARCH_STRING "x86_64" #elif defined __powerpc64__ -#define CPUSTRING "linux-ppc64" +#define ARCH_STRING "ppc64" #elif defined __powerpc__ -#define CPUSTRING "linux-ppc" +#define ARCH_STRING "ppc" #elif defined __s390__ -#define CPUSTRING "linux-s390" +#define ARCH_STRING "s390" #elif defined __s390x__ -#define CPUSTRING "linux-s390x" +#define ARCH_STRING "s390x" #elif defined __ia64__ -#define CPUSTRING "linux-ia64" +#define ARCH_STRING "ia64" +#elif defined __alpha__ +#define ARCH_STRING "alpha" +#elif defined __sparc__ +#define ARCH_STRING "sparc" +#elif defined __arm__ +#define ARCH_STRING "arm" +#elif defined __cris__ +#define ARCH_STRING "cris" +#elif defined __hppa__ +#define ARCH_STRING "hppa" +#elif defined __mips__ +#define ARCH_STRING "mips" +#elif defined __sh__ +#define ARCH_STRING "sh" #else -#define CPUSTRING "linux-other" +#error "Unsupported architecture" #endif #define PATH_SEP '/' @@ -248,12 +263,14 @@ ID_INLINE static float LittleFloat(const float l) { return FloatSwap(&l); } #define ID_INLINE inline +#define OS_STRING "freebsd" + #ifdef __i386__ -#define CPUSTRING "freebsd-i386" +#define ARCH_STRING "i386" #elif defined __axp__ -#define CPUSTRING "freebsd-alpha" +#define ARCH_STRING "alpha" #else -#define CPUSTRING "freebsd-other" +#error "Unsupported architecture" #endif #define PATH_SEP '/' @@ -288,10 +305,12 @@ static float LittleFloat(const float l) { return FloatSwap(&l); } #define ID_INLINE inline +#define OS_STRING "solaris" + #ifdef __i386__ -#define CPUSTRING "Solaris-i386" +#define ARCH_STRING "i386" #elif defined __sparc -#define CPUSTRING "Solaris-sparc" +#define ARCH_STRING "sparc" #endif #define PATH_SEP '/' @@ -324,7 +343,8 @@ ID_INLINE static float BigFloat(const float l) { return FloatSwap(&l); } #define ID_INLINE -#define CPUSTRING "q3vm" +#define OS_STRING "q3vm" +#define ARCH_STRING "bytecode" #define PATH_SEP '/' @@ -340,8 +360,8 @@ ID_INLINE static float BigFloat(const float l) { return FloatSwap(&l); } //=========================================================================== //catch missing defines in above blocks -#ifndef CPUSTRING -#error "CPUSTRING not defined" +#if !defined( OS_STRING ) || !defined( ARCH_STRING ) +#error "OS_STRING or ARCH_STRING not defined" #endif #ifndef ID_INLINE @@ -356,6 +376,12 @@ ID_INLINE static float BigFloat(const float l) { return FloatSwap(&l); } #error "Endianness not defined" #endif +#ifdef NDEBUG +#define PLATFORM_STRING OS_STRING "-" ARCH_STRING +#else +#define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug" +#endif + #endif #endif -- cgit v1.2.3