Preprocessor.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #pragma once
  2. #include <Availability.h>
  3. #include <TargetConditionals.h>
  4. //------------------------------------------------------------------------------
  5. //
  6. // ensuring proper compiler/xcode/whatever selection
  7. //
  8. #ifndef __clang__
  9. #error Please use clang compiler.
  10. #endif
  11. // NOT the best way but apple do not care about adding extensions properly
  12. #if __clang_major__ < 9
  13. #error Please use Xcode 9.0 or newer
  14. #endif
  15. #if !defined(__IPHONE_11_0) || __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_11_0
  16. #error Please use iOS SDK 11.0 or newer
  17. #endif
  18. #if defined(TARGET_OS_TV) && TARGET_OS_TV && !defined(__TVOS_11_0)
  19. #error Please use tvOS SDK 11.0 or newer
  20. #endif
  21. #if TARGET_OS_IOS && (!defined(__IPHONE_10_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)
  22. #error Please target iOS 10.0 or newer
  23. #endif
  24. #if TARGET_OS_TV && (!defined(__TVOS_10_0) || __TV_OS_VERSION_MIN_REQUIRED < __TVOS_10_0)
  25. #error Please target tvOS 10.0 or newer
  26. #endif
  27. //------------------------------------------------------------------------------
  28. //
  29. // defines for target platform
  30. //
  31. #define UNITY_TRAMPOLINE_IN_USE 1
  32. #if defined(TARGET_OS_TV) && TARGET_OS_TV
  33. #define PLATFORM_TVOS 0
  34. #define PLATFORM_IOS 1
  35. #else
  36. #define PLATFORM_TVOS 0
  37. #define PLATFORM_IOS 1
  38. #endif
  39. #define PLATFORM_OSX 0
  40. //------------------------------------------------------------------------------
  41. //
  42. // defines for sdk/target version
  43. //
  44. #if !TARGET_IPHONE_SIMULATOR && !TARGET_TVOS_SIMULATOR
  45. #define UNITY_CAN_USE_METAL 1
  46. #elif TARGET_IPHONE_SIMULATOR && defined(__IPHONE_13_0)
  47. #define UNITY_CAN_USE_METAL 1
  48. #elif TARGET_TVOS_SIMULATOR && defined(__TVOS_13_0)
  49. #define UNITY_CAN_USE_METAL 1
  50. #else
  51. #define UNITY_CAN_USE_METAL 0
  52. #endif
  53. // It's hard to figure out which SDK we are using as the availability macros defined in the SDK
  54. // have various quirks.
  55. //
  56. // It's not possible to use *_VERSION_MAX_ALLOWED macros because they not always corresponded to
  57. // the SDK version. In particular, __TV_OS_VERSION_MAX_ALLOWED was out of sync in all Xcode dot
  58. // releases except the first so far.
  59. //
  60. // The highest __IPHONE_X_Y or __TVOS_X_Y macro that is defined in Availability.h correctly
  61. // corresponds to the version of the SDK (at least in each Xcode version since 6.0 up to 9.0).
  62. // However, some other headers (e.g. System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h
  63. // in SDKs up to 9.3) may define the macros itself and this does not correspond to the what's in
  64. // Availability.h. Thus we make sure to include "Preprocessor.h" before the CABase.h header.
  65. #if defined(CABASE_H)
  66. #error "Please include Preprocessor.h before other includes"
  67. #endif
  68. #if defined(__IPHONE_10_0)
  69. #define UNITY_HAS_IOSSDK_10_0 1
  70. #else
  71. #define UNITY_HAS_IOSSDK_10_0 0
  72. #endif
  73. #if defined(__IPHONE_10_2)
  74. #define UNITY_HAS_IOSSDK_10_2 1
  75. #else
  76. #define UNITY_HAS_IOSSDK_10_2 0
  77. #endif
  78. #if defined(__IPHONE_10_3)
  79. #define UNITY_HAS_IOSSDK_10_3 1
  80. #else
  81. #define UNITY_HAS_IOSSDK_10_3 0
  82. #endif
  83. #if defined(__IPHONE_11_0)
  84. #define UNITY_HAS_IOSSDK_11_0 1
  85. #else
  86. #define UNITY_HAS_IOSSDK_11_0 0
  87. #endif
  88. #if defined(__IPHONE_11_1)
  89. #define UNITY_HAS_IOSSDK_11_1 1
  90. #else
  91. #define UNITY_HAS_IOSSDK_11_1 0
  92. #endif
  93. #if defined(__TVOS_10_0)
  94. #define UNITY_HAS_TVOSSDK_10_0 1
  95. #else
  96. #define UNITY_HAS_TVOSSDK_10_0 0
  97. #endif
  98. #if defined(__TVOS_10_2)
  99. #define UNITY_HAS_TVOSSDK_10_2 1
  100. #else
  101. #define UNITY_HAS_TVOSSDK_10_2 0
  102. #endif
  103. #if defined(__TVOS_11_0)
  104. #define UNITY_HAS_TVOSSDK_11_0 1
  105. #else
  106. #define UNITY_HAS_TVOSSDK_11_0 0
  107. #endif
  108. // The following UNITY_USES_* flags disable functionality in the trampoline project
  109. // whenever the user does not use it from his scripts. We detect the API usage and
  110. // adjust the value of these flags whenever the project is built (including when the
  111. // project is appended)
  112. #define UNITY_USES_REMOTE_NOTIFICATIONS 0
  113. #define UNITY_USES_WEBCAM 0
  114. #define UNITY_USES_MICROPHONE 0
  115. #define UNITY_USES_REPLAY_KIT 0
  116. #define UNITY_USES_IAD 0
  117. #define UNITY_SNAPSHOT_VIEW_ON_APPLICATION_PAUSE 1
  118. #define UNITY_DEVELOPER_BUILD 0
  119. #define UNITY_USES_DYNAMIC_PLAYER_LIB 0
  120. #define UNITY_USES_LOCATION 0
  121. #define USE_IL2CPP_PCH 0
  122. #define UNITY_SUPPORT_ROTATION PLATFORM_IOS
  123. #if PLATFORM_TVOS
  124. #define UNITY_TVOS_ORIENTATION landscapeLeft
  125. #endif
  126. #if PLATFORM_IOS // available in ios9 sdk which is min requirement
  127. #define UNITY_REPLAY_KIT_AVAILABLE UNITY_USES_REPLAY_KIT
  128. #elif PLATFORM_TVOS // available in tvos10 sdk which is min requirement
  129. #define UNITY_REPLAY_KIT_AVAILABLE UNITY_USES_REPLAY_KIT && defined(__TVOS_10_0)
  130. #else
  131. #define UNITY_REPLAY_KIT_AVAILABLE 0
  132. #endif
  133. // On tvOS simulator we implement a fake remote as tvOS simulator does not support controllers (yet)
  134. #define UNITY_TVOS_SIMULATOR_FAKE_REMOTE (PLATFORM_TVOS && TARGET_TVOS_SIMULATOR)