JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
fplatform.h
Go to the documentation of this file.
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
17#pragma once
18
19// values for BYTEORDER according to the used platform
20#define kLittleEndian 0
21#define kBigEndian 1
22
23#undef PLUGIN_API
24
25#if !defined (__INTEL_CXX11_MODE__)
26#define SMTG_INTEL_CXX11_MODE 0
27#else
28#define SMTG_INTEL_CXX11_MODE __INTEL_CXX11_MODE__
29#endif
30
31#if !defined (__INTEL_COMPILER)
32#define SMTG_INTEL_COMPILER 0
33#else
34#define SMTG_INTEL_COMPILER __INTEL_COMPILER
35#endif
36
37//-----------------------------------------------------------------------------
38// WIN32 AND WIN64 (WINDOWS)
39//-----------------------------------------------------------------------------
40#if defined (_WIN32)
41 //-----------------------------------------------------------------------------
42 #define SMTG_OS_LINUX 0
43 #define SMTG_OS_MACOS 0
44 #define SMTG_OS_WINDOWS 1
45 #define SMTG_OS_IOS 0
46 #define SMTG_OS_OSX 0
47
48 #if defined(_M_IX86)
49 #define SMTG_CPU_X86 1
50 #else
51 #define SMTG_CPU_X86 0
52 #endif
53 #if defined(_M_AMD64)
54 #define SMTG_CPU_X86_64 1
55 #else
56 #define SMTG_CPU_X86_64 0
57 #endif
58 #if defined(_M_ARM)
59 #define SMTG_CPU_ARM 1
60 #else
61 #define SMTG_CPU_ARM 0
62 #endif
63 #if defined(_M_ARM64)
64 #define SMTG_CPU_ARM_64 1
65 #else
66 #define SMTG_CPU_ARM_64 0
67 #endif
68 #if defined(_M_ARM64EC)
69 #define SMTG_CPU_ARM_64EC 1
70 #else
71 #define SMTG_CPU_ARM_64EC 0
72 #endif
73
74 #define SMTG_OS_WINDOWS_ARM (SMTG_CPU_ARM_64EC || SMTG_CPU_ARM_64 || SMTG_CPU_ARM)
75
76 #define BYTEORDER kLittleEndian
77
78 #define COM_COMPATIBLE 1
79 #define PLUGIN_API __stdcall
80 #define SMTG_PTHREADS 0
81
82 #define SMTG_EXPORT_SYMBOL __declspec (dllexport)
83 #define SMTG_HIDDEN_SYMBOL
84
85 #ifndef _CRT_SECURE_NO_WARNINGS
86 #define _CRT_SECURE_NO_WARNINGS
87 #endif
88
89 #ifdef _MSC_VER
90 #pragma warning (disable : 4244)
91 #pragma warning (disable : 4250)
92 #pragma warning (disable : 4996)
93
94 #pragma warning (3 : 4189)
95 #pragma warning (3 : 4238)
96 #endif
97
98 #if defined (_WIN64) || defined (_M_ARM64)
99 #define SMTG_PLATFORM_64 1
100 #else
101 #define SMTG_PLATFORM_64 0
102 #endif
103
104 #ifndef WIN32
105 #define WIN32 1
106 #endif
107
108 #ifdef __cplusplus
109 #define SMTG_CPP11 (__cplusplus >= 201103L || _MSC_VER > 1600 || SMTG_INTEL_CXX11_MODE)
110 #define SMTG_CPP11_STDLIBSUPPORT SMTG_CPP11
111 #define SMTG_CPP14 (__cplusplus >= 201402L || ((_MSC_FULL_VER >= 190024210L) && (_MSVC_LANG >= 201402L)))
112 #define SMTG_CPP17 (__cplusplus >= 201703L || ((_MSC_FULL_VER >= 190024210L) && (_MSVC_LANG >= 201703L)))
113 #define SMTG_CPP20 (__cplusplus >= 202002L)
114 #define SMTG_HAS_NOEXCEPT ((_MSC_FULL_VER >= 190023026L) || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER >= 1300))
115 #if ((_MSC_FULL_VER >= 190024210L) || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER >= 1500) || (defined(__MINGW32__) && SMTG_CPP11))
116 #define SMTG_HAS_CPP11_CONSTEXPR 1
117 #else
118 #define SMTG_HAS_CPP11_CONSTEXPR 0
119 #endif
120 #if (((_MSC_VER >= 1915L) && (_MSVC_LANG >= 201402L)) || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER > 1700) || (defined(__MINGW32__) && SMTG_CPP14))
121 #define SMTG_HAS_CPP14_CONSTEXPR 1
122 #else
123 #define SMTG_HAS_CPP14_CONSTEXPR 0
124 #endif
125 #endif //__cplusplus
126
127 #define SMTG_DEPRECATED_ATTRIBUTE(message) __declspec (deprecated ("Is Deprecated: " message))
128//-----------------------------------------------------------------------------
129// LINUX
130//-----------------------------------------------------------------------------
131#elif __gnu_linux__ || __linux__
132 #define SMTG_OS_LINUX 1
133 #define SMTG_OS_MACOS 0
134 #define SMTG_OS_WINDOWS 0
135 #define SMTG_OS_WINDOWS_ARM 0
136 #define SMTG_OS_IOS 0
137 #define SMTG_OS_OSX 0
138
139 #define SMTG_CPU_X86 __i386__
140 #define SMTG_CPU_X86_64 __x86_64__
141 #if defined(__arm__)
142 #define SMTG_CPU_ARM __arm__
143 #else
144 #define SMTG_CPU_ARM 0
145 #endif
146 #if defined(__aarch64__)
147 #define SMTG_CPU_ARM_64 __aarch64__
148 #else
149 #define SMTG_CPU_ARM_64 0
150 #endif
151 #define SMTG_CPU_ARM_64EC 0
152
153 #include <endian.h>
154 #if __BYTE_ORDER == __LITTLE_ENDIAN
155 #define BYTEORDER kLittleEndian
156 #else
157 #define BYTEORDER kBigEndian
158 #endif
159
160 #define COM_COMPATIBLE 0
161 #define PLUGIN_API
162 #define SMTG_PTHREADS 1
163
164 #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
165 #define SMTG_HIDDEN_SYMBOL __attribute__ ((visibility ("hidden")))
166
167 #if __LP64__
168 #define SMTG_PLATFORM_64 1
169 #else
170 #define SMTG_PLATFORM_64 0
171 #endif
172 #ifdef __cplusplus
173 #include <cstddef>
174 #define SMTG_CPP11 (__cplusplus >= 201103L)
175 #ifndef SMTG_CPP11
176 #error unsupported compiler
177 #endif
178 #define SMTG_CPP14 (__cplusplus >= 201402L)
179 #define SMTG_CPP17 (__cplusplus >= 201703L)
180 #define SMTG_CPP20 (__cplusplus >= 202002L)
181 #if defined(__GNUG__) && __GNUG__ < 8
182 #define SMTG_CPP11_STDLIBSUPPORT 0
183 #else
184 #define SMTG_CPP11_STDLIBSUPPORT 1
185 #endif
186 #define SMTG_HAS_NOEXCEPT 1
187 #define SMTG_HAS_CPP11_CONSTEXPR SMTG_CPP11
188 #define SMTG_HAS_CPP14_CONSTEXPR SMTG_CPP14
189 #endif // __cplusplus
190//-----------------------------------------------------------------------------
191// Mac and iOS
192//-----------------------------------------------------------------------------
193#elif __APPLE__
194 #include <TargetConditionals.h>
195 #define SMTG_OS_LINUX 0
196 #define SMTG_OS_MACOS 1
197 #define SMTG_OS_WINDOWS 0
198 #define SMTG_OS_WINDOWS_ARM 0
199 #define SMTG_OS_IOS TARGET_OS_IPHONE
200 #define SMTG_OS_OSX TARGET_OS_MAC && !TARGET_OS_IPHONE
201
202 #define SMTG_CPU_X86 TARGET_CPU_X86
203 #define SMTG_CPU_X86_64 TARGET_CPU_X86_64
204 #define SMTG_CPU_ARM TARGET_CPU_ARM
205 #define SMTG_CPU_ARM_64 TARGET_CPU_ARM64
206 #define SMTG_CPU_ARM_64EC 0
207
208 #if !SMTG_OS_IOS
209 #ifndef __CF_USE_FRAMEWORK_INCLUDES__
210 #define __CF_USE_FRAMEWORK_INCLUDES__
211 #endif
212 #ifndef TARGET_API_MAC_CARBON
213 #define TARGET_API_MAC_CARBON 1
214 #endif
215 #endif
216 #if __LP64__
217 #define SMTG_PLATFORM_64 1
218 #else
219 #define SMTG_PLATFORM_64 0
220 #endif
221 #if defined (__BIG_ENDIAN__)
222 #define BYTEORDER kBigEndian
223 #else
224 #define BYTEORDER kLittleEndian
225 #endif
226
227 #define COM_COMPATIBLE 0
228 #define PLUGIN_API
229 #define SMTG_PTHREADS 1
230
231 #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
232 #define SMTG_HIDDEN_SYMBOL __attribute__ ((visibility ("hidden")))
233
234 #if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS)
235 #ifdef __clang__
236 #pragma GCC diagnostic ignored "-Wswitch-enum"
237 #pragma GCC diagnostic ignored "-Wparentheses"
238 #pragma GCC diagnostic ignored "-Wuninitialized"
239 #if __clang_major__ >= 3
240 #pragma GCC diagnostic ignored "-Wtautological-compare"
241 #pragma GCC diagnostic ignored "-Wunused-value"
242 #if __clang_major__ >= 4 || __clang_minor__ >= 1
243 #pragma GCC diagnostic ignored "-Wswitch"
244 #pragma GCC diagnostic ignored "-Wcomment"
245 #endif
246 #if __clang_major__ >= 5
247 #pragma GCC diagnostic ignored "-Wunsequenced"
248 #if __clang_minor__ >= 1
249 #pragma GCC diagnostic ignored "-Wunused-const-variable"
250 #endif
251 #endif
252 #endif
253 #endif
254 #endif
255 #ifdef __cplusplus
256 #include <cstddef>
257 #define SMTG_CPP11 (__cplusplus >= 201103L || SMTG_INTEL_CXX11_MODE)
258 #define SMTG_CPP14 (__cplusplus >= 201402L)
259 #define SMTG_CPP17 (__cplusplus >= 201703L)
260 #define SMTG_CPP20 (__cplusplus >= 202002L)
261 #if defined (_LIBCPP_VERSION) && SMTG_CPP11
262 #define SMTG_CPP11_STDLIBSUPPORT 1
263 #define SMTG_HAS_NOEXCEPT 1
264 #else
265 #define SMTG_CPP11_STDLIBSUPPORT 0
266 #define SMTG_HAS_NOEXCEPT 0
267 #endif
268 #define SMTG_HAS_CPP11_CONSTEXPR SMTG_CPP11
269 #define SMTG_HAS_CPP14_CONSTEXPR SMTG_CPP14
270 #endif // __cplusplus
271//-----------------------------------------------------------------------------
272// Unknown Platform
273//-----------------------------------------------------------------------------
274#else
275 #pragma error unknown platform
276#endif
277
278//-----------------------------------------------------------------------------
279#if !SMTG_RENAME_ASSERT
280#undef WINDOWS
281#undef MAC
282#undef PTHREADS
283#undef PLATFORM_64
284
285#if SMTG_OS_WINDOWS
286#define WINDOWS SMTG_OS_WINDOWS
287#endif
288#if SMTG_OS_MACOS
289#define MAC SMTG_OS_MACOS
290#endif
291#define PLATFORM_64 SMTG_PLATFORM_64
292#define PTHREADS SMTG_PTHREADS
293#endif
294//-----------------------------------------------------------------------------
295
296//-----------------------------------------------------------------------------
297#if SMTG_CPP11
298#define SMTG_OVERRIDE override
299#else
300#define SMTG_OVERRIDE
301#endif
302
303#if SMTG_HAS_CPP11_CONSTEXPR
304#define SMTG_CONSTEXPR constexpr
305#else
306#define SMTG_CONSTEXPR
307#endif
308
309#if SMTG_HAS_CPP14_CONSTEXPR
310#define SMTG_CONSTEXPR14 constexpr
311#else
312#define SMTG_CONSTEXPR14
313#endif
314
315#if SMTG_HAS_NOEXCEPT
316#define SMTG_NOEXCEPT noexcept
317#else
318#define SMTG_NOEXCEPT
319#endif
320
321//-----------------------------------------------------------------------------
322// Deprecation setting
323//-----------------------------------------------------------------------------
324#ifndef SMTG_DEPRECATED_ATTRIBUTE
325#define SMTG_DEPRECATED_ATTRIBUTE(msg)
326#endif
327
328#define SMTG_DEPRECATED_MSG(msg) SMTG_DEPRECATED_ATTRIBUTE(msg)
329//-----------------------------------------------------------------------------