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.

259 lines
7.4KB

  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 SMTG_CPU_X86 _M_IX86
  45. #define SMTG_CPU_X86_64 _M_AMD64
  46. #define SMTG_CPU_ARM (_M_ARM && !_M_ARM64)
  47. #define SMTG_CPU_ARM_64 _M_ARM64
  48. #define BYTEORDER kLittleEndian
  49. #define COM_COMPATIBLE 1
  50. #define PLUGIN_API __stdcall
  51. #define SMTG_PTHREADS 0
  52. #define SMTG_EXPORT_SYMBOL __declspec (dllexport)
  53. #ifndef _CRT_SECURE_NO_WARNINGS
  54. #define _CRT_SECURE_NO_WARNINGS
  55. #endif
  56. #ifdef _MSC_VER
  57. #pragma warning (disable : 4244) // Conversion from 'type1' to 'type2', possible loss of data.
  58. #pragma warning (disable : 4250) // Inheritance via dominance is allowed
  59. #pragma warning (disable : 4996) // deprecated functions
  60. #pragma warning (3 : 4189) // local variable is initialized but not referenced
  61. #pragma warning (3 : 4238) // nonstandard extension used : class rvalue used as lvalue
  62. #endif
  63. #if defined (_WIN64) || defined (_M_ARM64)
  64. #define SMTG_PLATFORM_64 1
  65. #else
  66. #define SMTG_PLATFORM_64 0
  67. #endif
  68. #ifndef WIN32
  69. #define WIN32 1
  70. #endif
  71. #ifdef __cplusplus
  72. #define SMTG_CPP11 __cplusplus >= 201103L || _MSC_VER > 1600 || SMTG_INTEL_CXX11_MODE
  73. #define SMTG_CPP11_STDLIBSUPPORT SMTG_CPP11
  74. #define SMTG_HAS_NOEXCEPT _MSC_VER >= 1900 || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER >= 1300)
  75. #endif
  76. #define SMTG_DEPRECATED_ATTRIBUTE(message) __declspec (deprecated ("Is Deprecated: " message))
  77. //-----------------------------------------------------------------------------
  78. // LINUX
  79. //-----------------------------------------------------------------------------
  80. #elif __gnu_linux__ || __linux__
  81. #define SMTG_OS_LINUX 1
  82. #define SMTG_OS_MACOS 0
  83. #define SMTG_OS_WINDOWS 0
  84. #define SMTG_OS_IOS 0
  85. #define SMTG_OS_OSX 0
  86. #define SMTG_CPU_X86 __i386__
  87. #define SMTG_CPU_X86_64 __x86_64__
  88. #define SMTG_CPU_ARM __arm__
  89. #define SMTG_CPU_ARM_64 __aarch64__
  90. #include <endian.h>
  91. #if __BYTE_ORDER == __LITTLE_ENDIAN
  92. #define BYTEORDER kLittleEndian
  93. #else
  94. #define BYTEORDER kBigEndian
  95. #endif
  96. #define COM_COMPATIBLE 0
  97. #define PLUGIN_API
  98. #define SMTG_PTHREADS 1
  99. #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
  100. #if __LP64__
  101. #define SMTG_PLATFORM_64 1
  102. #else
  103. #define SMTG_PLATFORM_64 0
  104. #endif
  105. #ifdef __cplusplus
  106. #include <cstddef>
  107. #define SMTG_CPP11 (__cplusplus >= 201103L)
  108. #ifndef SMTG_CPP11
  109. #error unsupported compiler
  110. #endif
  111. #if defined(__GNUG__) && __GNUG__ < 8
  112. #define SMTG_CPP11_STDLIBSUPPORT 0
  113. #else
  114. #define SMTG_CPP11_STDLIBSUPPORT 1
  115. #endif
  116. #define SMTG_HAS_NOEXCEPT 1
  117. #endif
  118. //-----------------------------------------------------------------------------
  119. // Mac and iOS
  120. //-----------------------------------------------------------------------------
  121. #elif __APPLE__
  122. #include <TargetConditionals.h>
  123. #define SMTG_OS_LINUX 0
  124. #define SMTG_OS_MACOS 1
  125. #define SMTG_OS_WINDOWS 0
  126. #define SMTG_OS_IOS TARGET_OS_IPHONE
  127. #define SMTG_OS_OSX TARGET_OS_MAC && !TARGET_OS_IPHONE
  128. #define SMTG_CPU_X86 TARGET_CPU_X86
  129. #define SMTG_CPU_X86_64 TARGET_CPU_X86_64
  130. #define SMTG_CPU_ARM TARGET_CPU_ARM
  131. #define SMTG_CPU_ARM_64 TARGET_CPU_ARM64
  132. #if !SMTG_OS_IOS
  133. #ifndef __CF_USE_FRAMEWORK_INCLUDES__
  134. #define __CF_USE_FRAMEWORK_INCLUDES__
  135. #endif
  136. #ifndef TARGET_API_MAC_CARBON
  137. #define TARGET_API_MAC_CARBON 1
  138. #endif
  139. #endif
  140. #if __LP64__
  141. #define SMTG_PLATFORM_64 1
  142. #else
  143. #define SMTG_PLATFORM_64 0
  144. #endif
  145. #if defined (__BIG_ENDIAN__)
  146. #define BYTEORDER kBigEndian
  147. #else
  148. #define BYTEORDER kLittleEndian
  149. #endif
  150. #define COM_COMPATIBLE 0
  151. #define PLUGIN_API
  152. #define SMTG_PTHREADS 1
  153. #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
  154. #if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS)
  155. #ifdef __clang__
  156. #pragma GCC diagnostic ignored "-Wswitch-enum"
  157. #pragma GCC diagnostic ignored "-Wparentheses"
  158. #pragma GCC diagnostic ignored "-Wuninitialized"
  159. #if __clang_major__ >= 3
  160. #pragma GCC diagnostic ignored "-Wtautological-compare"
  161. #pragma GCC diagnostic ignored "-Wunused-value"
  162. #if __clang_major__ >= 4 || __clang_minor__ >= 1
  163. #pragma GCC diagnostic ignored "-Wswitch"
  164. #pragma GCC diagnostic ignored "-Wcomment"
  165. #endif
  166. #if __clang_major__ >= 5
  167. #pragma GCC diagnostic ignored "-Wunsequenced"
  168. #if __clang_minor__ >= 1
  169. #pragma GCC diagnostic ignored "-Wunused-const-variable"
  170. #endif
  171. #endif
  172. #endif
  173. #endif
  174. #endif
  175. #ifdef __cplusplus
  176. #include <cstddef>
  177. #define SMTG_CPP11 (__cplusplus >= 201103L || SMTG_INTEL_CXX11_MODE)
  178. #if defined (_LIBCPP_VERSION) && SMTG_CPP11
  179. #define SMTG_CPP11_STDLIBSUPPORT 1
  180. #define SMTG_HAS_NOEXCEPT 1
  181. #else
  182. #define SMTG_CPP11_STDLIBSUPPORT 0
  183. #define SMTG_HAS_NOEXCEPT 0
  184. #endif
  185. #endif
  186. #else
  187. #pragma error unknown platform
  188. #endif
  189. //-----------------------------------------------------------------------------
  190. #if !SMTG_RENAME_ASSERT
  191. #undef WINDOWS
  192. #undef MAC
  193. #undef PTHREADS
  194. #undef PLATFORM_64
  195. #if SMTG_OS_WINDOWS
  196. #define WINDOWS SMTG_OS_WINDOWS
  197. #endif
  198. #if SMTG_OS_MACOS
  199. #define MAC SMTG_OS_MACOS
  200. #endif
  201. #define PLATFORM_64 SMTG_PLATFORM_64
  202. #define PTHREADS SMTG_PTHREADS
  203. #endif
  204. //-----------------------------------------------------------------------------
  205. //-----------------------------------------------------------------------------
  206. #if SMTG_CPP11
  207. #define SMTG_OVERRIDE override
  208. #define SMTG_CONSTEXPR constexpr
  209. #else
  210. #define SMTG_OVERRIDE
  211. #define SMTG_CONSTEXPR
  212. #endif
  213. #if SMTG_HAS_NOEXCEPT
  214. #define SMTG_NOEXCEPT noexcept
  215. #else
  216. #define SMTG_NOEXCEPT
  217. #endif
  218. //-----------------------------------------------------------------------------
  219. // Deprecation setting
  220. //-----------------------------------------------------------------------------
  221. #ifndef SMTG_DEPRECATED_ATTRIBUTE
  222. #define SMTG_DEPRECATED_ATTRIBUTE(msg)
  223. #endif
  224. #define SMTG_DEPRECATED_MSG(msg) SMTG_DEPRECATED_ATTRIBUTE(msg)
  225. //-----------------------------------------------------------------------------