00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2011 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 #ifndef __Platform_H_ 00029 #define __Platform_H_ 00030 00031 #include "OgreConfig.h" 00032 00033 namespace Ogre { 00034 /* Initial platform/compiler-related stuff to set. 00035 */ 00036 #define OGRE_PLATFORM_WIN32 1 00037 #define OGRE_PLATFORM_LINUX 2 00038 #define OGRE_PLATFORM_APPLE 3 00039 #define OGRE_PLATFORM_SYMBIAN 4 00040 #define OGRE_PLATFORM_IPHONE 5 00041 00042 #define OGRE_COMPILER_MSVC 1 00043 #define OGRE_COMPILER_GNUC 2 00044 #define OGRE_COMPILER_BORL 3 00045 #define OGRE_COMPILER_WINSCW 4 00046 #define OGRE_COMPILER_GCCE 5 00047 00048 #define OGRE_ENDIAN_LITTLE 1 00049 #define OGRE_ENDIAN_BIG 2 00050 00051 #define OGRE_ARCHITECTURE_32 1 00052 #define OGRE_ARCHITECTURE_64 2 00053 00054 /* Finds the compiler type and version. 00055 */ 00056 #if defined( __GCCE__ ) 00057 # define OGRE_COMPILER OGRE_COMPILER_GCCE 00058 # define OGRE_COMP_VER _MSC_VER 00059 //# include <staticlibinit_gcce.h> // This is a GCCE toolchain workaround needed when compiling with GCCE 00060 #elif defined( __WINSCW__ ) 00061 # define OGRE_COMPILER OGRE_COMPILER_WINSCW 00062 # define OGRE_COMP_VER _MSC_VER 00063 #elif defined( _MSC_VER ) 00064 # define OGRE_COMPILER OGRE_COMPILER_MSVC 00065 # define OGRE_COMP_VER _MSC_VER 00066 #elif defined( __GNUC__ ) 00067 # define OGRE_COMPILER OGRE_COMPILER_GNUC 00068 # define OGRE_COMP_VER (((__GNUC__)*100) + \ 00069 (__GNUC_MINOR__*10) + \ 00070 __GNUC_PATCHLEVEL__) 00071 00072 #elif defined( __BORLANDC__ ) 00073 # define OGRE_COMPILER OGRE_COMPILER_BORL 00074 # define OGRE_COMP_VER __BCPLUSPLUS__ 00075 # define __FUNCTION__ __FUNC__ 00076 #else 00077 # pragma error "No known compiler. Abort! Abort!" 00078 00079 #endif 00080 00081 /* See if we can use __forceinline or if we need to use __inline instead */ 00082 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00083 # if OGRE_COMP_VER >= 1200 00084 # define FORCEINLINE __forceinline 00085 # endif 00086 #elif defined(__MINGW32__) 00087 # if !defined(FORCEINLINE) 00088 # define FORCEINLINE __inline 00089 # endif 00090 #else 00091 # define FORCEINLINE __inline 00092 #endif 00093 00094 /* Finds the current platform */ 00095 00096 #if defined( __SYMBIAN32__ ) 00097 # define OGRE_PLATFORM OGRE_PLATFORM_SYMBIAN 00098 #elif defined( __WIN32__ ) || defined( _WIN32 ) 00099 # define OGRE_PLATFORM OGRE_PLATFORM_WIN32 00100 #elif defined( __APPLE_CC__) 00101 // Device Simulator 00102 // Both requiring OS version 3.0 or greater 00103 # if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000 00104 # define OGRE_PLATFORM OGRE_PLATFORM_IPHONE 00105 # else 00106 # define OGRE_PLATFORM OGRE_PLATFORM_APPLE 00107 # endif 00108 #else 00109 # define OGRE_PLATFORM OGRE_PLATFORM_LINUX 00110 #endif 00111 00112 /* Find the arch type */ 00113 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) 00114 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64 00115 #else 00116 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32 00117 #endif 00118 00119 // For generating compiler warnings - should work on any compiler 00120 // As a side note, if you start your message with 'Warning: ', the MSVC 00121 // IDE actually does catch a warning :) 00122 #define OGRE_QUOTE_INPLACE(x) # x 00123 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x) 00124 #define OGRE_WARN( x ) message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" ) 00125 00126 //---------------------------------------------------------------------------- 00127 // Windows Settings 00128 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 00129 00130 // If we're not including this from a client build, specify that the stuff 00131 // should get exported. Otherwise, import it. 00132 # if defined( OGRE_STATIC_LIB ) 00133 // Linux compilers don't have symbol import/export directives. 00134 # define _OgreExport 00135 # define _OgrePrivate 00136 # else 00137 # if defined( OGRE_NONCLIENT_BUILD ) 00138 # define _OgreExport __declspec( dllexport ) 00139 # else 00140 # if defined( __MINGW32__ ) 00141 # define _OgreExport 00142 # else 00143 # define _OgreExport __declspec( dllimport ) 00144 # endif 00145 # endif 00146 # define _OgrePrivate 00147 # endif 00148 // Win32 compilers use _DEBUG for specifying debug builds. 00149 // for MinGW, we set DEBUG 00150 # if defined(_DEBUG) || defined(DEBUG) 00151 # define OGRE_DEBUG_MODE 1 00152 # else 00153 # define OGRE_DEBUG_MODE 0 00154 # endif 00155 00156 // Disable unicode support on MingW for GCC 3, poorly supported in stdlibc++ 00157 // STLPORT fixes this though so allow if found 00158 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLBOX_UNICODE__ in _mingw.h 00159 // GCC 4 is also fine 00160 #if defined(__MINGW32__) 00161 # if OGRE_COMP_VER < 400 00162 # if !defined(_STLPORT_VERSION) 00163 # include<_mingw.h> 00164 # if defined(__MINGW32_TOOLBOX_UNICODE__) || OGRE_COMP_VER > 345 00165 # define OGRE_UNICODE_SUPPORT 1 00166 # else 00167 # define OGRE_UNICODE_SUPPORT 0 00168 # endif 00169 # else 00170 # define OGRE_UNICODE_SUPPORT 1 00171 # endif 00172 # else 00173 # define OGRE_UNICODE_SUPPORT 1 00174 # endif 00175 #else 00176 # define OGRE_UNICODE_SUPPORT 1 00177 #endif 00178 00179 #endif // OGRE_PLATFORM == OGRE_PLATFORM_WIN32 00180 00181 //---------------------------------------------------------------------------- 00182 // Symbian Settings 00183 #if OGRE_PLATFORM == OGRE_PLATFORM_SYMBIAN 00184 # define OGRE_UNICODE_SUPPORT 1 00185 # define OGRE_DEBUG_MODE 0 00186 # define _OgreExport 00187 # define _OgrePrivate 00188 # define CLOCKS_PER_SEC 1000 00189 // 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 00190 # pragma warn_unusedarg off 00191 # pragma warn_emptydecl off 00192 # pragma warn_possunwant off 00193 #endif 00194 //---------------------------------------------------------------------------- 00195 // Linux/Apple/Symbian Settings 00196 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_IPHONE || OGRE_PLATFORM == OGRE_PLATFORM_SYMBIAN 00197 00198 // Enable GCC symbol visibility 00199 # if defined( OGRE_GCC_VISIBILITY ) 00200 # define _OgreExport __attribute__ ((visibility("default"))) 00201 # define _OgrePrivate __attribute__ ((visibility("hidden"))) 00202 # else 00203 # define _OgreExport 00204 # define _OgrePrivate 00205 # endif 00206 00207 // A quick define to overcome different names for the same function 00208 # define stricmp strcasecmp 00209 00210 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when 00211 // specifying a debug build. 00212 // (??? this is wrong, on Linux debug builds aren't marked in any way unless 00213 // you mark it yourself any way you like it -- zap ???) 00214 # ifdef DEBUG 00215 # define OGRE_DEBUG_MODE 1 00216 # else 00217 # define OGRE_DEBUG_MODE 0 00218 # endif 00219 00220 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 00221 #define OGRE_PLATFORM_LIB "OgrePlatform.bundle" 00222 #elif OGRE_PLATFORM == OGRE_PLATFORM_IPHONE 00223 #define OGRE_PLATFORM_LIB "OgrePlatform.a" 00224 #else //OGRE_PLATFORM_LINUX 00225 #define OGRE_PLATFORM_LIB "libOgrePlatform.so" 00226 #endif 00227 00228 // Always enable unicode support for the moment 00229 // Perhaps disable in old versions of gcc if necessary 00230 #define OGRE_UNICODE_SUPPORT 1 00231 00232 #endif 00233 00234 //---------------------------------------------------------------------------- 00235 00236 //---------------------------------------------------------------------------- 00237 // Endian Settings 00238 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly 00239 #ifdef OGRE_CONFIG_BIG_ENDIAN 00240 # define OGRE_ENDIAN OGRE_ENDIAN_BIG 00241 #else 00242 # define OGRE_ENDIAN OGRE_ENDIAN_LITTLE 00243 #endif 00244 00245 // Integer formats of fixed bit width 00246 typedef unsigned int uint32; 00247 typedef unsigned short uint16; 00248 typedef unsigned char uint8; 00249 typedef int int32; 00250 typedef short int16; 00251 typedef char int8; 00252 // define uint64 type 00253 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00254 typedef unsigned __int64 uint64; 00255 typedef __int64 int64; 00256 #else 00257 typedef unsigned long long uint64; 00258 typedef long long int64; 00259 #endif 00260 00261 00262 } 00263 00264 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:43