Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fplatform.h 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. //-----------------------------------------------------------------------------
  2. // Project : SDK Core
  3. //
  4. // Category : SDK Core Interfaces
  5. // Filename : pluginterfaces/base/fplatform.h
  6. // Created by : Steinberg, 01/2004
  7. // Description : Detect platform and set define
  8. //
  9. //-----------------------------------------------------------------------------
  10. // This file is part of a Steinberg SDK. It is subject to the license terms
  11. // in the LICENSE file found in the top-level directory of this distribution
  12. // and at www.steinberg.net/sdklicenses.
  13. // No part of the SDK, including this file, may be copied, modified, propagated,
  14. // or distributed except according to the terms contained in the LICENSE file.
  15. //-----------------------------------------------------------------------------
  16. #pragma once
  17. #define kLittleEndian 0
  18. #define kBigEndian 1
  19. #undef PLUGIN_API
  20. #if !defined (__INTEL_CXX11_MODE__)
  21. #define SMTG_INTEL_CXX11_MODE 0
  22. #else
  23. #define SMTG_INTEL_CXX11_MODE __INTEL_CXX11_MODE__
  24. #endif
  25. #if !defined (__INTEL_COMPILER)
  26. #define SMTG_INTEL_COMPILER 0
  27. #else
  28. #define SMTG_INTEL_COMPILER __INTEL_COMPILER
  29. #endif
  30. //-----------------------------------------------------------------------------
  31. // WIN32 AND WIN64 (WINDOWS)
  32. //-----------------------------------------------------------------------------
  33. #if defined (_WIN32)
  34. //-----------------------------------------------------------------------------
  35. // ARM32 AND ARM64 (WINDOWS)
  36. #if (defined(_M_ARM64) || defined(_M_ARM))
  37. #define SMTG_OS_WINDOWS_ARM 1
  38. #endif
  39. #define SMTG_OS_LINUX 0
  40. #define SMTG_OS_MACOS 0
  41. #define SMTG_OS_WINDOWS 1
  42. #define SMTG_OS_IOS 0
  43. #define SMTG_OS_OSX 0
  44. #define BYTEORDER kLittleEndian
  45. #define COM_COMPATIBLE 1
  46. #define PLUGIN_API __stdcall
  47. #define SMTG_PTHREADS 0
  48. #ifndef _CRT_SECURE_NO_WARNINGS
  49. #define _CRT_SECURE_NO_WARNINGS
  50. #endif
  51. #pragma warning (disable : 4244) // Conversion from 'type1' to 'type2', possible loss of data.
  52. #pragma warning (disable : 4250) // Inheritance via dominance is allowed
  53. #pragma warning (disable : 4996) // deprecated functions
  54. #pragma warning (3 : 4189) // local variable is initialized but not referenced
  55. #pragma warning (3 : 4238) // nonstandard extension used : class rvalue used as lvalue
  56. #if defined (_WIN64) || defined (_M_ARM64)
  57. #define SMTG_PLATFORM_64 1
  58. #else
  59. #define SMTG_PLATFORM_64 0
  60. #endif
  61. #ifndef WIN32
  62. #define WIN32 1
  63. #endif
  64. #ifdef __cplusplus
  65. #define SMTG_CPP11 __cplusplus >= 201103L || _MSC_VER > 1600 || SMTG_INTEL_CXX11_MODE
  66. #define SMTG_CPP11_STDLIBSUPPORT SMTG_CPP11
  67. #define SMTG_HAS_NOEXCEPT _MSC_VER >= 1900 || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER >= 1300)
  68. #endif
  69. #define SMTG_DEPRECATED_ATTRIBUTE(message) __declspec (deprecated ("Is Deprecated: " message))
  70. //-----------------------------------------------------------------------------
  71. // LINUX
  72. //-----------------------------------------------------------------------------
  73. #elif __gnu_linux__
  74. #define SMTG_OS_LINUX 1
  75. #define SMTG_OS_MACOS 0
  76. #define SMTG_OS_WINDOWS 0
  77. #define SMTG_OS_IOS 0
  78. #define SMTG_OS_OSX 0
  79. #include <endian.h>
  80. #if __BYTE_ORDER == __LITTLE_ENDIAN
  81. #define BYTEORDER kLittleEndian
  82. #else
  83. #define BYTEORDER kBigEndian
  84. #endif
  85. #define COM_COMPATIBLE 0
  86. #define PLUGIN_API
  87. #define SMTG_PTHREADS 1
  88. #if __LP64__
  89. #define SMTG_PLATFORM_64 1
  90. #else
  91. #define SMTG_PLATFORM_64 0
  92. #endif
  93. #ifdef __cplusplus
  94. #include <cstddef>
  95. #define SMTG_CPP11 (__cplusplus >= 201103L)
  96. #ifndef SMTG_CPP11
  97. #error unsupported compiler
  98. #endif
  99. #define SMTG_CPP11_STDLIBSUPPORT 1
  100. #define SMTG_HAS_NOEXCEPT 1
  101. #endif
  102. //-----------------------------------------------------------------------------
  103. // Mac and iOS
  104. //-----------------------------------------------------------------------------
  105. #elif __APPLE__
  106. #include <TargetConditionals.h>
  107. #define SMTG_OS_LINUX 0
  108. #define SMTG_OS_MACOS 1
  109. #define SMTG_OS_WINDOWS 0
  110. #define SMTG_OS_IOS TARGET_OS_IPHONE
  111. #define SMTG_OS_OSX TARGET_OS_MAC && !TARGET_OS_IPHONE
  112. #if !SMTG_OS_IOS
  113. #ifndef __CF_USE_FRAMEWORK_INCLUDES__
  114. #define __CF_USE_FRAMEWORK_INCLUDES__
  115. #endif
  116. #ifndef TARGET_API_MAC_CARBON
  117. #define TARGET_API_MAC_CARBON 1
  118. #endif
  119. #endif
  120. #if __LP64__
  121. #define SMTG_PLATFORM_64 1
  122. #else
  123. #define SMTG_PLATFORM_64 0
  124. #endif
  125. #if defined (__BIG_ENDIAN__)
  126. #define BYTEORDER kBigEndian
  127. #else
  128. #define BYTEORDER kLittleEndian
  129. #endif
  130. #define COM_COMPATIBLE 0
  131. #define PLUGIN_API
  132. #define SMTG_PTHREADS 1
  133. #if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS)
  134. #ifdef __clang__
  135. #pragma GCC diagnostic ignored "-Wswitch-enum"
  136. #pragma GCC diagnostic ignored "-Wparentheses"
  137. #pragma GCC diagnostic ignored "-Wuninitialized"
  138. #if __clang_major__ >= 3
  139. #pragma GCC diagnostic ignored "-Wtautological-compare"
  140. #pragma GCC diagnostic ignored "-Wunused-value"
  141. #if __clang_major__ >= 4 || __clang_minor__ >= 1
  142. #pragma GCC diagnostic ignored "-Wswitch"
  143. #pragma GCC diagnostic ignored "-Wcomment"
  144. #endif
  145. #if __clang_major__ >= 5
  146. #pragma GCC diagnostic ignored "-Wunsequenced"
  147. #if __clang_minor__ >= 1
  148. #pragma GCC diagnostic ignored "-Wunused-const-variable"
  149. #endif
  150. #endif
  151. #endif
  152. #endif
  153. #endif
  154. #ifdef __cplusplus
  155. #include <cstddef>
  156. #define SMTG_CPP11 (__cplusplus >= 201103L || SMTG_INTEL_CXX11_MODE)
  157. #if defined (_LIBCPP_VERSION) && SMTG_CPP11
  158. #define SMTG_CPP11_STDLIBSUPPORT 1
  159. #define SMTG_HAS_NOEXCEPT 1
  160. #else
  161. #define SMTG_CPP11_STDLIBSUPPORT 0
  162. #define SMTG_HAS_NOEXCEPT 0
  163. #endif
  164. #endif
  165. #else
  166. #pragma error unknown platform
  167. #endif
  168. //-----------------------------------------------------------------------------
  169. #if !SMTG_RENAME_ASSERT
  170. #undef WINDOWS
  171. #undef MAC
  172. #undef PTHREADS
  173. #undef PLATFORM_64
  174. #if SMTG_OS_WINDOWS
  175. #define WINDOWS SMTG_OS_WINDOWS
  176. #endif
  177. #if SMTG_OS_MACOS
  178. #define MAC SMTG_OS_MACOS
  179. #endif
  180. #define PLATFORM_64 SMTG_PLATFORM_64
  181. #define PTHREADS SMTG_PTHREADS
  182. #endif
  183. //-----------------------------------------------------------------------------
  184. //-----------------------------------------------------------------------------
  185. #if SMTG_CPP11
  186. #define SMTG_OVERRIDE override
  187. #else
  188. #define SMTG_OVERRIDE
  189. #endif
  190. #if SMTG_HAS_NOEXCEPT
  191. #define SMTG_NOEXCEPT noexcept
  192. #else
  193. #define SMTG_NOEXCEPT
  194. #endif
  195. //-----------------------------------------------------------------------------
  196. // Deprecation setting
  197. //-----------------------------------------------------------------------------
  198. #ifndef SMTG_DEPRECATED_ATTRIBUTE
  199. #define SMTG_DEPRECATED_ATTRIBUTE(msg)
  200. #endif
  201. #define SMTG_DEPRECATED_MSG(msg) SMTG_DEPRECATED_ATTRIBUTE(msg)
  202. //-----------------------------------------------------------------------------