diff options
Diffstat (limited to 'contrib/SDL-3.2.8/include/SDL3/SDL_platform_defines.h')
| -rw-r--r-- | contrib/SDL-3.2.8/include/SDL3/SDL_platform_defines.h | 476 |
1 files changed, 476 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/include/SDL3/SDL_platform_defines.h b/contrib/SDL-3.2.8/include/SDL3/SDL_platform_defines.h new file mode 100644 index 0000000..6b240a8 --- /dev/null +++ b/contrib/SDL-3.2.8/include/SDL3/SDL_platform_defines.h | |||
| @@ -0,0 +1,476 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* WIKI CATEGORY: Platform */ | ||
| 23 | |||
| 24 | /* | ||
| 25 | * SDL_platform_defines.h tries to get a standard set of platform defines. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef SDL_platform_defines_h_ | ||
| 29 | #define SDL_platform_defines_h_ | ||
| 30 | |||
| 31 | #ifdef _AIX | ||
| 32 | |||
| 33 | /** | ||
| 34 | * A preprocessor macro that is only defined if compiling for AIX. | ||
| 35 | * | ||
| 36 | * \since This macro is available since SDL 3.2.0. | ||
| 37 | */ | ||
| 38 | #define SDL_PLATFORM_AIX 1 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #ifdef __HAIKU__ | ||
| 42 | |||
| 43 | /** | ||
| 44 | * A preprocessor macro that is only defined if compiling for Haiku OS. | ||
| 45 | * | ||
| 46 | * \since This macro is available since SDL 3.2.0. | ||
| 47 | */ | ||
| 48 | #define SDL_PLATFORM_HAIKU 1 | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) | ||
| 52 | |||
| 53 | /** | ||
| 54 | * A preprocessor macro that is only defined if compiling for BSDi | ||
| 55 | * | ||
| 56 | * \since This macro is available since SDL 3.2.0. | ||
| 57 | */ | ||
| 58 | #define SDL_PLATFORM_BSDI 1 | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) | ||
| 62 | |||
| 63 | /** | ||
| 64 | * A preprocessor macro that is only defined if compiling for FreeBSD. | ||
| 65 | * | ||
| 66 | * \since This macro is available since SDL 3.2.0. | ||
| 67 | */ | ||
| 68 | #define SDL_PLATFORM_FREEBSD 1 | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #if defined(hpux) || defined(__hpux) || defined(__hpux__) | ||
| 72 | |||
| 73 | /** | ||
| 74 | * A preprocessor macro that is only defined if compiling for HP-UX. | ||
| 75 | * | ||
| 76 | * \since This macro is available since SDL 3.2.0. | ||
| 77 | */ | ||
| 78 | #define SDL_PLATFORM_HPUX 1 | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) | ||
| 82 | |||
| 83 | /** | ||
| 84 | * A preprocessor macro that is only defined if compiling for IRIX. | ||
| 85 | * | ||
| 86 | * \since This macro is available since SDL 3.2.0. | ||
| 87 | */ | ||
| 88 | #define SDL_PLATFORM_IRIX 1 | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #if (defined(linux) || defined(__linux) || defined(__linux__)) | ||
| 92 | |||
| 93 | /** | ||
| 94 | * A preprocessor macro that is only defined if compiling for Linux. | ||
| 95 | * | ||
| 96 | * Note that Android, although ostensibly a Linux-based system, will not | ||
| 97 | * define this. It defines SDL_PLATFORM_ANDROID instead. | ||
| 98 | * | ||
| 99 | * \since This macro is available since SDL 3.2.0. | ||
| 100 | */ | ||
| 101 | #define SDL_PLATFORM_LINUX 1 | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #if defined(ANDROID) || defined(__ANDROID__) | ||
| 105 | |||
| 106 | /** | ||
| 107 | * A preprocessor macro that is only defined if compiling for Android. | ||
| 108 | * | ||
| 109 | * \since This macro is available since SDL 3.2.0. | ||
| 110 | */ | ||
| 111 | #define SDL_PLATFORM_ANDROID 1 | ||
| 112 | #undef SDL_PLATFORM_LINUX | ||
| 113 | #endif | ||
| 114 | |||
| 115 | #if defined(__unix__) || defined(__unix) || defined(unix) | ||
| 116 | |||
| 117 | /** | ||
| 118 | * A preprocessor macro that is only defined if compiling for a Unix-like | ||
| 119 | * system. | ||
| 120 | * | ||
| 121 | * Other platforms, like Linux, might define this in addition to their primary | ||
| 122 | * define. | ||
| 123 | * | ||
| 124 | * \since This macro is available since SDL 3.2.0. | ||
| 125 | */ | ||
| 126 | #define SDL_PLATFORM_UNIX 1 | ||
| 127 | #endif | ||
| 128 | |||
| 129 | #ifdef __APPLE__ | ||
| 130 | |||
| 131 | /** | ||
| 132 | * A preprocessor macro that is only defined if compiling for Apple platforms. | ||
| 133 | * | ||
| 134 | * iOS, macOS, etc will additionally define a more specific platform macro. | ||
| 135 | * | ||
| 136 | * \since This macro is available since SDL 3.2.0. | ||
| 137 | * | ||
| 138 | * \sa SDL_PLATFORM_MACOS | ||
| 139 | * \sa SDL_PLATFORM_IOS | ||
| 140 | * \sa SDL_PLATFORM_TVOS | ||
| 141 | * \sa SDL_PLATFORM_VISIONOS | ||
| 142 | */ | ||
| 143 | #define SDL_PLATFORM_APPLE 1 | ||
| 144 | |||
| 145 | /* lets us know what version of macOS we're compiling on */ | ||
| 146 | #include <AvailabilityMacros.h> | ||
| 147 | #ifndef __has_extension /* Older compilers don't support this */ | ||
| 148 | #define __has_extension(x) 0 | ||
| 149 | #include <TargetConditionals.h> | ||
| 150 | #undef __has_extension | ||
| 151 | #else | ||
| 152 | #include <TargetConditionals.h> | ||
| 153 | #endif | ||
| 154 | |||
| 155 | /* Fix building with older SDKs that don't define these | ||
| 156 | See this for more information: | ||
| 157 | https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets | ||
| 158 | */ | ||
| 159 | #ifndef TARGET_OS_MACCATALYST | ||
| 160 | #define TARGET_OS_MACCATALYST 0 | ||
| 161 | #endif | ||
| 162 | #ifndef TARGET_OS_IOS | ||
| 163 | #define TARGET_OS_IOS 0 | ||
| 164 | #endif | ||
| 165 | #ifndef TARGET_OS_IPHONE | ||
| 166 | #define TARGET_OS_IPHONE 0 | ||
| 167 | #endif | ||
| 168 | #ifndef TARGET_OS_TV | ||
| 169 | #define TARGET_OS_TV 0 | ||
| 170 | #endif | ||
| 171 | #ifndef TARGET_OS_SIMULATOR | ||
| 172 | #define TARGET_OS_SIMULATOR 0 | ||
| 173 | #endif | ||
| 174 | #ifndef TARGET_OS_VISION | ||
| 175 | #define TARGET_OS_VISION 0 | ||
| 176 | #endif | ||
| 177 | |||
| 178 | #if TARGET_OS_TV | ||
| 179 | |||
| 180 | /** | ||
| 181 | * A preprocessor macro that is only defined if compiling for tvOS. | ||
| 182 | * | ||
| 183 | * \since This macro is available since SDL 3.2.0. | ||
| 184 | * | ||
| 185 | * \sa SDL_PLATFORM_APPLE | ||
| 186 | */ | ||
| 187 | #define SDL_PLATFORM_TVOS 1 | ||
| 188 | #endif | ||
| 189 | |||
| 190 | #if TARGET_OS_VISION | ||
| 191 | |||
| 192 | /** | ||
| 193 | * A preprocessor macro that is only defined if compiling for VisionOS. | ||
| 194 | * | ||
| 195 | * \since This macro is available since SDL 3.2.0. | ||
| 196 | * | ||
| 197 | * \sa SDL_PLATFORM_APPLE | ||
| 198 | */ | ||
| 199 | #define SDL_PLATFORM_VISIONOS 1 | ||
| 200 | #endif | ||
| 201 | |||
| 202 | #if TARGET_OS_IPHONE | ||
| 203 | |||
| 204 | /** | ||
| 205 | * A preprocessor macro that is only defined if compiling for iOS. | ||
| 206 | * | ||
| 207 | * \since This macro is available since SDL 3.2.0. | ||
| 208 | * | ||
| 209 | * \sa SDL_PLATFORM_APPLE | ||
| 210 | */ | ||
| 211 | #define SDL_PLATFORM_IOS 1 | ||
| 212 | |||
| 213 | #else | ||
| 214 | |||
| 215 | /** | ||
| 216 | * A preprocessor macro that is only defined if compiling for macOS. | ||
| 217 | * | ||
| 218 | * \since This macro is available since SDL 3.2.0. | ||
| 219 | * | ||
| 220 | * \sa SDL_PLATFORM_APPLE | ||
| 221 | */ | ||
| 222 | #define SDL_PLATFORM_MACOS 1 | ||
| 223 | |||
| 224 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | ||
| 225 | #error SDL for macOS only supports deploying on 10.7 and above. | ||
| 226 | #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */ | ||
| 227 | #endif /* TARGET_OS_IPHONE */ | ||
| 228 | #endif /* defined(__APPLE__) */ | ||
| 229 | |||
| 230 | #ifdef __EMSCRIPTEN__ | ||
| 231 | |||
| 232 | /** | ||
| 233 | * A preprocessor macro that is only defined if compiling for Emscripten. | ||
| 234 | * | ||
| 235 | * \since This macro is available since SDL 3.2.0. | ||
| 236 | */ | ||
| 237 | #define SDL_PLATFORM_EMSCRIPTEN 1 | ||
| 238 | #endif | ||
| 239 | |||
| 240 | #ifdef __NetBSD__ | ||
| 241 | |||
| 242 | /** | ||
| 243 | * A preprocessor macro that is only defined if compiling for NetBSD. | ||
| 244 | * | ||
| 245 | * \since This macro is available since SDL 3.2.0. | ||
| 246 | */ | ||
| 247 | #define SDL_PLATFORM_NETBSD 1 | ||
| 248 | #endif | ||
| 249 | |||
| 250 | #ifdef __OpenBSD__ | ||
| 251 | |||
| 252 | /** | ||
| 253 | * A preprocessor macro that is only defined if compiling for OpenBSD. | ||
| 254 | * | ||
| 255 | * \since This macro is available since SDL 3.2.0. | ||
| 256 | */ | ||
| 257 | #define SDL_PLATFORM_OPENBSD 1 | ||
| 258 | #endif | ||
| 259 | |||
| 260 | #if defined(__OS2__) || defined(__EMX__) | ||
| 261 | |||
| 262 | /** | ||
| 263 | * A preprocessor macro that is only defined if compiling for OS/2. | ||
| 264 | * | ||
| 265 | * \since This macro is available since SDL 3.2.0. | ||
| 266 | */ | ||
| 267 | #define SDL_PLATFORM_OS2 1 | ||
| 268 | #endif | ||
| 269 | |||
| 270 | #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) | ||
| 271 | |||
| 272 | /** | ||
| 273 | * A preprocessor macro that is only defined if compiling for Tru64 (OSF/1). | ||
| 274 | * | ||
| 275 | * \since This macro is available since SDL 3.2.0. | ||
| 276 | */ | ||
| 277 | #define SDL_PLATFORM_OSF 1 | ||
| 278 | #endif | ||
| 279 | |||
| 280 | #ifdef __QNXNTO__ | ||
| 281 | |||
| 282 | /** | ||
| 283 | * A preprocessor macro that is only defined if compiling for QNX Neutrino. | ||
| 284 | * | ||
| 285 | * \since This macro is available since SDL 3.2.0. | ||
| 286 | */ | ||
| 287 | #define SDL_PLATFORM_QNXNTO 1 | ||
| 288 | #endif | ||
| 289 | |||
| 290 | #if defined(riscos) || defined(__riscos) || defined(__riscos__) | ||
| 291 | |||
| 292 | /** | ||
| 293 | * A preprocessor macro that is only defined if compiling for RISC OS. | ||
| 294 | * | ||
| 295 | * \since This macro is available since SDL 3.2.0. | ||
| 296 | */ | ||
| 297 | #define SDL_PLATFORM_RISCOS 1 | ||
| 298 | #endif | ||
| 299 | |||
| 300 | #if defined(__sun) && defined(__SVR4) | ||
| 301 | |||
| 302 | /** | ||
| 303 | * A preprocessor macro that is only defined if compiling for SunOS/Solaris. | ||
| 304 | * | ||
| 305 | * \since This macro is available since SDL 3.2.0. | ||
| 306 | */ | ||
| 307 | #define SDL_PLATFORM_SOLARIS 1 | ||
| 308 | #endif | ||
| 309 | |||
| 310 | #if defined(__CYGWIN__) | ||
| 311 | |||
| 312 | /** | ||
| 313 | * A preprocessor macro that is only defined if compiling for Cygwin. | ||
| 314 | * | ||
| 315 | * \since This macro is available since SDL 3.2.0. | ||
| 316 | */ | ||
| 317 | #define SDL_PLATFORM_CYGWIN 1 | ||
| 318 | #endif | ||
| 319 | |||
| 320 | #if defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) | ||
| 321 | |||
| 322 | /** | ||
| 323 | * A preprocessor macro that is only defined if compiling for Windows. | ||
| 324 | * | ||
| 325 | * This also covers several other platforms, like Microsoft GDK, Xbox, WinRT, | ||
| 326 | * etc. Each will have their own more-specific platform macros, too. | ||
| 327 | * | ||
| 328 | * \since This macro is available since SDL 3.2.0. | ||
| 329 | * | ||
| 330 | * \sa SDL_PLATFORM_WIN32 | ||
| 331 | * \sa SDL_PLATFORM_XBOXONE | ||
| 332 | * \sa SDL_PLATFORM_XBOXSERIES | ||
| 333 | * \sa SDL_PLATFORM_WINGDK | ||
| 334 | * \sa SDL_PLATFORM_GDK | ||
| 335 | */ | ||
| 336 | #define SDL_PLATFORM_WINDOWS 1 | ||
| 337 | |||
| 338 | /* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */ | ||
| 339 | #if defined(_MSC_VER) && defined(__has_include) | ||
| 340 | #if __has_include(<winapifamily.h>) | ||
| 341 | #define HAVE_WINAPIFAMILY_H 1 | ||
| 342 | #else | ||
| 343 | #define HAVE_WINAPIFAMILY_H 0 | ||
| 344 | #endif | ||
| 345 | |||
| 346 | /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ | ||
| 347 | #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ | ||
| 348 | #define HAVE_WINAPIFAMILY_H 1 | ||
| 349 | #else | ||
| 350 | #define HAVE_WINAPIFAMILY_H 0 | ||
| 351 | #endif | ||
| 352 | |||
| 353 | #if HAVE_WINAPIFAMILY_H | ||
| 354 | #include <winapifamily.h> | ||
| 355 | #define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) | ||
| 356 | #else | ||
| 357 | #define WINAPI_FAMILY_WINRT 0 | ||
| 358 | #endif /* HAVE_WINAPIFAMILY_H */ | ||
| 359 | |||
| 360 | #ifdef SDL_WIKI_DOCUMENTATION_SECTION | ||
| 361 | |||
| 362 | /** | ||
| 363 | * A preprocessor macro that defined to 1 if compiling for Windows Phone. | ||
| 364 | * | ||
| 365 | * \since This macro is available since SDL 3.2.0. | ||
| 366 | */ | ||
| 367 | #define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) | ||
| 368 | |||
| 369 | #elif defined(HAVE_WINAPIFAMILY_H) && HAVE_WINAPIFAMILY_H | ||
| 370 | #define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) | ||
| 371 | #else | ||
| 372 | #define SDL_WINAPI_FAMILY_PHONE 0 | ||
| 373 | #endif | ||
| 374 | |||
| 375 | #if WINAPI_FAMILY_WINRT | ||
| 376 | #error Windows RT/UWP is no longer supported in SDL | ||
| 377 | |||
| 378 | #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */ | ||
| 379 | |||
| 380 | /** | ||
| 381 | * A preprocessor macro that is only defined if compiling for Microsoft GDK | ||
| 382 | * for Windows. | ||
| 383 | * | ||
| 384 | * \since This macro is available since SDL 3.2.0. | ||
| 385 | */ | ||
| 386 | #define SDL_PLATFORM_WINGDK 1 | ||
| 387 | |||
| 388 | #elif defined(_GAMING_XBOX_XBOXONE) | ||
| 389 | |||
| 390 | /** | ||
| 391 | * A preprocessor macro that is only defined if compiling for Xbox One. | ||
| 392 | * | ||
| 393 | * \since This macro is available since SDL 3.2.0. | ||
| 394 | */ | ||
| 395 | #define SDL_PLATFORM_XBOXONE 1 | ||
| 396 | |||
| 397 | #elif defined(_GAMING_XBOX_SCARLETT) | ||
| 398 | |||
| 399 | /** | ||
| 400 | * A preprocessor macro that is only defined if compiling for Xbox Series. | ||
| 401 | * | ||
| 402 | * \since This macro is available since SDL 3.2.0. | ||
| 403 | */ | ||
| 404 | #define SDL_PLATFORM_XBOXSERIES 1 | ||
| 405 | |||
| 406 | #else | ||
| 407 | |||
| 408 | /** | ||
| 409 | * A preprocessor macro that is only defined if compiling for desktop Windows. | ||
| 410 | * | ||
| 411 | * Despite the "32", this also covers 64-bit Windows; as an informal | ||
| 412 | * convention, its system layer tends to still be referred to as "the Win32 | ||
| 413 | * API." | ||
| 414 | * | ||
| 415 | * \since This macro is available since SDL 3.2.0. | ||
| 416 | */ | ||
| 417 | #define SDL_PLATFORM_WIN32 1 | ||
| 418 | |||
| 419 | #endif | ||
| 420 | #endif /* defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */ | ||
| 421 | |||
| 422 | |||
| 423 | /* This is to support generic "any GDK" separate from a platform-specific GDK */ | ||
| 424 | #if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 425 | |||
| 426 | /** | ||
| 427 | * A preprocessor macro that is only defined if compiling for Microsoft GDK on | ||
| 428 | * any platform. | ||
| 429 | * | ||
| 430 | * \since This macro is available since SDL 3.2.0. | ||
| 431 | */ | ||
| 432 | #define SDL_PLATFORM_GDK 1 | ||
| 433 | #endif | ||
| 434 | |||
| 435 | #if defined(__PSP__) || defined(__psp__) | ||
| 436 | |||
| 437 | /** | ||
| 438 | * A preprocessor macro that is only defined if compiling for Sony PSP. | ||
| 439 | * | ||
| 440 | * \since This macro is available since SDL 3.2.0. | ||
| 441 | */ | ||
| 442 | #define SDL_PLATFORM_PSP 1 | ||
| 443 | #endif | ||
| 444 | |||
| 445 | #if defined(__PS2__) || defined(PS2) | ||
| 446 | |||
| 447 | /** | ||
| 448 | * A preprocessor macro that is only defined if compiling for Sony PlayStation | ||
| 449 | * 2. | ||
| 450 | * | ||
| 451 | * \since This macro is available since SDL 3.2.0. | ||
| 452 | */ | ||
| 453 | #define SDL_PLATFORM_PS2 1 | ||
| 454 | #endif | ||
| 455 | |||
| 456 | #if defined(__vita__) || defined(__psp2__) | ||
| 457 | |||
| 458 | /** | ||
| 459 | * A preprocessor macro that is only defined if compiling for Sony Vita. | ||
| 460 | * | ||
| 461 | * \since This macro is available since SDL 3.2.0. | ||
| 462 | */ | ||
| 463 | #define SDL_PLATFORM_VITA 1 | ||
| 464 | #endif | ||
| 465 | |||
| 466 | #ifdef __3DS__ | ||
| 467 | |||
| 468 | /** | ||
| 469 | * A preprocessor macro that is only defined if compiling for Nintendo 3DS. | ||
| 470 | * | ||
| 471 | * \since This macro is available since SDL 3.2.0. | ||
| 472 | */ | ||
| 473 | #define SDL_PLATFORM_3DS 1 | ||
| 474 | #endif | ||
| 475 | |||
| 476 | #endif /* SDL_platform_defines_h_ */ | ||
