YSE sound engine  1.0
cross platform sound engine
 All Classes Namespaces Functions Pages
defines.hpp
1 /*
2  ==============================================================================
3 
4  defines.hpp
5  Created: 27 Jan 2014 7:16:58pm
6  Author: yvan
7 
8  ==============================================================================
9 */
10 
11 #ifndef DEFINES_HPP_INCLUDED
12 #define DEFINES_HPP_INCLUDED
13 
14 
15 #if (defined (_WIN32) || defined (_WIN64))
16 #define YSE_WIN32 1
17 #define YSE_WINDOWS 1
18 #elif defined (__ANDROID__)
19 #undef YSE_ANDROID
20 #define YSE_ANDROID 1
21 #elif defined (LINUX) || defined (__linux__)
22 #define YSE_LINUX 1
23 #elif defined (__APPLE_CPP__) || defined(__APPLE_CC__)
24 #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers)
25 #define Component CarbonDummyCompName
26 #include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
27 #undef Point
28 #undef Component
29 
30 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
31 #define YSE_IPHONE 1
32 #define YSE_IOS 1
33 #else
34 #define YSE_MAC 1
35 #endif
36 #elif defined (__FreeBSD__)
37 #define YSE_BSD 1
38 #else
39 #error "Unknown platform!"
40 #endif
41 
42 //==============================================================================
43 #if YSE_WINDOWS
44 #ifdef _MSC_VER
45 #ifdef _WIN64
46 #define YSE_64BIT 1
47 #else
48 #define YSE_32BIT 1
49 #endif
50 #endif
51 
52 #ifdef _DEBUG
53 #define YSE_DEBUG 1
54 #endif
55 
56 #ifdef __MINGW32__
57 #define YSE_MINGW 1
58 #ifdef __MINGW64__
59 #define YSE_64BIT 1
60 #else
61 #define YSE_32BIT 1
62 #endif
63 #endif
64 
66 #define YSE_LITTLE_ENDIAN 1
67 
68 #define YSE_INTEL 1
69 #endif
70 
71 //==============================================================================
72 #if YSE_MAC || YSE_IOS
73 
74 #if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
75 #define YSE_DEBUG 1
76 #endif
77 
78 #if ! (defined (DEBUG) || defined (_DEBUG) || defined (NDEBUG) || defined (_NDEBUG))
79 #warning "Neither NDEBUG or DEBUG has been defined - you should set one of these to make it clear whether this is a release build,"
80 #endif
81 
82 #ifdef __LITTLE_ENDIAN__
83 #define YSE_LITTLE_ENDIAN 1
84 #else
85 #define YSE_BIG_ENDIAN 1
86 #endif
87 
88 #ifdef __LP64__
89 #define YSE_64BIT 1
90 #else
91 #define YSE_32BIT 1
92 #endif
93 
94 #if defined (__ppc__) || defined (__ppc64__)
95 #define YSE_PPC 1
96 #elif defined (__arm__) || defined (__arm64__)
97 #define YSE_ARM 1
98 #else
99 #define YSE_INTEL 1
100 #endif
101 
102 #if YSE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
103 #error "Building for OSX 10.3 is no longer supported!"
104 #endif
105 
106 #if YSE_MAC && ! defined (MAC_OS_X_VERSION_10_5)
107 #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
108 #endif
109 #endif
110 
111 //==============================================================================
112 #if YSE_LINUX || YSE_ANDROID
113 
114 #ifdef _DEBUG
115 #define YSE_DEBUG 1
116 #endif
117 
118 // Allow override for big-endian Linux platforms
119 #if defined (__LITTLE_ENDIAN__) || ! defined (YSE_BIG_ENDIAN)
120 #define YSE_LITTLE_ENDIAN 1
121 #undef YSE_BIG_ENDIAN
122 #else
123 #undef YSE_LITTLE_ENDIAN
124 #define YSE_BIG_ENDIAN 1
125 #endif
126 
127 #if defined (__LP64__) || defined (_LP64)
128 #define YSE_64BIT 1
129 #else
130 #define YSE_32BIT 1
131 #endif
132 
133 #ifdef __arm__
134 #define YSE_ARM 1
135 #elif __MMX__ || __SSE__ || __amd64__
136 #define YSE_INTEL 1
137 #endif
138 #endif
139 
140 //==============================================================================
141 // Compiler type macros.
142 
143 #ifdef __clang__
144 #define YSE_CLANG 1
145 #define YSE_GCC 1
146 #elif defined (__GNUC__)
147 #define YSE_GCC 1
148 #elif defined (_MSC_VER)
149 #define YSE_MSVC 1
150 
151 #if _MSC_VER < 1500
152 #define YSE_VC8_OR_EARLIER 1
153 
154 #if _MSC_VER < 1400
155 #define YSE_VC7_OR_EARLIER 1
156 
157 #if _MSC_VER < 1300
158 #warning "MSVC 6.0 is no longer supported!"
159 #endif
160 #endif
161 #endif
162 
163 #if YSE_64BIT || ! YSE_VC7_OR_EARLIER
164 #define YSE_USE_INTRINSICS 1
165 #endif
166 #else
167 #error unknown compiler
168 #endif
169 
170 
171 //==============================================================================
172 // DLL building settings on Windows
173 #if YSE_MSVC
174 #ifdef YSE_DLL_BUILD
175 #define API __declspec (dllexport)
176 #define EXTERN
177 #pragma warning (disable: 4251)
178 #elif defined (YSE_DLL)
179 #define API __declspec (dllimport)
180 #define EXTERN extern
181 #pragma warning (disable: 4251)
182 #endif
183 #endif
184 
185 //==============================================================================
186 #ifndef API
187 #define API
188 #define EXTERN
189 #endif
190 
191 #if defined YSE_MAC || YSE_IOS
192 #include <TargetConditionals.h>
193 #endif
194 
195 #if defined YSE_WINDOWS
196 #define PLATFORM(windows, unix) windows
197 #else
198 #define PLATFORM(windows, unix) unix
199 #endif
200 
201 //===============================================================================
202 #define AUDIOBUFFER YSE::DSP::sample
203 #define MULTICHANNELBUFFER std::vector<DSP::sample>
204 
205 #endif // DEFINES_HPP_INCLUDED