il2cpp-config-platforms.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. #pragma once
  2. #include <assert.h>
  3. #if defined(__aarch64__) && defined(__arm__)
  4. #error We assume both __aarch64__ and __arm__ cannot be defined at tha same time.
  5. #endif
  6. #if defined(__aarch64__)
  7. #define IL2CPP_TARGET_ARM64 1
  8. #define IL2CPP_TARGET_ARMV7 0
  9. #elif defined(__arm__)
  10. #define IL2CPP_TARGET_ARM64 0
  11. #define IL2CPP_TARGET_ARMV7 1
  12. #else
  13. #define IL2CPP_TARGET_ARM64 0
  14. #define IL2CPP_TARGET_ARMV7 0
  15. #endif
  16. #define IL2CPP_BINARY_SECTION_NAME ".il2cpp"
  17. #if defined(SN_TARGET_PSP2)
  18. #define IL2CPP_TARGET_PSP2 1
  19. #define _UNICODE 1
  20. #define UNICODE 1
  21. #include "il2cpp-config-psp2.h"
  22. #elif defined(SN_TARGET_ORBIS)
  23. #define IL2CPP_TARGET_PS4 1
  24. #define _UNICODE 1
  25. #define UNICODE 1
  26. #elif defined(_MSC_VER)
  27. #define IL2CPP_TARGET_WINDOWS 1
  28. #if defined(_XBOX_ONE)
  29. #define IL2CPP_TARGET_XBOXONE 1
  30. #elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
  31. #define IL2CPP_TARGET_WINRT 1
  32. #else
  33. #define IL2CPP_TARGET_WINDOWS_DESKTOP 1
  34. #endif
  35. #define _UNICODE 1
  36. #define UNICODE 1
  37. #define STRICT 1
  38. #elif defined(__APPLE__)
  39. #define IL2CPP_TARGET_DARWIN 1
  40. #include "TargetConditionals.h"
  41. #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_TVOS_SIMULATOR
  42. #define IL2CPP_TARGET_IOS 1
  43. #endif
  44. #if IL2CPP_TARGET_IOS && !IL2CPP_TARGET_ARMV7
  45. #define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 1
  46. #endif
  47. #if IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
  48. // The following gives managed stack traces (even with bitcode App Store submission), but may cause linker
  49. // errors on ARMv7 builds.
  50. #define IL2CPP_METHOD_ATTR __attribute__((section ("__TEXT," IL2CPP_BINARY_SECTION_NAME ",regular,pure_instructions")))
  51. #endif
  52. #elif defined(__ANDROID__)
  53. #define IL2CPP_TARGET_ANDROID 1
  54. #elif defined(EMSCRIPTEN)
  55. #define IL2CPP_TARGET_JAVASCRIPT 1
  56. #elif defined(TIZEN)
  57. #define IL2CPP_TARGET_TIZEN 1
  58. #elif defined(__linux__)
  59. #define IL2CPP_TARGET_LINUX 1
  60. #elif defined(NN_PLATFORM_CTR)
  61. #define IL2CPP_TARGET_N3DS 1
  62. #elif defined(NN_BUILD_TARGET_PLATFORM_NX)
  63. #define IL2CPP_TARGET_SWITCH 1
  64. #else
  65. #error please define your target platform
  66. #endif
  67. #ifndef IL2CPP_TARGET_WINDOWS
  68. #define IL2CPP_TARGET_WINDOWS 0
  69. #endif
  70. #ifndef IL2CPP_TARGET_WINDOWS_DESKTOP
  71. #define IL2CPP_TARGET_WINDOWS_DESKTOP 0
  72. #endif
  73. #ifndef IL2CPP_TARGET_WINRT
  74. #define IL2CPP_TARGET_WINRT 0
  75. #endif
  76. #ifndef IL2CPP_TARGET_XBOXONE
  77. #define IL2CPP_TARGET_XBOXONE 0
  78. #endif
  79. #ifndef IL2CPP_TARGET_DARWIN
  80. #define IL2CPP_TARGET_DARWIN 0
  81. #endif
  82. #ifndef IL2CPP_TARGET_IOS
  83. #define IL2CPP_TARGET_IOS 0
  84. #endif
  85. #ifndef IL2CPP_TARGET_ANDROID
  86. #define IL2CPP_TARGET_ANDROID 0
  87. #endif
  88. #ifndef IL2CPP_TARGET_JAVASCRIPT
  89. #define IL2CPP_TARGET_JAVASCRIPT 0
  90. #endif
  91. #ifndef IL2CPP_TARGET_TIZEN
  92. #define IL2CPP_TARGET_TIZEN 0
  93. #endif
  94. #ifndef IL2CPP_TARGET_LINUX
  95. #define IL2CPP_TARGET_LINUX 0
  96. #endif
  97. #ifndef IL2CPP_TARGET_N3DS
  98. #define IL2CPP_TARGET_N3DS 0
  99. #endif
  100. #ifndef IL2CPP_TARGET_PS4
  101. #define IL2CPP_TARGET_PS4 0
  102. #endif
  103. #ifndef IL2CPP_TARGET_PSP2
  104. #define IL2CPP_TARGET_PSP2 0
  105. #endif
  106. #ifndef IL2CPP_TARGET_SWITCH
  107. #define IL2CPP_TARGET_SWITCH 0
  108. #endif
  109. #define IL2CPP_TARGET_POSIX (IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_JAVASCRIPT || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PSP2 || IL2CPP_TARGET_TIZEN)
  110. #define IL2CPP_SUPPORT_THREADS !IL2CPP_TARGET_JAVASCRIPT
  111. #ifndef IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
  112. #define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 0
  113. #endif
  114. #if IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINRT
  115. #include <crtdbg.h>
  116. #define IL2CPP_ASSERT(expr) \
  117. _ASSERTE(expr)
  118. #else
  119. #define IL2CPP_ASSERT(expr) \
  120. assert(expr)
  121. #endif
  122. /* Trigger assert if 'ptr' is not aligned to 'alignment'. */
  123. #define ASSERT_ALIGNMENT(ptr, alignment) \
  124. IL2CPP_ASSERT((((ptrdiff_t) ptr) & (alignment - 1)) == 0 && "Unaligned pointer!")
  125. #if defined(_MSC_VER)
  126. #if defined(_M_X64)
  127. #define IL2CPP_SIZEOF_VOID_P 8
  128. #elif defined(_M_IX86) || defined(_M_ARM)
  129. #define IL2CPP_SIZEOF_VOID_P 4
  130. #else
  131. #error invalid windows architecture
  132. #endif
  133. #elif defined(__GNUC__) || defined(__SNC__)
  134. #if defined(__x86_64__)
  135. #define IL2CPP_SIZEOF_VOID_P 8
  136. #elif defined(__i386__)
  137. #define IL2CPP_SIZEOF_VOID_P 4
  138. #elif defined(EMSCRIPTEN)
  139. #define IL2CPP_SIZEOF_VOID_P 4
  140. #elif defined(__arm__)
  141. #define IL2CPP_SIZEOF_VOID_P 4
  142. #elif defined(__arm64__) || defined(__aarch64__)
  143. #define IL2CPP_SIZEOF_VOID_P 8
  144. #else
  145. #error invalid windows architecture
  146. #endif
  147. #else
  148. #error please define your target architecture size
  149. #endif