1 //-----------------------------------------------------------------------------
4 // Category : SDK Core Interfaces
5 // Filename : pluginterfaces/base/fplatform.h
6 // Created by : Steinberg, 01/2004
7 // Description : Detect platform and set define
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 //-----------------------------------------------------------------------------
19 #define kLittleEndian 0
24 #if !defined (__INTEL_CXX11_MODE__)
25 #define SMTG_INTEL_CXX11_MODE 0
27 #define SMTG_INTEL_CXX11_MODE __INTEL_CXX11_MODE__
30 #if !defined (__INTEL_COMPILER)
31 #define SMTG_INTEL_COMPILER 0
33 #define SMTG_INTEL_COMPILER __INTEL_COMPILER
36 //-----------------------------------------------------------------------------
37 // WIN32 AND WIN64 (WINDOWS)
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
41 // ARM32 AND ARM64 (WINDOWS)
42 #if (defined(_M_ARM64) || defined(_M_ARM))
43 #define SMTG_OS_WINDOWS_ARM 1
46 #define SMTG_OS_LINUX 0
47 #define SMTG_OS_MACOS 0
48 #define SMTG_OS_WINDOWS 1
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
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
78 #if defined (_WIN64) || defined (_M_ARM64)
79 #define SMTG_PLATFORM_64 1
81 #define SMTG_PLATFORM_64 0
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)
94 #define SMTG_DEPRECATED_ATTRIBUTE(message) __declspec (deprecated ("Is Deprecated: " message))
95 //-----------------------------------------------------------------------------
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__
111 #if __BYTE_ORDER == __LITTLE_ENDIAN
112 #define BYTEORDER kLittleEndian
114 #define BYTEORDER kBigEndian
117 #define COM_COMPATIBLE 0
119 #define SMTG_PTHREADS 1
121 #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
124 #define SMTG_PLATFORM_64 1
126 #define SMTG_PLATFORM_64 0
130 #define SMTG_CPP11 (__cplusplus >= 201103L)
132 #error unsupported compiler
134 #if defined(__GNUG__) && __GNUG__ < 8
135 #define SMTG_CPP11_STDLIBSUPPORT 0
137 #define SMTG_CPP11_STDLIBSUPPORT 1
139 #define SMTG_HAS_NOEXCEPT 1
141 //-----------------------------------------------------------------------------
143 //-----------------------------------------------------------------------------
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
158 #ifndef __CF_USE_FRAMEWORK_INCLUDES__
159 #define __CF_USE_FRAMEWORK_INCLUDES__
161 #ifndef TARGET_API_MAC_CARBON
162 #define TARGET_API_MAC_CARBON 1
166 #define SMTG_PLATFORM_64 1
168 #define SMTG_PLATFORM_64 0
170 #if defined (__BIG_ENDIAN__)
171 #define BYTEORDER kBigEndian
173 #define BYTEORDER kLittleEndian
176 #define COM_COMPATIBLE 0
178 #define SMTG_PTHREADS 1
180 #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
182 #if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS)
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"
194 #if __clang_major__ >= 5
195 #pragma GCC diagnostic ignored "-Wunsequenced"
196 #if __clang_minor__ >= 1
197 #pragma GCC diagnostic ignored "-Wunused-const-variable"
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
210 #define SMTG_CPP11_STDLIBSUPPORT 0
211 #define SMTG_HAS_NOEXCEPT 0
215 #pragma error unknown platform
218 //-----------------------------------------------------------------------------
219 #if !SMTG_RENAME_ASSERT
226 #define WINDOWS SMTG_OS_WINDOWS
229 #define MAC SMTG_OS_MACOS
231 #define PLATFORM_64 SMTG_PLATFORM_64
232 #define PTHREADS SMTG_PTHREADS
234 //-----------------------------------------------------------------------------
236 //-----------------------------------------------------------------------------
238 #define SMTG_OVERRIDE override
239 #define SMTG_CONSTEXPR constexpr
241 #define SMTG_OVERRIDE
242 #define SMTG_CONSTEXPR
244 #if SMTG_HAS_NOEXCEPT
245 #define SMTG_NOEXCEPT noexcept
247 #define SMTG_NOEXCEPT
250 //-----------------------------------------------------------------------------
251 // Deprecation setting
252 //-----------------------------------------------------------------------------
253 #ifndef SMTG_DEPRECATED_ATTRIBUTE
254 #define SMTG_DEPRECATED_ATTRIBUTE(msg)
257 #define SMTG_DEPRECATED_MSG(msg) SMTG_DEPRECATED_ATTRIBUTE(msg)
258 //-----------------------------------------------------------------------------