Browse Source

engine: use build.h for printing architecture and operating system, also implement architecture names from library naming scheme proposal (#39)

pull/2/head
Alibek Omarov 6 years ago
parent
commit
76a8fe4873
  1. 59
      engine/common/build.c
  2. 1
      public/crtlib.h

59
engine/common/build.c

@ -63,23 +63,23 @@ const char *Q_buildos( void )
{ {
const char *osname; const char *osname;
#if defined(_WIN32) && defined(_MSC_VER) #if XASH_MINGW
osname = "Win32";
#elif defined(_WIN32) && defined(__MINGW32__)
osname = "Win32-MinGW"; osname = "Win32-MinGW";
#elif defined(__ANDROID__) #elif XASH_WIN32
osname = "Win32";
#elif XASH_ANDROID
osname = "Android"; osname = "Android";
#elif defined(__linux__) #elif XASH_LINUX
osname = "Linux"; osname = "Linux";
#elif defined(__APPLE__) #elif XASH_APPLE
osname = "Apple"; osname = "Apple";
#elif defined(__FreeBSD__) #elif XASH_FREEBSD
osname = "FreeBSD"; osname = "FreeBSD";
#elif defined(__NetBSD__) #elif XASH_NETBSD
osname = "NetBSD"; osname = "NetBSD";
#elif defined(__OpenBSD__) #elif XASH_OPENBSD
osname = "OpenBSD"; osname = "OpenBSD";
#elif defined __EMSCRIPTEN__ #elif XASH_EMSCRIPTEN
osname = "Emscripten"; osname = "Emscripten";
#else #else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug" #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
@ -99,20 +99,37 @@ const char *Q_buildarch( void )
{ {
const char *archname; const char *archname;
#if defined( __x86_64__) || defined(_M_X64) #if XASH_AMD64
archname = "amd64"; archname = "amd64";
#elif defined(__i386__) || defined(_X86_) || defined(_M_IX86) #elif XASH_X86
archname = "i386"; archname = "i386";
#elif defined __aarch64__ #elif XASH_AARCH64
archname = "aarch64"; archname = "arm64";
#elif defined __arm__ || defined _M_ARM #elif XASH_ARM
archname = "arm"; archname = "armv"
#elif defined __mips__ #if XASH_ARM == 7
"7"
#elif XASH_ARM == 6
"6"
#elif XASH_ARM == 5
"5"
#elif XASH_ARM == 4
"4"
#endif
#if XASH_ARM_HARDFP
"hf"
#else
"l";
#endif
#elif XASH_MIPS && XASH_BIG_ENDIAN
archname = "mips"; archname = "mips";
#elif defined __EMSCRIPTEN__ #elif XASH_MIPS && XASH_LITTLE_ENDIAN
archname = "mipsel";
#elif XASH_JS
archname = "javascript"; archname = "javascript";
#elif defined __e2k__ #elif XASH_E2K
archname = "elbrus"; archname = "e2k";
#else #else
#error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug" #error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug"
#endif #endif
@ -128,7 +145,7 @@ Returns a short hash of current commit in VCS as string.
XASH_BUILD_COMMIT must be passed in quotes XASH_BUILD_COMMIT must be passed in quotes
if XASH_BUILD_COMMIT is not defined, if XASH_BUILD_COMMIT is not defined,
Q_buildcommit will identify this build as release or "notset" Q_buildcommit will identify this build as "notset"
============= =============
*/ */
const char *Q_buildcommit( void ) const char *Q_buildcommit( void )

1
public/crtlib.h

@ -17,6 +17,7 @@ GNU General Public License for more details.
#define STDLIB_H #define STDLIB_H
#include <stdarg.h> #include <stdarg.h>
#include "build.h"
#ifdef __GNUC__ #ifdef __GNUC__
#define _format(x) __attribute__((format(printf, x, x+1))) #define _format(x) __attribute__((format(printf, x, x+1)))

Loading…
Cancel
Save