diff --git a/CMakeLists.txt b/CMakeLists.txt index fc20ac7f63..2398dda084 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,6 +158,10 @@ if (APPLE) set(SharedDefines "MACOS_X") endif() +if (NOT WIN32 AND NOT APPLE) + set(SharedDefines "ARCH_STRING=\"${Architecture}\"") +endif() + # Compiler settings if(MSVC) diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h index b44790ab4d..fb1d83e296 100644 --- a/code/qcommon/q_platform.h +++ b/code/qcommon/q_platform.h @@ -131,36 +131,12 @@ along with this program; if not, see . #define PATH_SEP '/' + #if !defined(ARCH_STRING) + #error ARCH_STRING should be defined by the build system + #endif - #if defined(__i386__) - #define ARCH_STRING "i386" - #elif defined(__x86_64__) + #if defined(__x86_64__) #define idx64 - #define ARCH_STRING "x86_64" - #elif defined(__powerpc64__) - #define ARCH_STRING "ppc64" - #elif defined(__powerpc__) - #define ARCH_STRING "ppc" - #elif defined(__s390__) - #define ARCH_STRING "s390" - #elif defined(__s390x__) - #define ARCH_STRING "s390x" - #elif defined(__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" #endif #if __FLOAT_WORD_ORDER == __BIG_ENDIAN @@ -191,16 +167,15 @@ along with this program; if not, see . #define QINLINE inline #define PATH_SEP '/' - - #if defined(__i386__) - #define ARCH_STRING "i386" - #elif defined(__amd64__) + + #if !defined(ARCH_STRING) + #error ARCH_STRING should be defined by the build system + #endif + + #if defined(__amd64__) #define idx64 - #define ARCH_STRING "amd64" - #elif defined(__axp__) - #define ARCH_STRING "alpha" #endif - + #if BYTE_ORDER == BIG_ENDIAN #define Q3_BIG_ENDIAN #else diff --git a/codemp/qcommon/q_platform.h b/codemp/qcommon/q_platform.h index 863a2a6e5a..93632340be 100644 --- a/codemp/qcommon/q_platform.h +++ b/codemp/qcommon/q_platform.h @@ -131,36 +131,12 @@ along with this program; if not, see . #define PATH_SEP '/' + #if !defined(ARCH_STRING) + #error ARCH_STRING should be defined by the build system + #endif - #if defined(__i386__) - #define ARCH_STRING "i386" - #elif defined(__x86_64__) + #if defined(__x86_64__) #define idx64 - #define ARCH_STRING "x86_64" - #elif defined(__powerpc64__) - #define ARCH_STRING "ppc64" - #elif defined(__powerpc__) - #define ARCH_STRING "ppc" - #elif defined(__s390__) - #define ARCH_STRING "s390" - #elif defined(__s390x__) - #define ARCH_STRING "s390x" - #elif defined(__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" #endif #if __FLOAT_WORD_ORDER == __BIG_ENDIAN @@ -192,13 +168,12 @@ along with this program; if not, see . #define QINLINE inline #define PATH_SEP '/' - #if defined(__i386__) - #define ARCH_STRING "i386" - #elif defined(__amd64__) + #if !defined(ARCH_STRING) + #error ARCH_STRING should be defined by the build system + #endif + + #if defined(__amd64__) #define idx64 - #define ARCH_STRING "amd64" - #elif defined(__axp__) - #define ARCH_STRING "alpha" #endif #if BYTE_ORDER == BIG_ENDIAN