Add initial bits for Qt6 support
[carla.git] / source / includes / vst3sdk / pluginterfaces / base / fplatform.h
blobdea70d0f794a7098f956f48164c7bb8be29bb7a5
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 //-----------------------------------------------------------------------------
17 #pragma once
19 #define kLittleEndian 0
20 #define kBigEndian 1
22 #undef PLUGIN_API
24 #if !defined (__INTEL_CXX11_MODE__)
25 #define SMTG_INTEL_CXX11_MODE 0
26 #else
27 #define SMTG_INTEL_CXX11_MODE __INTEL_CXX11_MODE__
28 #endif
30 #if !defined (__INTEL_COMPILER)
31 #define SMTG_INTEL_COMPILER 0
32 #else
33 #define SMTG_INTEL_COMPILER __INTEL_COMPILER
34 #endif
36 //-----------------------------------------------------------------------------
37 // WIN32 AND WIN64 (WINDOWS)
38 //-----------------------------------------------------------------------------
39 #if defined (_WIN32)
40 //-----------------------------------------------------------------------------
41 // ARM32 AND ARM64 (WINDOWS)
42 #if (defined(_M_ARM64) || defined(_M_ARM))
43 #define SMTG_OS_WINDOWS_ARM 1
44 #endif
46 #define SMTG_OS_LINUX 0
47 #define SMTG_OS_MACOS 0
48 #define SMTG_OS_WINDOWS 1
49 #define SMTG_OS_IOS 0
50 #define SMTG_OS_OSX 0
52 #define SMTG_CPU_X86 _M_IX86
53 #define SMTG_CPU_X86_64 _M_AMD64
54 #define SMTG_CPU_ARM (_M_ARM && !_M_ARM64)
55 #define SMTG_CPU_ARM_64 _M_ARM64
57 #define BYTEORDER kLittleEndian
59 #define COM_COMPATIBLE 1
60 #define PLUGIN_API __stdcall
61 #define SMTG_PTHREADS 0
63 #define SMTG_EXPORT_SYMBOL __declspec (dllexport)
65 #ifndef _CRT_SECURE_NO_WARNINGS
66 #define _CRT_SECURE_NO_WARNINGS
67 #endif
69 #ifdef _MSC_VER
70 #pragma warning (disable : 4244) // Conversion from 'type1' to 'type2', possible loss of data.
71 #pragma warning (disable : 4250) // Inheritance via dominance is allowed
72 #pragma warning (disable : 4996) // deprecated functions
74 #pragma warning (3 : 4189) // local variable is initialized but not referenced
75 #pragma warning (3 : 4238) // nonstandard extension used : class rvalue used as lvalue
76 #endif
78 #if defined (_WIN64) || defined (_M_ARM64)
79 #define SMTG_PLATFORM_64 1
80 #else
81 #define SMTG_PLATFORM_64 0
82 #endif
84 #ifndef WIN32
85 #define WIN32 1
86 #endif
88 #ifdef __cplusplus
89 #define SMTG_CPP11 __cplusplus >= 201103L || _MSC_VER > 1600 || SMTG_INTEL_CXX11_MODE
90 #define SMTG_CPP11_STDLIBSUPPORT SMTG_CPP11
91 #define SMTG_HAS_NOEXCEPT _MSC_VER >= 1900 || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER >= 1300)
92 #endif
94 #define SMTG_DEPRECATED_ATTRIBUTE(message) __declspec (deprecated ("Is Deprecated: " message))
95 //-----------------------------------------------------------------------------
96 // LINUX
97 //-----------------------------------------------------------------------------
98 #elif __gnu_linux__ || __linux__
99 #define SMTG_OS_LINUX 1
100 #define SMTG_OS_MACOS 0
101 #define SMTG_OS_WINDOWS 0
102 #define SMTG_OS_IOS 0
103 #define SMTG_OS_OSX 0
105 #define SMTG_CPU_X86 __i386__
106 #define SMTG_CPU_X86_64 __x86_64__
107 #define SMTG_CPU_ARM __arm__
108 #define SMTG_CPU_ARM_64 __aarch64__
110 #include <endian.h>
111 #if __BYTE_ORDER == __LITTLE_ENDIAN
112 #define BYTEORDER kLittleEndian
113 #else
114 #define BYTEORDER kBigEndian
115 #endif
117 #define COM_COMPATIBLE 0
118 #define PLUGIN_API
119 #define SMTG_PTHREADS 1
121 #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
123 #if __LP64__
124 #define SMTG_PLATFORM_64 1
125 #else
126 #define SMTG_PLATFORM_64 0
127 #endif
128 #ifdef __cplusplus
129 #include <cstddef>
130 #define SMTG_CPP11 (__cplusplus >= 201103L)
131 #ifndef SMTG_CPP11
132 #error unsupported compiler
133 #endif
134 #if defined(__GNUG__) && __GNUG__ < 8
135 #define SMTG_CPP11_STDLIBSUPPORT 0
136 #else
137 #define SMTG_CPP11_STDLIBSUPPORT 1
138 #endif
139 #define SMTG_HAS_NOEXCEPT 1
140 #endif
141 //-----------------------------------------------------------------------------
142 // Mac and iOS
143 //-----------------------------------------------------------------------------
144 #elif __APPLE__
145 #include <TargetConditionals.h>
146 #define SMTG_OS_LINUX 0
147 #define SMTG_OS_MACOS 1
148 #define SMTG_OS_WINDOWS 0
149 #define SMTG_OS_IOS TARGET_OS_IPHONE
150 #define SMTG_OS_OSX TARGET_OS_MAC && !TARGET_OS_IPHONE
152 #define SMTG_CPU_X86 TARGET_CPU_X86
153 #define SMTG_CPU_X86_64 TARGET_CPU_X86_64
154 #define SMTG_CPU_ARM TARGET_CPU_ARM
155 #define SMTG_CPU_ARM_64 TARGET_CPU_ARM64
157 #if !SMTG_OS_IOS
158 #ifndef __CF_USE_FRAMEWORK_INCLUDES__
159 #define __CF_USE_FRAMEWORK_INCLUDES__
160 #endif
161 #ifndef TARGET_API_MAC_CARBON
162 #define TARGET_API_MAC_CARBON 1
163 #endif
164 #endif
165 #if __LP64__
166 #define SMTG_PLATFORM_64 1
167 #else
168 #define SMTG_PLATFORM_64 0
169 #endif
170 #if defined (__BIG_ENDIAN__)
171 #define BYTEORDER kBigEndian
172 #else
173 #define BYTEORDER kLittleEndian
174 #endif
176 #define COM_COMPATIBLE 0
177 #define PLUGIN_API
178 #define SMTG_PTHREADS 1
180 #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
182 #if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS)
183 #ifdef __clang__
184 #pragma GCC diagnostic ignored "-Wswitch-enum"
185 #pragma GCC diagnostic ignored "-Wparentheses"
186 #pragma GCC diagnostic ignored "-Wuninitialized"
187 #if __clang_major__ >= 3
188 #pragma GCC diagnostic ignored "-Wtautological-compare"
189 #pragma GCC diagnostic ignored "-Wunused-value"
190 #if __clang_major__ >= 4 || __clang_minor__ >= 1
191 #pragma GCC diagnostic ignored "-Wswitch"
192 #pragma GCC diagnostic ignored "-Wcomment"
193 #endif
194 #if __clang_major__ >= 5
195 #pragma GCC diagnostic ignored "-Wunsequenced"
196 #if __clang_minor__ >= 1
197 #pragma GCC diagnostic ignored "-Wunused-const-variable"
198 #endif
199 #endif
200 #endif
201 #endif
202 #endif
203 #ifdef __cplusplus
204 #include <cstddef>
205 #define SMTG_CPP11 (__cplusplus >= 201103L || SMTG_INTEL_CXX11_MODE)
206 #if defined (_LIBCPP_VERSION) && SMTG_CPP11
207 #define SMTG_CPP11_STDLIBSUPPORT 1
208 #define SMTG_HAS_NOEXCEPT 1
209 #else
210 #define SMTG_CPP11_STDLIBSUPPORT 0
211 #define SMTG_HAS_NOEXCEPT 0
212 #endif
213 #endif
214 #else
215 #pragma error unknown platform
216 #endif
218 //-----------------------------------------------------------------------------
219 #if !SMTG_RENAME_ASSERT
220 #undef WINDOWS
221 #undef MAC
222 #undef PTHREADS
223 #undef PLATFORM_64
225 #if SMTG_OS_WINDOWS
226 #define WINDOWS SMTG_OS_WINDOWS
227 #endif
228 #if SMTG_OS_MACOS
229 #define MAC SMTG_OS_MACOS
230 #endif
231 #define PLATFORM_64 SMTG_PLATFORM_64
232 #define PTHREADS SMTG_PTHREADS
233 #endif
234 //-----------------------------------------------------------------------------
236 //-----------------------------------------------------------------------------
237 #if SMTG_CPP11
238 #define SMTG_OVERRIDE override
239 #define SMTG_CONSTEXPR constexpr
240 #else
241 #define SMTG_OVERRIDE
242 #define SMTG_CONSTEXPR
243 #endif
244 #if SMTG_HAS_NOEXCEPT
245 #define SMTG_NOEXCEPT noexcept
246 #else
247 #define SMTG_NOEXCEPT
248 #endif
250 //-----------------------------------------------------------------------------
251 // Deprecation setting
252 //-----------------------------------------------------------------------------
253 #ifndef SMTG_DEPRECATED_ATTRIBUTE
254 #define SMTG_DEPRECATED_ATTRIBUTE(msg)
255 #endif
257 #define SMTG_DEPRECATED_MSG(msg) SMTG_DEPRECATED_ATTRIBUTE(msg)
258 //-----------------------------------------------------------------------------