OpenSwiftUITargetConditionals.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. // This source file is part of the Swift.org open source project
  2. //
  3. // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See http://swift.org/LICENSE.txt for license information
  7. // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
  8. //
  9. /*
  10. File: OpenSwiftUITargetConditionals.h
  11. Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone
  12. Note: OpenSwiftUITargetConditionals.h in 3.4 Universal Interfaces works
  13. with all compilers. This header only recognizes compilers
  14. known to run on Mac OS X.
  15. */
  16. #ifndef __OPENSWIFTUITARGETCONDITIONALS__
  17. #define __OPENSWIFTUITARGETCONDITIONALS__
  18. /****************************************************************************************************
  19. TARGET_CPU_*
  20. These conditionals specify which microprocessor instruction set is being
  21. generated. At most one of these is true, the rest are false.
  22. TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode
  23. TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode
  24. TARGET_CPU_68K - Compiler is generating 680x0 instructions
  25. TARGET_CPU_X86 - Compiler is generating x86 instructions
  26. TARGET_CPU_ARM - Compiler is generating ARM instructions
  27. TARGET_CPU_MIPS - Compiler is generating MIPS instructions
  28. TARGET_CPU_SPARC - Compiler is generating Sparc instructions
  29. TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
  30. TARGET_CPU_WASM32 - Compiler is generating WebAssembly instructions for 32-bit mode
  31. TARGET_OS_*
  32. These conditionals specify in which Operating System the generated code will
  33. run. Indention is used to show which conditionals are evolutionary subclasses.
  34. The MAC/WIN32/UNIX conditionals are mutually exclusive.
  35. The IOS/TV/WATCH conditionals are mutually exclusive.
  36. TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
  37. TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
  38. TARGET_OS_CYGWIN - Generated code will run under 64-bit Cygwin
  39. TARGET_OS_WASI - Generated code will run under WebAssembly System Interface
  40. TARGET_OS_MAC - Generated code will run under Mac OS X variant
  41. TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
  42. TARGET_OS_IOS - Generated code will run under iOS
  43. TARGET_OS_TV - Generated code will run under Apple TV OS
  44. TARGET_OS_WATCH - Generated code will run under Apple Watch OS
  45. TARGET_OS_SIMULATOR - Generated code will run under a simulator
  46. TARGET_OS_EMBEDDED - Generated code for firmware
  47. TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR
  48. TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH
  49. TARGET_RT_*
  50. These conditionals specify in which runtime the generated code will
  51. run. This is needed when the OS and CPU support more than one runtime
  52. (e.g. Mac OS X supports CFM and mach-o).
  53. TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
  54. TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers
  55. TARGET_RT_64_BIT - Generated code uses 64-bit pointers
  56. TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
  57. TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
  58. ****************************************************************************************************/
  59. #if __APPLE__
  60. #define OPENSWIFTUI_TARGET_OS_DARWIN 1
  61. #define OPENSWIFTUI_TARGET_OS_LINUX 0
  62. #define OPENSWIFTUI_TARGET_OS_WINDOWS 0
  63. #define OPENSWIFTUI_TARGET_OS_BSD 0
  64. #define OPENSWIFTUI_TARGET_OS_ANDROID 0
  65. #define OPENSWIFTUI_TARGET_OS_CYGWIN 0
  66. #define OPENSWIFTUI_TARGET_OS_WASI 0
  67. #elif __ANDROID__
  68. #define OPENSWIFTUI_TARGET_OS_DARWIN 0
  69. #define OPENSWIFTUI_TARGET_OS_LINUX 1
  70. #define OPENSWIFTUI_TARGET_OS_WINDOWS 0
  71. #define OPENSWIFTUI_TARGET_OS_BSD 0
  72. #define OPENSWIFTUI_TARGET_OS_ANDROID 1
  73. #define OPENSWIFTUI_TARGET_OS_CYGWIN 0
  74. #define OPENSWIFTUI_TARGET_OS_WASI 0
  75. #elif __linux__
  76. #define OPENSWIFTUI_TARGET_OS_DARWIN 0
  77. #define OPENSWIFTUI_TARGET_OS_LINUX 1
  78. #define OPENSWIFTUI_TARGET_OS_WINDOWS 0
  79. #define OPENSWIFTUI_TARGET_OS_BSD 0
  80. #define OPENSWIFTUI_TARGET_OS_ANDROID 0
  81. #define OPENSWIFTUI_TARGET_OS_CYGWIN 0
  82. #define OPENSWIFTUI_TARGET_OS_WASI 0
  83. #elif __CYGWIN__
  84. #define OPENSWIFTUI_TARGET_OS_DARWIN 0
  85. #define OPENSWIFTUI_TARGET_OS_LINUX 1
  86. #define OPENSWIFTUI_TARGET_OS_WINDOWS 0
  87. #define OPENSWIFTUI_TARGET_OS_BSD 0
  88. #define OPENSWIFTUI_TARGET_OS_ANDROID 0
  89. #define OPENSWIFTUI_TARGET_OS_CYGWIN 1
  90. #define OPENSWIFTUI_TARGET_OS_WASI 0
  91. #elif _WIN32 || _WIN64
  92. #define OPENSWIFTUI_TARGET_OS_DARWIN 0
  93. #define OPENSWIFTUI_TARGET_OS_LINUX 0
  94. #define OPENSWIFTUI_TARGET_OS_WINDOWS 1
  95. #define OPENSWIFTUI_TARGET_OS_BSD 0
  96. #define OPENSWIFTUI_TARGET_OS_ANDROID 0
  97. #define OPENSWIFTUI_TARGET_OS_CYGWIN 0
  98. #define OPENSWIFTUI_TARGET_OS_WASI 0
  99. #elif __unix__
  100. #define OPENSWIFTUI_TARGET_OS_DARWIN 0
  101. #define OPENSWIFTUI_TARGET_OS_LINUX 0
  102. #define OPENSWIFTUI_TARGET_OS_WINDOWS 0
  103. #define OPENSWIFTUI_TARGET_OS_BSD 1
  104. #define OPENSWIFTUI_TARGET_OS_ANDROID 0
  105. #define OPENSWIFTUI_TARGET_OS_CYGWIN 0
  106. #define OPENSWIFTUI_TARGET_OS_WASI 0
  107. #elif __wasi__
  108. #define OPENSWIFTUI_TARGET_OS_DARWIN 0
  109. #define OPENSWIFTUI_TARGET_OS_LINUX 0
  110. #define OPENSWIFTUI_TARGET_OS_WINDOWS 0
  111. #define OPENSWIFTUI_TARGET_OS_BSD 0
  112. #define OPENSWIFTUI_TARGET_OS_ANDROID 0
  113. #define OPENSWIFTUI_TARGET_OS_CYGWIN 0
  114. #define OPENSWIFTUI_TARGET_OS_WASI 1
  115. #else
  116. #error unknown operating system
  117. #endif
  118. #define OPENSWIFTUI_TARGET_OS_WIN32 OPENSWIFTUI_TARGET_OS_WINDOWS
  119. #define OPENSWIFTUI_TARGET_OS_MAC OPENSWIFTUI_TARGET_OS_DARWIN
  120. /* ark_ui_basic Addition Begin */
  121. #if OPENSWIFTUI_TARGET_OS_DARWIN
  122. #include <TargetConditionals.h>
  123. #define OPENSWIFTUI_TARGET_OS_OSX TARGET_OS_OSX
  124. #define OPENSWIFTUI_TARGET_OS_IPHONE TARGET_OS_IPHONE
  125. #define OPENSWIFTUI_TARGET_OS_IOS TARGET_OS_IOS
  126. #define OPENSWIFTUI_TARGET_OS_VISION TARGET_OS_VISION
  127. #define OPENSWIFTUI_TARGET_OS_WATCH TARGET_OS_WATCH
  128. #define OPENSWIFTUI_TARGET_OS_TV TARGET_OS_TV
  129. #define OPENSWIFTUI_TARGET_OS_MACCATALYST TARGET_OS_MACCATALYST
  130. #define OPENSWIFTUI_TARGET_OS_SIMULATOR TARGET_OS_SIMULATOR
  131. #else
  132. // iOS, watchOS, and tvOS are not supported
  133. #define OPENSWIFTUI_TARGET_OS_IPHONE 0
  134. #define OPENSWIFTUI_TARGET_OS_IOS 0
  135. #define OPENSWIFTUI_TARGET_OS_VISION 0
  136. #define OPENSWIFTUI_TARGET_OS_WATCH 0
  137. #define OPENSWIFTUI_TARGET_OS_TV 0
  138. #define OPENSWIFTUI_TARGET_OS_MACCATALYST 0
  139. #define OPENSWIFTUI_TARGET_OS_SIMULATOR 0
  140. #endif
  141. /* ark_ui_basic Addition End */
  142. #if __x86_64__
  143. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  144. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  145. #define OPENSWIFTUI_TARGET_CPU_X86 0
  146. #define OPENSWIFTUI_TARGET_CPU_X86_64 1
  147. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  148. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  149. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  150. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  151. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  152. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  153. #elif __arm64__ || __aarch64__
  154. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  155. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  156. #define OPENSWIFTUI_TARGET_CPU_X86 0
  157. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  158. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  159. #define OPENSWIFTUI_TARGET_CPU_ARM64 1
  160. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  161. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  162. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  163. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  164. #elif __mips64__
  165. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  166. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  167. #define OPENSWIFTUI_TARGET_CPU_X86 0
  168. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  169. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  170. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  171. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  172. #define OPENSWIFTUI_TARGET_CPU_MIPS64 1
  173. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  174. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  175. #elif __powerpc64__
  176. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  177. #define OPENSWIFTUI_TARGET_CPU_PPC64 1
  178. #define OPENSWIFTUI_TARGET_CPU_X86 0
  179. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  180. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  181. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  182. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  183. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  184. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  185. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  186. #elif __i386__
  187. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  188. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  189. #define OPENSWIFTUI_TARGET_CPU_X86 1
  190. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  191. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  192. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  193. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  194. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  195. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  196. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  197. #elif __arm__
  198. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  199. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  200. #define OPENSWIFTUI_TARGET_CPU_X86 0
  201. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  202. #define OPENSWIFTUI_TARGET_CPU_ARM 1
  203. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  204. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  205. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  206. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  207. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  208. #elif __mips__
  209. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  210. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  211. #define OPENSWIFTUI_TARGET_CPU_X86 0
  212. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  213. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  214. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  215. #define OPENSWIFTUI_TARGET_CPU_MIPS 1
  216. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  217. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  218. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  219. #elif __powerpc__
  220. #define OPENSWIFTUI_TARGET_CPU_PPC 1
  221. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  222. #define OPENSWIFTUI_TARGET_CPU_X86 0
  223. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  224. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  225. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  226. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  227. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  228. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  229. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  230. #elif __s390x__
  231. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  232. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  233. #define OPENSWIFTUI_TARGET_CPU_X86 0
  234. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  235. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  236. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  237. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  238. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  239. #define OPENSWIFTUI_TARGET_CPU_S390X 1
  240. #define OPENSWIFTUI_TARGET_CPU_WASM32 0
  241. #elif __wasm32__
  242. #define OPENSWIFTUI_TARGET_CPU_PPC 0
  243. #define OPENSWIFTUI_TARGET_CPU_PPC64 0
  244. #define OPENSWIFTUI_TARGET_CPU_X86 0
  245. #define OPENSWIFTUI_TARGET_CPU_X86_64 0
  246. #define OPENSWIFTUI_TARGET_CPU_ARM 0
  247. #define OPENSWIFTUI_TARGET_CPU_ARM64 0
  248. #define OPENSWIFTUI_TARGET_CPU_MIPS 0
  249. #define OPENSWIFTUI_TARGET_CPU_MIPS64 0
  250. #define OPENSWIFTUI_TARGET_CPU_S390X 0
  251. #define OPENSWIFTUI_TARGET_CPU_WASM32 1
  252. #else
  253. #error unknown architecture
  254. #endif
  255. #if __LITTLE_ENDIAN__
  256. #define OPENSWIFTUI_TARGET_RT_LITTLE_ENDIAN 1
  257. #define OPENSWIFTUI_TARGET_RT_BIG_ENDIAN 0
  258. #elif __BIG_ENDIAN__
  259. #define OPENSWIFTUI_TARGET_RT_LITTLE_ENDIAN 0
  260. #define OPENSWIFTUI_TARGET_RT_BIG_ENDIAN 1
  261. #else
  262. #error unknown endian
  263. #endif
  264. #if __LP64__ || __LLP64__ || __POINTER_WIDTH__-0 == 64
  265. #define OPENSWIFTUI_TARGET_RT_64_BIT 1
  266. #else
  267. #define OPENSWIFTUI_TARGET_RT_64_BIT 0
  268. #endif
  269. #endif /* __OPENSWIFTUITARGETCONDITIONALS__ */