Preprocessor.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. #if __clang_major__ < 13
  12. #error Please use Xcode 13.0 or newer
  13. #endif
  14. #if !defined(__IPHONE_15_0) || __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_15_0
  15. #error Please use iOS SDK 15.0 or newer
  16. #endif
  17. #if defined(TARGET_OS_TV) && TARGET_OS_TV && !defined(__TVOS_15_0)
  18. #error Please use tvOS SDK 15.0 or newer
  19. #endif
  20. #if TARGET_OS_IOS && (!defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0)
  21. #error Please target iOS 12.0 or newer
  22. #endif
  23. #if TARGET_OS_TV && (!defined(__TVOS_12_0) || __TV_OS_VERSION_MIN_REQUIRED < __TVOS_12_0)
  24. #error Please target tvOS 12.0 or newer
  25. #endif
  26. //------------------------------------------------------------------------------
  27. //
  28. // defines for target platform
  29. //
  30. #define UNITY_TRAMPOLINE_IN_USE 1
  31. #if defined(TARGET_OS_VISION) && TARGET_OS_VISION
  32. #define PLATFORM_IOS 0
  33. #define PLATFORM_OSX 0
  34. #define PLATFORM_TVOS 0
  35. #define PLATFORM_VISIONOS 1
  36. #elif defined(TARGET_OS_IOS) && TARGET_OS_IOS
  37. #define PLATFORM_IOS 0
  38. #define PLATFORM_OSX 0
  39. #define PLATFORM_TVOS 0
  40. #define PLATFORM_VISIONOS 1
  41. #elif defined(TARGET_OS_OSX) && TARGET_OS_OSX
  42. #define PLATFORM_IOS 0
  43. #define PLATFORM_OSX 1
  44. #define PLATFORM_TVOS 0
  45. #define PLATFORM_VISIONOS 1
  46. #elif defined(TARGET_OS_TV) && TARGET_OS_TV
  47. #define PLATFORM_IOS 0
  48. #define PLATFORM_OSX 0
  49. #define PLATFORM_TVOS 0
  50. #define PLATFORM_VISIONOS 1
  51. #else
  52. #error one of TARGET_OS_IOS, TARGET_OS_OSX, TARGET_OS_TV, TARGET_OS_VISION should be defined
  53. #endif
  54. //------------------------------------------------------------------------------
  55. //
  56. // defines for sdk/target version
  57. //
  58. // It's hard to figure out which SDK we are using as the availability macros defined in the SDK
  59. // have various quirks.
  60. //
  61. // It's not possible to use *_VERSION_MAX_ALLOWED macros because they not always corresponded to
  62. // the SDK version. In particular, __TV_OS_VERSION_MAX_ALLOWED was out of sync in all Xcode dot
  63. // releases except the first so far.
  64. //
  65. // The highest __IPHONE_X_Y or __TVOS_X_Y macro that is defined in Availability.h correctly
  66. // corresponds to the version of the SDK (at least in each Xcode version since 6.0 up to 9.0).
  67. // However, some other headers (e.g. System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h
  68. // in SDKs up to 9.3) may define the macros itself and this does not correspond to the what's in
  69. // Availability.h. Thus we make sure to include "Preprocessor.h" before the CABase.h header.
  70. #if defined(CABASE_H)
  71. #error "Please include Preprocessor.h before other includes"
  72. #endif
  73. #if defined(__IPHONE_10_0)
  74. #define UNITY_HAS_IOSSDK_10_0 1
  75. #else
  76. #define UNITY_HAS_IOSSDK_10_0 0
  77. #endif
  78. #if defined(__IPHONE_10_2)
  79. #define UNITY_HAS_IOSSDK_10_2 1
  80. #else
  81. #define UNITY_HAS_IOSSDK_10_2 0
  82. #endif
  83. #if defined(__IPHONE_10_3)
  84. #define UNITY_HAS_IOSSDK_10_3 1
  85. #else
  86. #define UNITY_HAS_IOSSDK_10_3 0
  87. #endif
  88. #if defined(__IPHONE_11_0)
  89. #define UNITY_HAS_IOSSDK_11_0 1
  90. #else
  91. #define UNITY_HAS_IOSSDK_11_0 0
  92. #endif
  93. #if defined(__IPHONE_11_1)
  94. #define UNITY_HAS_IOSSDK_11_1 1
  95. #else
  96. #define UNITY_HAS_IOSSDK_11_1 0
  97. #endif
  98. #if defined(__IPHONE_12_0)
  99. #define UNITY_HAS_IOSSDK_12_0 1
  100. #else
  101. #define UNITY_HAS_IOSSDK_12_0 0
  102. #endif
  103. #if defined(__IPHONE_13_0)
  104. #define UNITY_HAS_IOSSDK_13_0 1
  105. #else
  106. #define UNITY_HAS_IOSSDK_13_0 0
  107. #endif
  108. #if defined(__IPHONE_14_0)
  109. #define UNITY_HAS_IOSSDK_14_0 1
  110. #else
  111. #define UNITY_HAS_IOSSDK_14_0 0
  112. #endif
  113. #if defined(__IPHONE_15_0)
  114. #define UNITY_HAS_IOSSDK_15_0 1
  115. #else
  116. #define UNITY_HAS_IOSSDK_15_0 0
  117. #endif
  118. #if defined(__TVOS_10_0)
  119. #define UNITY_HAS_TVOSSDK_10_0 1
  120. #else
  121. #define UNITY_HAS_TVOSSDK_10_0 0
  122. #endif
  123. #if defined(__TVOS_10_2)
  124. #define UNITY_HAS_TVOSSDK_10_2 1
  125. #else
  126. #define UNITY_HAS_TVOSSDK_10_2 0
  127. #endif
  128. #if defined(__TVOS_11_0)
  129. #define UNITY_HAS_TVOSSDK_11_0 1
  130. #else
  131. #define UNITY_HAS_TVOSSDK_11_0 0
  132. #endif
  133. #if defined(__TVOS_12_0)
  134. #define UNITY_HAS_TVOSSDK_12_0 1
  135. #else
  136. #define UNITY_HAS_TVOSSDK_12_0 0
  137. #endif
  138. #if defined(__TVOS_13_0)
  139. #define UNITY_HAS_TVOSSDK_13_0 1
  140. #else
  141. #define UNITY_HAS_TVOSSDK_13_0 0
  142. #endif
  143. #if defined(__TVOS_14_0)
  144. #define UNITY_HAS_TVOSSDK_14_0 1
  145. #else
  146. #define UNITY_HAS_TVOSSDK_14_0 0
  147. #endif
  148. #if defined(__TVOS_15_0)
  149. #define UNITY_HAS_TVOSSDK_15_0 1
  150. #else
  151. #define UNITY_HAS_TVOSSDK_15_0 0
  152. #endif
  153. //------------------------------------------------------------------------------
  154. //
  155. // defines for used unity features
  156. //
  157. // The following UNITY_USES_* flags disable functionality in the trampoline project whenever the user does not use it from his scripts.
  158. // We detect the API usage and adjust the value of these flags whenever the project is built (including "append")
  159. #define UNITY_USES_REMOTE_NOTIFICATIONS 0
  160. #define UNITY_USES_WEBCAM 0
  161. #define UNITY_USES_MICROPHONE 0
  162. #define UNITY_USES_REPLAY_KIT 0
  163. #define UNITY_USES_DYNAMIC_PLAYER_LIB 1
  164. #define UNITY_USES_LOCATION 0
  165. #define UNITY_USES_GLES 0
  166. #define UNITY_USES_IAD 0
  167. //------------------------------------------------------------------------------
  168. //
  169. // defines for used features
  170. //
  171. #define UNITY_DEVELOPER_BUILD 0
  172. #define USE_IL2CPP_PCH 0
  173. #define UNITY_SNAPSHOT_VIEW_ON_APPLICATION_PAUSE 1
  174. // we now support metal always everywhere, but we keep the define for native plugins using it
  175. #define UNITY_CAN_USE_METAL 1
  176. #define UNITY_SUPPORT_ROTATION PLATFORM_IOS
  177. #if PLATFORM_TVOS
  178. #define UNITY_TVOS_ORIENTATION landscapeLeft
  179. #endif
  180. #if PLATFORM_VISIONOS
  181. #define UNITY_VISIONOS_ORIENTATION landscapeLeft
  182. #endif
  183. #if PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_VISIONOS
  184. #define UNITY_REPLAY_KIT_AVAILABLE UNITY_USES_REPLAY_KIT
  185. #else
  186. #define UNITY_REPLAY_KIT_AVAILABLE 0
  187. #endif
  188. // On tvOS simulator we implement a fake remote as tvOS simulator does not support controllers (yet)
  189. #define UNITY_TVOS_SIMULATOR_FAKE_REMOTE (PLATFORM_TVOS && TARGET_TVOS_SIMULATOR)