OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgrePlatform.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __Platform_H_
29 #define __Platform_H_
30 
31 #include "OgreConfig.h"
32 
33 namespace Ogre {
34 /* Initial platform/compiler-related stuff to set.
35 */
36 #define OGRE_PLATFORM_WIN32 1
37 #define OGRE_PLATFORM_LINUX 2
38 #define OGRE_PLATFORM_APPLE 3
39 #define OGRE_PLATFORM_SYMBIAN 4
40 #define OGRE_PLATFORM_IPHONE 5
41 
42 #define OGRE_COMPILER_MSVC 1
43 #define OGRE_COMPILER_GNUC 2
44 #define OGRE_COMPILER_BORL 3
45 #define OGRE_COMPILER_WINSCW 4
46 #define OGRE_COMPILER_GCCE 5
47 
48 #define OGRE_ENDIAN_LITTLE 1
49 #define OGRE_ENDIAN_BIG 2
50 
51 #define OGRE_ARCHITECTURE_32 1
52 #define OGRE_ARCHITECTURE_64 2
53 
54 /* Finds the compiler type and version.
55 */
56 #if defined( __GCCE__ )
57 # define OGRE_COMPILER OGRE_COMPILER_GCCE
58 # define OGRE_COMP_VER _MSC_VER
59 //# include <staticlibinit_gcce.h> // This is a GCCE toolchain workaround needed when compiling with GCCE
60 #elif defined( __WINSCW__ )
61 # define OGRE_COMPILER OGRE_COMPILER_WINSCW
62 # define OGRE_COMP_VER _MSC_VER
63 #elif defined( _MSC_VER )
64 # define OGRE_COMPILER OGRE_COMPILER_MSVC
65 # define OGRE_COMP_VER _MSC_VER
66 #elif defined( __GNUC__ )
67 # define OGRE_COMPILER OGRE_COMPILER_GNUC
68 # define OGRE_COMP_VER (((__GNUC__)*100) + \
69  (__GNUC_MINOR__*10) + \
70  __GNUC_PATCHLEVEL__)
71 
72 #elif defined( __BORLANDC__ )
73 # define OGRE_COMPILER OGRE_COMPILER_BORL
74 # define OGRE_COMP_VER __BCPLUSPLUS__
75 # define __FUNCTION__ __FUNC__
76 #else
77 # pragma error "No known compiler. Abort! Abort!"
78 
79 #endif
80 
81 /* See if we can use __forceinline or if we need to use __inline instead */
82 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
83 # if OGRE_COMP_VER >= 1200
84 # define FORCEINLINE __forceinline
85 # endif
86 #elif defined(__MINGW32__)
87 # if !defined(FORCEINLINE)
88 # define FORCEINLINE __inline
89 # endif
90 #else
91 # define FORCEINLINE __inline
92 #endif
93 
94 /* Finds the current platform */
95 
96 #if defined( __SYMBIAN32__ )
97 # define OGRE_PLATFORM OGRE_PLATFORM_SYMBIAN
98 #elif defined( __WIN32__ ) || defined( _WIN32 )
99 # define OGRE_PLATFORM OGRE_PLATFORM_WIN32
100 #elif defined( __APPLE_CC__)
101  // Device Simulator
102  // Both requiring OS version 3.0 or greater
103 # if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000
104 # define OGRE_PLATFORM OGRE_PLATFORM_IPHONE
105 # else
106 # define OGRE_PLATFORM OGRE_PLATFORM_APPLE
107 # endif
108 #else
109 # define OGRE_PLATFORM OGRE_PLATFORM_LINUX
110 #endif
111 
112  /* Find the arch type */
113 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
114 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
115 #else
116 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
117 #endif
118 
119 // For generating compiler warnings - should work on any compiler
120 // As a side note, if you start your message with 'Warning: ', the MSVC
121 // IDE actually does catch a warning :)
122 #define OGRE_QUOTE_INPLACE(x) # x
123 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
124 #define OGRE_WARN( x ) message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
125 
126 //----------------------------------------------------------------------------
127 // Windows Settings
128 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
129 
130 // If we're not including this from a client build, specify that the stuff
131 // should get exported. Otherwise, import it.
132 # if defined( OGRE_STATIC_LIB )
133  // Linux compilers don't have symbol import/export directives.
134 # define _OgreExport
135 # define _OgrePrivate
136 # else
137 # if defined( OGRE_NONCLIENT_BUILD )
138 # define _OgreExport __declspec( dllexport )
139 # else
140 # if defined( __MINGW32__ )
141 # define _OgreExport
142 # else
143 # define _OgreExport __declspec( dllimport )
144 # endif
145 # endif
146 # define _OgrePrivate
147 # endif
148 // Win32 compilers use _DEBUG for specifying debug builds.
149 // for MinGW, we set DEBUG
150 # if defined(_DEBUG) || defined(DEBUG)
151 # define OGRE_DEBUG_MODE 1
152 # else
153 # define OGRE_DEBUG_MODE 0
154 # endif
155 
156 // Disable unicode support on MingW for GCC 3, poorly supported in stdlibc++
157 // STLPORT fixes this though so allow if found
158 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLBOX_UNICODE__ in _mingw.h
159 // GCC 4 is also fine
160 #if defined(__MINGW32__)
161 # if OGRE_COMP_VER < 400
162 # if !defined(_STLPORT_VERSION)
163 # include<_mingw.h>
164 # if defined(__MINGW32_TOOLBOX_UNICODE__) || OGRE_COMP_VER > 345
165 # define OGRE_UNICODE_SUPPORT 1
166 # else
167 # define OGRE_UNICODE_SUPPORT 0
168 # endif
169 # else
170 # define OGRE_UNICODE_SUPPORT 1
171 # endif
172 # else
173 # define OGRE_UNICODE_SUPPORT 1
174 # endif
175 #else
176 # define OGRE_UNICODE_SUPPORT 1
177 #endif
178 
179 #endif // OGRE_PLATFORM == OGRE_PLATFORM_WIN32
180 
181 //----------------------------------------------------------------------------
182 // Symbian Settings
183 #if OGRE_PLATFORM == OGRE_PLATFORM_SYMBIAN
184 # define OGRE_UNICODE_SUPPORT 1
185 # define OGRE_DEBUG_MODE 0
186 # define _OgreExport
187 # define _OgrePrivate
188 # define CLOCKS_PER_SEC 1000
189 // pragma def were found here: http://www.inf.pucrs.br/~eduardob/disciplinas/SistEmbarcados/Mobile/Nokia/Tools/Carbide_vs/WINSCW/Help/PDF/C_Compilers_Reference_3.2.pdf
190 # pragma warn_unusedarg off
191 # pragma warn_emptydecl off
192 # pragma warn_possunwant off
193 #endif
194 //----------------------------------------------------------------------------
195 // Linux/Apple/Symbian Settings
196 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_IPHONE || OGRE_PLATFORM == OGRE_PLATFORM_SYMBIAN
197 
198 // Enable GCC symbol visibility
199 # if defined( OGRE_GCC_VISIBILITY )
200 # define _OgreExport __attribute__ ((visibility("default")))
201 # define _OgrePrivate __attribute__ ((visibility("hidden")))
202 # else
203 # define _OgreExport
204 # define _OgrePrivate
205 # endif
206 
207 // A quick define to overcome different names for the same function
208 # define stricmp strcasecmp
209 
210 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
211 // specifying a debug build.
212 // (??? this is wrong, on Linux debug builds aren't marked in any way unless
213 // you mark it yourself any way you like it -- zap ???)
214 # ifdef DEBUG
215 # define OGRE_DEBUG_MODE 1
216 # else
217 # define OGRE_DEBUG_MODE 0
218 # endif
219 
220 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
221  #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
222 #elif OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
223  #define OGRE_PLATFORM_LIB "OgrePlatform.a"
224 #else //OGRE_PLATFORM_LINUX
225  #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
226 #endif
227 
228 // Always enable unicode support for the moment
229 // Perhaps disable in old versions of gcc if necessary
230 #define OGRE_UNICODE_SUPPORT 1
231 
232 #endif
233 
234 //----------------------------------------------------------------------------
235 
236 //----------------------------------------------------------------------------
237 // Endian Settings
238 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
239 #ifdef OGRE_CONFIG_BIG_ENDIAN
240 # define OGRE_ENDIAN OGRE_ENDIAN_BIG
241 #else
242 # define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
243 #endif
244 
245 // Integer formats of fixed bit width
246 typedef unsigned int uint32;
247 typedef unsigned short uint16;
248 typedef unsigned char uint8;
249 typedef int int32;
250 typedef short int16;
251 typedef char int8;
252 // define uint64 type
253 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
254  typedef unsigned __int64 uint64;
255  typedef __int64 int64;
256 #else
257  typedef unsigned long long uint64;
258  typedef long long int64;
259 #endif
260 
261 
262 }
263 
264 #endif
unsigned char uint8
Definition: OgrePlatform.h:248
unsigned int uint32
Definition: OgrePlatform.h:246
long long int64
Definition: OgrePlatform.h:258
char int8
Definition: OgrePlatform.h:251
short int16
Definition: OgrePlatform.h:250
unsigned long long uint64
Definition: OgrePlatform.h:257
int int32
Definition: OgrePlatform.h:249
unsigned short uint16
Definition: OgrePlatform.h:247