Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgrePlatform.h @ 151

Last change on this file since 151 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 14.6 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __Platform_H_
29#define __Platform_H_
30
31#include "OgreConfig.h"
32
33namespace 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_APPLE_IOS 4
40#define OGRE_PLATFORM_ANDROID 5
41#define OGRE_PLATFORM_NACL 6
42#define OGRE_PLATFORM_WINRT 7
43#define OGRE_PLATFORM_FLASHCC 8
44
45#define OGRE_COMPILER_MSVC 1
46#define OGRE_COMPILER_GNUC 2
47#define OGRE_COMPILER_BORL 3
48#define OGRE_COMPILER_WINSCW 4
49#define OGRE_COMPILER_GCCE 5
50#define OGRE_COMPILER_CLANG 6
51
52#define OGRE_ENDIAN_LITTLE 1
53#define OGRE_ENDIAN_BIG 2
54
55#define OGRE_ARCHITECTURE_32 1
56#define OGRE_ARCHITECTURE_64 2
57
58/* Finds the compiler type and version.
59*/
60#if (defined( __WIN32__ ) || defined( _WIN32 )) && defined(__ANDROID__) // We are using NVTegra
61#   define OGRE_COMPILER OGRE_COMPILER_GNUC
62#   define OGRE_COMP_VER 470
63#elif defined( __GCCE__ )
64#   define OGRE_COMPILER OGRE_COMPILER_GCCE
65#   define OGRE_COMP_VER _MSC_VER
66//#     include <staticlibinit_gcce.h> // This is a GCCE toolchain workaround needed when compiling with GCCE
67#elif defined( __WINSCW__ )
68#   define OGRE_COMPILER OGRE_COMPILER_WINSCW
69#   define OGRE_COMP_VER _MSC_VER
70#elif defined( _MSC_VER )
71#   define OGRE_COMPILER OGRE_COMPILER_MSVC
72#   define OGRE_COMP_VER _MSC_VER
73#elif defined( __clang__ )
74#   define OGRE_COMPILER OGRE_COMPILER_CLANG
75#   define OGRE_COMP_VER (((__clang_major__)*100) + \
76        (__clang_minor__*10) + \
77        __clang_patchlevel__)
78#elif defined( __GNUC__ )
79#   define OGRE_COMPILER OGRE_COMPILER_GNUC
80#   define OGRE_COMP_VER (((__GNUC__)*100) + \
81        (__GNUC_MINOR__*10) + \
82        __GNUC_PATCHLEVEL__)
83#elif defined( __BORLANDC__ )
84#   define OGRE_COMPILER OGRE_COMPILER_BORL
85#   define OGRE_COMP_VER __BCPLUSPLUS__
86#   define __FUNCTION__ __FUNC__
87#else
88#   pragma error "No known compiler. Abort! Abort!"
89
90#endif
91
92/* See if we can use __forceinline or if we need to use __inline instead */
93#if OGRE_COMPILER == OGRE_COMPILER_MSVC
94#   if OGRE_COMP_VER >= 1200
95#       define FORCEINLINE __forceinline
96#   endif
97#elif defined(__MINGW32__)
98#   if !defined(FORCEINLINE)
99#       define FORCEINLINE __inline
100#   endif
101#else
102#   define FORCEINLINE __inline
103#endif
104
105/* Finds the current platform */
106#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(__ANDROID__)
107#       if defined(WINAPI_FAMILY)
108#               define __OGRE_HAVE_DIRECTXMATH 1
109#               include <winapifamily.h>
110#               if WINAPI_FAMILY == WINAPI_FAMILY_APP|| WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
111#                       define DESKTOP_APP 1
112#                       define PHONE 2
113#                       define OGRE_PLATFORM OGRE_PLATFORM_WINRT
114#           ifndef _CRT_SECURE_NO_WARNINGS
115#               define _CRT_SECURE_NO_WARNINGS
116#           endif
117#           ifndef _SCL_SECURE_NO_WARNINGS
118#               define _SCL_SECURE_NO_WARNINGS
119#           endif
120#                       if WINAPI_FAMILY == WINAPI_FAMILY_APP
121#                               define OGRE_WINRT_TARGET_TYPE DESKTOP_APP
122#                       endif
123#                       if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
124#                               define OGRE_WINRT_TARGET_TYPE PHONE
125#                       endif
126#               else
127#                       define OGRE_PLATFORM OGRE_PLATFORM_WIN32
128#               endif
129#       else
130#               define OGRE_PLATFORM OGRE_PLATFORM_WIN32
131#       endif
132#elif defined(__FLASHCC__)
133#       define OGRE_PLATFORM OGRE_PLATFORM_FLASHCC
134#elif defined( __APPLE_CC__)
135#   ifndef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
136#       define __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ 0
137#   endif
138#   ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
139#       define __IPHONE_OS_VERSION_MIN_REQUIRED 0
140#   endif
141    // Device                                                     Simulator
142    // Both requiring OS version 6.0 or greater
143#   if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 60000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
144#       define OGRE_PLATFORM OGRE_PLATFORM_APPLE_IOS
145#   else
146#       define OGRE_PLATFORM OGRE_PLATFORM_APPLE
147#   endif
148#elif defined(__ANDROID__)
149#       define OGRE_PLATFORM OGRE_PLATFORM_ANDROID
150#elif defined( __native_client__ )
151#   define OGRE_PLATFORM OGRE_PLATFORM_NACL
152#   ifndef OGRE_STATIC_LIB
153#       error OGRE must be built as static for NaCl (OGRE_STATIC=true in CMake)
154#   endif
155#   ifdef OGRE_BUILD_RENDERSYSTEM_D3D9
156#       error D3D9 is not supported on NaCl (OGRE_BUILD_RENDERSYSTEM_D3D9 false in CMake)
157#   endif
158#   ifdef OGRE_BUILD_RENDERSYSTEM_GL
159#       error OpenGL is not supported on NaCl (OGRE_BUILD_RENDERSYSTEM_GL=false in CMake)
160#   endif
161#   ifndef OGRE_BUILD_RENDERSYSTEM_GLES2
162#       error GLES2 render system is required for NaCl (OGRE_BUILD_RENDERSYSTEM_GLES2=false in CMake)
163#   endif
164#else
165#   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
166#endif
167
168    /* Find the arch type */
169#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(_aarch64_) || defined(__mips64) || defined(__mips64_)
170#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
171#else
172#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
173#endif
174
175// For generating compiler warnings - should work on any compiler
176// As a side note, if you start your message with 'Warning: ', the MSVC
177// IDE actually does catch a warning :)
178#define OGRE_QUOTE_INPLACE(x) # x
179#define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
180#define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
181
182// For marking functions as deprecated
183#if OGRE_COMPILER == OGRE_COMPILER_MSVC
184#   define OGRE_DEPRECATED __declspec(deprecated)
185#elif OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG
186#   define OGRE_DEPRECATED __attribute__ ((deprecated))
187#else
188#   pragma message("WARNING: You need to implement OGRE_DEPRECATED for this compiler")
189#   define OGRE_DEPRECATED
190#endif
191
192//----------------------------------------------------------------------------
193// Windows Settings
194#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
195
196// If we're not including this from a client build, specify that the stuff
197// should get exported. Otherwise, import it.
198#       if defined( OGRE_STATIC_LIB )
199                // Linux compilers don't have symbol import/export directives.
200#       define _OgreExport
201#       define _OgrePrivate
202#   else
203#       if defined( OGRE_NONCLIENT_BUILD )
204#               define _OgreExport __declspec( dllexport )
205#       else
206#           if defined( __MINGW32__ )
207#               define _OgreExport
208#           else
209#                   define _OgreExport __declspec( dllimport )
210#           endif
211#       endif
212#       define _OgrePrivate
213#       endif
214// Win32 compilers use _DEBUG for specifying debug builds.
215// for MinGW, we set DEBUG
216#   if defined(_DEBUG) || defined(DEBUG)
217#       define OGRE_DEBUG_MODE 1
218#   else
219#       define OGRE_DEBUG_MODE 0
220#   endif
221
222// Disable unicode support on MingW for GCC 3, poorly supported in stdlibc++
223// STLPORT fixes this though so allow if found
224// MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLBOX_UNICODE__ in _mingw.h
225// GCC 4 is also fine
226#if defined(__MINGW32__)
227# if OGRE_COMP_VER < 400
228#  if !defined(_STLPORT_VERSION)
229#   include<_mingw.h>
230#   if defined(__MINGW32_TOOLBOX_UNICODE__) || OGRE_COMP_VER > 345
231#    define OGRE_UNICODE_SUPPORT 1
232#   else
233#    define OGRE_UNICODE_SUPPORT 0
234#   endif
235#  else
236#   define OGRE_UNICODE_SUPPORT 1
237#  endif
238# else
239#  define OGRE_UNICODE_SUPPORT 1
240# endif
241#else
242#  define OGRE_UNICODE_SUPPORT 1
243#endif
244
245#endif // OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
246
247//----------------------------------------------------------------------------
248// Linux/Apple/iOS/Android/NaCl Settings
249#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS || \
250    OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_NACL || OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
251
252// Enable GCC symbol visibility
253#   if defined( OGRE_GCC_VISIBILITY )
254#       define _OgreExport  __attribute__ ((visibility("default")))
255#       define _OgrePrivate __attribute__ ((visibility("hidden")))
256#   else
257#       define _OgreExport
258#       define _OgrePrivate
259#   endif
260
261// A quick define to overcome different names for the same function
262#   define stricmp strcasecmp
263
264#   ifdef DEBUG
265#       define OGRE_DEBUG_MODE 1
266#   else
267#       define OGRE_DEBUG_MODE 0
268#   endif
269
270// Always enable unicode support for the moment
271// Perhaps disable in old versions of gcc if necessary
272#define OGRE_UNICODE_SUPPORT 1
273
274#endif
275
276//----------------------------------------------------------------------------
277// Android Settings
278#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
279#   ifdef OGRE_UNICODE_SUPPORT
280#       undef OGRE_UNICODE_SUPPORT
281#   endif
282#       define OGRE_UNICODE_SUPPORT 1
283    // A quick define to overcome different names for the same function
284#   define stricmp strcasecmp
285#   ifdef DEBUG
286#       define OGRE_DEBUG_MODE 1
287#   else
288#       define OGRE_DEBUG_MODE 0
289#   endif
290#   ifndef CLOCKS_PER_SEC
291#           define CLOCKS_PER_SEC  1000
292#   endif
293#endif
294   
295//----------------------------------------------------------------------------
296// FlashCC Settings
297#if OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
298#   ifdef OGRE_UNICODE_SUPPORT
299#       undef OGRE_UNICODE_SUPPORT
300#   endif
301#       define OGRE_UNICODE_SUPPORT 0
302#   ifdef DEBUG
303#       define OGRE_DEBUG_MODE 1
304#   else
305#       define OGRE_DEBUG_MODE 0
306#   endif
307#endif
308
309#ifndef __OGRE_HAVE_DIRECTXMATH
310#   define __OGRE_HAVE_DIRECTXMATH 0
311#endif
312
313//----------------------------------------------------------------------------
314// Endian Settings
315// check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
316#ifdef OGRE_CONFIG_BIG_ENDIAN
317#    define OGRE_ENDIAN OGRE_ENDIAN_BIG
318#else
319#    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
320#endif
321
322//----------------------------------------------------------------------------
323// Set the default locale for strings
324#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
325//      Locales are not supported by the C lib you have to go through JNI.
326#       define OGRE_DEFAULT_LOCALE ""
327#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
328#       define OGRE_DEFAULT_LOCALE "C"
329#else
330#       if OGRE_COMPILER == OGRE_COMPILER_MSVC
331#               if _MSC_VER >= 1700
332#                       define OGRE_DEFAULT_LOCALE "en-GB"
333#               else
334//                      http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx
335#                       define OGRE_DEFAULT_LOCALE "uk"
336#               endif
337#       elif OGRE_COMPILER == OGRE_COMPILER_GCCE
338//              http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
339#       define OGRE_DEFAULT_LOCALE "en_GB.UTF8"
340#       else
341#       if OGRE_NO_LIBCPP_SUPPORT == 0
342#           define OGRE_DEFAULT_LOCALE "en_GB.UTF-8"
343#       else
344#           define OGRE_DEFAULT_LOCALE "C"
345#       endif
346#       endif
347#endif
348
349//----------------------------------------------------------------------------
350// Library suffixes
351// "_d" for debug builds, nothing otherwise
352#if OGRE_DEBUG_MODE
353#   define OGRE_BUILD_SUFFIX "_d"
354#else
355#   define OGRE_BUILD_SUFFIX ""
356#endif
357
358// Integer formats of fixed bit width
359typedef unsigned int uint32;
360typedef unsigned short uint16;
361typedef unsigned char uint8;
362typedef int int32;
363typedef short int16;
364typedef signed char int8;
365// define uint64 type
366#if OGRE_COMPILER == OGRE_COMPILER_MSVC
367        typedef unsigned __int64 uint64;
368        typedef __int64 int64;
369#else
370        typedef unsigned long long uint64;
371        typedef long long int64;
372#endif
373
374// Disable these warnings (too much noise)
375#if OGRE_COMPILER == OGRE_COMPILER_MSVC
376#ifndef _CRT_SECURE_NO_WARNINGS
377#   define _CRT_SECURE_NO_WARNINGS
378#endif
379#ifndef _SCL_SECURE_NO_WARNINGS
380#   define _SCL_SECURE_NO_WARNINGS
381#endif
382// Turn off warnings generated by long std templates
383// This warns about truncation to 255 characters in debug/browse info
384#   pragma warning (disable : 4786)
385// Turn off warnings generated by long std templates
386// This warns about truncation to 255 characters in debug/browse info
387#   pragma warning (disable : 4503)
388// disable: "<type> needs to have dll-interface to be used by clients'
389// Happens on STL member variables which are not public therefore is ok
390#   pragma warning (disable : 4251)
391// disable: "non dll-interface class used as base for dll-interface class"
392// Happens when deriving from Singleton because bug in compiler ignores
393// template export
394#   pragma warning (disable : 4275)
395// disable: "C++ Exception Specification ignored"
396// This is because MSVC 6 did not implement all the C++ exception
397// specifications in the ANSI C++ draft.
398#   pragma warning( disable : 4290 )
399// disable: "no suitable definition provided for explicit template
400// instantiation request" Occurs in VC7 for no justifiable reason on all
401// #includes of Singleton
402#   pragma warning( disable: 4661)
403// disable: deprecation warnings when using CRT calls in VC8
404// These show up on all C runtime lib code in VC8, disable since they clutter
405// the warnings with things we may not be able to do anything about (e.g.
406// generated code from nvparse etc). I doubt very much that these calls
407// will ever be actually removed from VC anyway, it would break too much code.
408#   pragma warning( disable: 4996)
409// disable: "conditional expression constant", always occurs on
410// OGRE_MUTEX_CONDITIONAL when no threading enabled
411#   pragma warning (disable : 201)
412// disable: "unreferenced formal parameter"
413// Many versions of VC have bugs which generate this error in cases where they shouldn't
414#   pragma warning (disable : 4100)
415// disable: "behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized"
416// We have this issue in OgreMemorySTLAlloc.h - so we see it over and over
417#   pragma warning (disable : 4345)
418#endif
419
420}
421
422#endif
Note: See TracBrowser for help on using the repository browser.