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