KSSystemCapabilities.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // KSSystemCapabilities.h
  3. //
  4. // Copyright (c) 2012 Karl Stenerud. All rights reserved.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to deal
  8. // in the Software without restriction, including without limitation the rights
  9. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. // copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall remain in place
  14. // in this source code.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. // THE SOFTWARE.
  23. //
  24. #ifndef HDR_KSSystemCapabilities_h
  25. #define HDR_KSSystemCapabilities_h
  26. #ifdef __APPLE__
  27. #include <TargetConditionals.h>
  28. #define KSCRASH_HOST_APPLE 1
  29. #endif
  30. #ifdef __ANDROID__
  31. #define KSCRASH_HOST_ANDROID 1
  32. #endif
  33. #define KSCRASH_HOST_IOS (KSCRASH_HOST_APPLE && TARGET_OS_IOS)
  34. #define KSCRASH_HOST_TV (KSCRASH_HOST_APPLE && TARGET_OS_TV)
  35. #define KSCRASH_HOST_WATCH (KSCRASH_HOST_APPLE && TARGET_OS_WATCH)
  36. #define KSCRASH_HOST_MAC (KSCRASH_HOST_APPLE && TARGET_OS_MAC && !(TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH))
  37. #if KSCRASH_HOST_APPLE
  38. #define KSCRASH_CAN_GET_MAC_ADDRESS 1
  39. #else
  40. #define KSCRASH_CAN_GET_MAC_ADDRESS 0
  41. #endif
  42. #if KSCRASH_HOST_APPLE
  43. #define KSCRASH_HAS_OBJC 1
  44. #define KSCRASH_HAS_SWIFT 1
  45. #else
  46. #define KSCRASH_HAS_OBJC 0
  47. #define KSCRASH_HAS_SWIFT 0
  48. #endif
  49. #if KSCRASH_HOST_APPLE
  50. #define KSCRASH_HAS_KINFO_PROC 1
  51. #else
  52. #define KSCRASH_HAS_KINFO_PROC 0
  53. #endif
  54. #if KSCRASH_HOST_APPLE
  55. #define KSCRASH_HAS_STRNSTR 1
  56. #else
  57. #define KSCRASH_HAS_STRNSTR 0
  58. #endif
  59. #if KSCRASH_HOST_IOS || KSCRASH_HOST_TV || KSCRASH_HOST_WATCH
  60. #define KSCRASH_HAS_UIKIT 1
  61. #else
  62. #define KSCRASH_HAS_UIKIT 0
  63. #endif
  64. #if KSCRASH_HOST_IOS || KSCRASH_HOST_TV
  65. #define KSCRASH_HAS_UIAPPLICATION 1
  66. #else
  67. #define KSCRASH_HAS_UIAPPLICATION 0
  68. #endif
  69. #if KSCRASH_HOST_WATCH
  70. #define KSCRASH_HAS_NSEXTENSION 1
  71. #else
  72. #define KSCRASH_HAS_NSEXTENSION 0
  73. #endif
  74. #if KSCRASH_HOST_IOS
  75. #define KSCRASH_HAS_MESSAGEUI 1
  76. #else
  77. #define KSCRASH_HAS_MESSAGEUI 0
  78. #endif
  79. #if KSCRASH_HOST_IOS || KSCRASH_HOST_TV
  80. #define KSCRASH_HAS_UIDEVICE 1
  81. #else
  82. #define KSCRASH_HAS_UIDEVICE 0
  83. #endif
  84. #if KSCRASH_HOST_IOS || KSCRASH_HOST_MAC || KSCRASH_HOST_TV
  85. #define KSCRASH_HAS_ALERTVIEW 1
  86. #else
  87. #define KSCRASH_HAS_ALERTVIEW 0
  88. #endif
  89. #if KSCRASH_HOST_IOS
  90. #define KSCRASH_HAS_UIALERTVIEW 1
  91. #else
  92. #define KSCRASH_HAS_UIALERTVIEW 0
  93. #endif
  94. #if KSCRASH_HOST_TV
  95. #define KSCRASH_HAS_UIALERTCONTROLLER 1
  96. #else
  97. #define KSCRASH_HAS_UIALERTCONTROLLER 0
  98. #endif
  99. #if KSCRASH_HOST_MAC
  100. #define KSCRASH_HAS_NSALERT 1
  101. #else
  102. #define KSCRASH_HAS_NSALERT 0
  103. #endif
  104. #if KSCRASH_HOST_IOS || KSCRASH_HOST_MAC
  105. #define KSCRASH_HAS_MACH 1
  106. #else
  107. #define KSCRASH_HAS_MACH 0
  108. #endif
  109. // WatchOS signal is broken as of 3.1
  110. #if KSCRASH_HOST_ANDROID || KSCRASH_HOST_IOS || KSCRASH_HOST_MAC || KSCRASH_HOST_TV
  111. #define KSCRASH_HAS_SIGNAL 1
  112. #else
  113. #define KSCRASH_HAS_SIGNAL 0
  114. #endif
  115. #if KSCRASH_HOST_ANDROID || KSCRASH_HOST_MAC || KSCRASH_HOST_IOS
  116. #define KSCRASH_HAS_SIGNAL_STACK 1
  117. #else
  118. #define KSCRASH_HAS_SIGNAL_STACK 0
  119. #endif
  120. #if KSCRASH_HOST_MAC || KSCRASH_HOST_IOS || KSCRASH_HOST_TV
  121. #define KSCRASH_HAS_THREADS_API 1
  122. #else
  123. #define KSCRASH_HAS_THREADS_API 0
  124. #endif
  125. #if KSCRASH_HOST_MAC || KSCRASH_HOST_IOS || KSCRASH_HOST_TV
  126. #define KSCRASH_HAS_REACHABILITY 1
  127. #else
  128. #define KSCRASH_HAS_REACHABILITY 0
  129. #endif
  130. #endif // HDR_KSSystemCapabilities_h