spingle/source/arch_def.h

77 lines
2.2 KiB
C

/*
* arch_def.h
* platform specific definitions
* - standalone header
* - doesn't and must not include any other headers
* - shouldn't depend on compiler.h, q_stdinc.h, or
* any other headers
*
* Copyright (C) 2007-2016 O.Sezer <sezero@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef spingle__arch_def_h
#define spingle__arch_def_h
/* core ports */
#define PLATFRM_BSD 0
#define PLATFRM_DREAMCAST 1
#define PLATFRM_LINUX 2
#define PLATFRM_OSX 3
#define PLATFRM_UNIX 4
#define PLATFRM_WINDOWS 5
/* wanted ports */
#define PLATFRM_IRIX 6
#define PLATFRM_SWITCH 7
#define PLATFRM_WII 8
#define PLATFRM_PLAN9 9
#define PLATFORM_IS(x) (PLATFORM == PLATFRM_##x)
#if defined(_WIN32) || defined(_WIN64)
#define PLATFORM PLATFRM_WINDOWS
#elif defined(__APPLE__) && defined(__MACH__)
#define PLATFORM PLATFRM_OSX
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)
#define PLATFORM PLATFRM_BSD
#elif defined(__linux__)
#define PLATFORM PLATFRM_LINUX
#elif defined(_arch_dreamcast)
#define PLATFORM PLATFRM_DREAMCAST
#endif
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if !defined(PLATFORM)
#define PLATFORM PLATFRM_UNIX
#endif
#define PLATFORM_IS_UNIX 1
#endif
#if defined(__GNUC__)
#define PLATFORM_IS_GNUC __GNUC__
#endif
#if !defined(PLATFORM)
#error "Platform not defined. The program will not compile."
#endif
extern char const platform_names[][16];
#endif