include/SDL_platform.h
author Jørgen P. Tjernø <jorgen@valvesoftware.com>
Tue, 23 Jul 2013 17:38:59 -0700
changeset 7507 885b4aab4190
parent 7498 bda3639deecc
child 7677 871d43c6968a
child 8477 ad08f0d710f3
permissions -rw-r--r--
Mac: Codify SDK and OS requirements, and clean up.

This #errors if you're using an SDK or deployment target that is less
than 10.6 and 10.5, respectively, and cleans up uses of
MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED according
to those requirements.
slouken@1402
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@1402
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@1402
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@1402
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@1402
    20
*/
slouken@1402
    21
slouken@3407
    22
/**
slouken@3407
    23
 *  \file SDL_platform.h
slouken@7191
    24
 *
slouken@3407
    25
 *  Try to get a standard set of platform defines.
slouken@3407
    26
 */
slouken@1402
    27
slouken@1406
    28
#ifndef _SDL_platform_h
slouken@1406
    29
#define _SDL_platform_h
slouken@1406
    30
slouken@1402
    31
#if defined(_AIX)
slouken@1402
    32
#undef __AIX__
slouken@7191
    33
#define __AIX__     1
slouken@1402
    34
#endif
slouken@1402
    35
#if defined(__BEOS__)
slouken@1402
    36
#undef __BEOS__
slouken@7191
    37
#define __BEOS__    1
slouken@1402
    38
#endif
slouken@3292
    39
#if defined(__HAIKU__)
slouken@3292
    40
#undef __HAIKU__
slouken@7191
    41
#define __HAIKU__   1
slouken@3292
    42
#endif
slouken@1402
    43
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
slouken@1402
    44
#undef __BSDI__
slouken@7191
    45
#define __BSDI__    1
slouken@1402
    46
#endif
slouken@1461
    47
#if defined(_arch_dreamcast)
slouken@1402
    48
#undef __DREAMCAST__
slouken@7191
    49
#define __DREAMCAST__   1
slouken@1402
    50
#endif
slouken@3366
    51
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
slouken@1402
    52
#undef __FREEBSD__
slouken@7191
    53
#define __FREEBSD__ 1
slouken@1402
    54
#endif
slouken@1402
    55
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
slouken@1402
    56
#undef __HPUX__
slouken@7191
    57
#define __HPUX__    1
slouken@1402
    58
#endif
slouken@1402
    59
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
slouken@1402
    60
#undef __IRIX__
slouken@7191
    61
#define __IRIX__    1
slouken@1402
    62
#endif
slouken@1402
    63
#if defined(linux) || defined(__linux) || defined(__linux__)
slouken@1402
    64
#undef __LINUX__
slouken@7191
    65
#define __LINUX__   1
slouken@1402
    66
#endif
paul@4695
    67
#if defined(ANDROID)
paul@4695
    68
#undef __ANDROID__
paul@4696
    69
#undef __LINUX__ /*do we need to do this?*/
paul@4695
    70
#define __ANDROID__ 1
paul@4695
    71
#endif
paul@4695
    72
slouken@1631
    73
#if defined(__APPLE__)
slouken@2765
    74
/* lets us know what version of Mac OS X we're compiling on */
slouken@2765
    75
#include "AvailabilityMacros.h"
slouken@4925
    76
#include "TargetConditionals.h"
slouken@2765
    77
#if TARGET_OS_IPHONE
slouken@2765
    78
/* if compiling for iPhone */
slouken@2765
    79
#undef __IPHONEOS__
slouken@2765
    80
#define __IPHONEOS__ 1
slouken@2765
    81
#undef __MACOSX__
slouken@2765
    82
#else
slouken@2765
    83
/* if not compiling for iPhone */
slouken@1402
    84
#undef __MACOSX__
slouken@7191
    85
#define __MACOSX__  1
jorgen@7507
    86
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
jorgen@7507
    87
# error SDL for Mac OS X only supports deploying on 10.5 and above.
jorgen@7507
    88
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
jorgen@7507
    89
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
jorgen@7507
    90
# error SDL for Mac OS X must be built with a 10.6 SDK or above.
jorgen@7507
    91
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1060 */
slouken@2765
    92
#endif /* TARGET_OS_IPHONE */
slouken@2765
    93
#endif /* defined(__APPLE__) */
slouken@2765
    94
slouken@1402
    95
#if defined(__NetBSD__)
slouken@1402
    96
#undef __NETBSD__
slouken@7191
    97
#define __NETBSD__  1
slouken@1402
    98
#endif
slouken@1402
    99
#if defined(__OpenBSD__)
slouken@1402
   100
#undef __OPENBSD__
slouken@7191
   101
#define __OPENBSD__ 1
slouken@1402
   102
#endif
slouken@1402
   103
#if defined(__OS2__)
slouken@1402
   104
#undef __OS2__
slouken@7191
   105
#define __OS2__     1
slouken@1402
   106
#endif
slouken@1402
   107
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
slouken@1402
   108
#undef __OSF__
slouken@7191
   109
#define __OSF__     1
slouken@1402
   110
#endif
slouken@1402
   111
#if defined(__QNXNTO__)
slouken@1402
   112
#undef __QNXNTO__
slouken@7191
   113
#define __QNXNTO__  1
slouken@1402
   114
#endif
slouken@1402
   115
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
slouken@1402
   116
#undef __RISCOS__
slouken@7191
   117
#define __RISCOS__  1
slouken@1402
   118
#endif
slouken@1631
   119
#if defined(__SVR4)
slouken@1402
   120
#undef __SOLARIS__
slouken@7191
   121
#define __SOLARIS__ 1
slouken@1402
   122
#endif
slouken@7498
   123
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
slouken@5086
   124
#undef __WIN32__
slouken@7191
   125
#define __WIN32__   1
slouken@1402
   126
#endif
kimonline@7009
   127
#if defined(__PSP__)
slouken@7012
   128
#undef __PSP__
slouken@7191
   129
#define __PSP__ 1
kimonline@7009
   130
#endif
slouken@3319
   131
slouken@3319
   132
#include "begin_code.h"
slouken@3319
   133
/* Set up for C function definitions, even when using C++ */
slouken@3319
   134
#ifdef __cplusplus
slouken@3319
   135
extern "C" {
slouken@3319
   136
#endif
slouken@3319
   137
slouken@3319
   138
/**
slouken@3407
   139
 *  \brief Gets the name of the platform.
slouken@3319
   140
 */
slouken@3319
   141
extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
slouken@3319
   142
slouken@3319
   143
/* Ends C function definitions when using C++ */
slouken@3319
   144
#ifdef __cplusplus
slouken@3319
   145
}
slouken@3319
   146
#endif
slouken@3319
   147
#include "close_code.h"
slouken@3319
   148
slouken@1406
   149
#endif /* _SDL_platform_h */
slouken@3319
   150
slouken@3319
   151
/* vi: set ts=4 sw=4 expandtab: */