PlatformDetection.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. // Detect BASELIB_PLATFORM_X define.
  3. //
  4. // Note that PLATFORM_X defines in Unity code base may refer to one or more platforms defined by BASELIB_PLATFORM_X
  5. // Platforms here are very loosely defined on the set of available system apis.
  6. // They have closest relation with the platform toolchains defined in Bee.
  7. #if defined(_XBOX_ONE)
  8. #define BASELIB_PLATFORM_XBOXONE 1
  9. #elif defined(__NX__)
  10. #define BASELIB_PLATFORM_SWITCH 1
  11. #elif defined __ORBIS__
  12. #define BASELIB_PLATFORM_PS4 1
  13. #elif defined __PROSPERO__
  14. #define BASELIB_PLATFORM_PS5 1
  15. #elif defined __EMSCRIPTEN__
  16. #define BASELIB_PLATFORM_EMSCRIPTEN 1
  17. #elif defined __wasi__
  18. #define BASELIB_PLATFORM_WASI 1
  19. #elif defined(__APPLE__)
  20. #include <TargetConditionals.h>
  21. #if TARGET_OS_IOS
  22. #define BASELIB_PLATFORM_IOS 1
  23. #elif TARGET_OS_TV
  24. #define BASELIB_PLATFORM_TVOS 1
  25. #elif TARGET_OS_OSX || TARGET_OS_MAC
  26. #define BASELIB_PLATFORM_MACOS 1
  27. #endif
  28. #elif defined(__NetBSD__)
  29. #define BASELIB_PLATFORM_NETBSD 1
  30. #elif defined(linux) || defined(__linux__)
  31. #if defined(LUMIN)
  32. #define BASELIB_PLATFORM_LUMIN 1
  33. #elif defined(GGP)
  34. #define BASELIB_PLATFORM_STADIA 1
  35. #elif defined(ANDROID) || defined(__ANDROID__)
  36. #define BASELIB_PLATFORM_ANDROID 1
  37. #else
  38. #define BASELIB_PLATFORM_LINUX 1
  39. #endif
  40. #elif defined(_WIN32) || defined(__WIN32__)
  41. #include <winapifamily.h>
  42. #if (defined(WINAPI_FAMILY_GAMES) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES))
  43. #define BASELIB_PLATFORM_WINDOWSGAMES 1
  44. #elif WINAPI_FAMILY == WINAPI_FAMILY_APP
  45. #define BASELIB_PLATFORM_WINRT 1
  46. #else
  47. #define BASELIB_PLATFORM_WINDOWS 1
  48. #endif
  49. #endif