Preprocessor.h 4.4 KB

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