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-2012 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_APPLE_IOS 4 00040 #define OGRE_PLATFORM_ANDROID 5 00041 #define OGRE_PLATFORM_NACL 6 00042 00043 #define OGRE_COMPILER_MSVC 1 00044 #define OGRE_COMPILER_GNUC 2 00045 #define OGRE_COMPILER_BORL 3 00046 #define OGRE_COMPILER_WINSCW 4 00047 #define OGRE_COMPILER_GCCE 5 00048 #define OGRE_COMPILER_CLANG 6 00049 00050 #define OGRE_ENDIAN_LITTLE 1 00051 #define OGRE_ENDIAN_BIG 2 00052 00053 #define OGRE_ARCHITECTURE_32 1 00054 #define OGRE_ARCHITECTURE_64 2 00055 00056 /* Finds the compiler type and version. 00057 */ 00058 #if defined( __GCCE__ ) 00059 # define OGRE_COMPILER OGRE_COMPILER_GCCE 00060 # define OGRE_COMP_VER _MSC_VER 00061 //# include <staticlibinit_gcce.h> // This is a GCCE toolchain workaround needed when compiling with GCCE 00062 #elif defined( __WINSCW__ ) 00063 # define OGRE_COMPILER OGRE_COMPILER_WINSCW 00064 # define OGRE_COMP_VER _MSC_VER 00065 #elif defined( _MSC_VER ) 00066 # define OGRE_COMPILER OGRE_COMPILER_MSVC 00067 # define OGRE_COMP_VER _MSC_VER 00068 #elif defined( __clang__ ) 00069 # define OGRE_COMPILER OGRE_COMPILER_CLANG 00070 # define OGRE_COMP_VER (((__clang_major__)*100) + \ 00071 (__clang_minor__*10) + \ 00072 __clang_patchlevel__) 00073 #elif defined( __GNUC__ ) 00074 # define OGRE_COMPILER OGRE_COMPILER_GNUC 00075 # define OGRE_COMP_VER (((__GNUC__)*100) + \ 00076 (__GNUC_MINOR__*10) + \ 00077 __GNUC_PATCHLEVEL__) 00078 #elif defined( __BORLANDC__ ) 00079 # define OGRE_COMPILER OGRE_COMPILER_BORL 00080 # define OGRE_COMP_VER __BCPLUSPLUS__ 00081 # define __FUNCTION__ __FUNC__ 00082 #else 00083 # pragma error "No known compiler. Abort! Abort!" 00084 00085 #endif 00086 00087 /* See if we can use __forceinline or if we need to use __inline instead */ 00088 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00089 # if OGRE_COMP_VER >= 1200 00090 # define FORCEINLINE __forceinline 00091 # endif 00092 #elif defined(__MINGW32__) 00093 # if !defined(FORCEINLINE) 00094 # define FORCEINLINE __inline 00095 # endif 00096 #else 00097 # define FORCEINLINE __inline 00098 #endif 00099 00100 /* Finds the current platform */ 00101 00102 #if defined( __WIN32__ ) || defined( _WIN32 ) 00103 # define OGRE_PLATFORM OGRE_PLATFORM_WIN32 00104 #elif defined( __APPLE_CC__) 00105 // Device Simulator 00106 // Both requiring OS version 4.0 or greater 00107 # if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 40000 00108 # define OGRE_PLATFORM OGRE_PLATFORM_APPLE_IOS 00109 # else 00110 # define OGRE_PLATFORM OGRE_PLATFORM_APPLE 00111 # endif 00112 #elif defined(__ANDROID__) 00113 # define OGRE_PLATFORM OGRE_PLATFORM_ANDROID 00114 #elif defined( __native_client__ ) 00115 # define OGRE_PLATFORM OGRE_PLATFORM_NACL 00116 # ifndef OGRE_STATIC_LIB 00117 # error OGRE must be built as static for NaCl (OGRE_STATIC=true in CMake) 00118 # endif 00119 # ifdef OGRE_BUILD_RENDERSYSTEM_D3D9 00120 # error D3D9 is not supported on NaCl (OGRE_BUILD_RENDERSYSTEM_D3D9 false in CMake) 00121 # endif 00122 # ifdef OGRE_BUILD_RENDERSYSTEM_GL 00123 # error OpenGL is not supported on NaCl (OGRE_BUILD_RENDERSYSTEM_GL=false in CMake) 00124 # endif 00125 # ifndef OGRE_BUILD_RENDERSYSTEM_GLES2 00126 # error GLES2 render system is required for NaCl (OGRE_BUILD_RENDERSYSTEM_GLES2=false in CMake) 00127 # endif 00128 #else 00129 # define OGRE_PLATFORM OGRE_PLATFORM_LINUX 00130 #endif 00131 00132 /* Find the arch type */ 00133 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) 00134 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64 00135 #else 00136 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32 00137 #endif 00138 00139 // For generating compiler warnings - should work on any compiler 00140 // As a side note, if you start your message with 'Warning: ', the MSVC 00141 // IDE actually does catch a warning :) 00142 #define OGRE_QUOTE_INPLACE(x) # x 00143 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x) 00144 #define OGRE_WARN( x ) message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" ) 00145 00146 //---------------------------------------------------------------------------- 00147 // Windows Settings 00148 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 00149 00150 // If we're not including this from a client build, specify that the stuff 00151 // should get exported. Otherwise, import it. 00152 # if defined( OGRE_STATIC_LIB ) 00153 // Linux compilers don't have symbol import/export directives. 00154 # define _OgreExport 00155 # define _OgrePrivate 00156 # else 00157 # if defined( OGRE_NONCLIENT_BUILD ) 00158 # define _OgreExport __declspec( dllexport ) 00159 # else 00160 # if defined( __MINGW32__ ) 00161 # define _OgreExport 00162 # else 00163 # define _OgreExport __declspec( dllimport ) 00164 # endif 00165 # endif 00166 # define _OgrePrivate 00167 # endif 00168 // Win32 compilers use _DEBUG for specifying debug builds. 00169 // for MinGW, we set DEBUG 00170 # if defined(_DEBUG) || defined(DEBUG) 00171 # define OGRE_DEBUG_MODE 1 00172 # else 00173 # define OGRE_DEBUG_MODE 0 00174 # endif 00175 00176 // Disable unicode support on MingW for GCC 3, poorly supported in stdlibc++ 00177 // STLPORT fixes this though so allow if found 00178 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLBOX_UNICODE__ in _mingw.h 00179 // GCC 4 is also fine 00180 #if defined(__MINGW32__) 00181 # if OGRE_COMP_VER < 400 00182 # if !defined(_STLPORT_VERSION) 00183 # include<_mingw.h> 00184 # if defined(__MINGW32_TOOLBOX_UNICODE__) || OGRE_COMP_VER > 345 00185 # define OGRE_UNICODE_SUPPORT 1 00186 # else 00187 # define OGRE_UNICODE_SUPPORT 0 00188 # endif 00189 # else 00190 # define OGRE_UNICODE_SUPPORT 1 00191 # endif 00192 # else 00193 # define OGRE_UNICODE_SUPPORT 1 00194 # endif 00195 #else 00196 # define OGRE_UNICODE_SUPPORT 1 00197 #endif 00198 00199 #endif // OGRE_PLATFORM == OGRE_PLATFORM_WIN32 00200 00201 //---------------------------------------------------------------------------- 00202 // Android Settings 00203 /* 00204 #if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID 00205 # define _OgreExport 00206 # define OGRE_UNICODE_SUPPORT 1 00207 # define OGRE_DEBUG_MODE 0 00208 # define _OgrePrivate 00209 # define CLOCKS_PER_SEC 1000 00210 // 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 00211 # pragma warn_unusedarg off 00212 # pragma warn_emptydecl off 00213 # pragma warn_possunwant off 00214 // A quick define to overcome different names for the same function 00215 # define stricmp strcasecmp 00216 # ifdef DEBUG 00217 # define OGRE_DEBUG_MODE 1 00218 # else 00219 # define OGRE_DEBUG_MODE 0 00220 # endif 00221 #endif 00222 */ 00223 //---------------------------------------------------------------------------- 00224 // Linux/Apple/iOs/Android/NaCl Settings 00225 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS || \ 00226 OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_NACL 00227 00228 // Enable GCC symbol visibility 00229 # if defined( OGRE_GCC_VISIBILITY ) 00230 # define _OgreExport __attribute__ ((visibility("default"))) 00231 # define _OgrePrivate __attribute__ ((visibility("hidden"))) 00232 # else 00233 # define _OgreExport 00234 # define _OgrePrivate 00235 # endif 00236 00237 // A quick define to overcome different names for the same function 00238 # define stricmp strcasecmp 00239 00240 # ifdef DEBUG 00241 # define OGRE_DEBUG_MODE 1 00242 # else 00243 # define OGRE_DEBUG_MODE 0 00244 # endif 00245 00246 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 00247 #define OGRE_PLATFORM_LIB "OgrePlatform.bundle" 00248 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS 00249 #define OGRE_PLATFORM_LIB "OgrePlatform.a" 00250 #else //OGRE_PLATFORM_LINUX 00251 #define OGRE_PLATFORM_LIB "libOgrePlatform.so" 00252 #endif 00253 00254 // Always enable unicode support for the moment 00255 // Perhaps disable in old versions of gcc if necessary 00256 #define OGRE_UNICODE_SUPPORT 1 00257 00258 #endif 00259 00260 //---------------------------------------------------------------------------- 00261 // Endian Settings 00262 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly 00263 #ifdef OGRE_CONFIG_BIG_ENDIAN 00264 # define OGRE_ENDIAN OGRE_ENDIAN_BIG 00265 #else 00266 # define OGRE_ENDIAN OGRE_ENDIAN_LITTLE 00267 #endif 00268 00269 // Integer formats of fixed bit width 00270 typedef unsigned int uint32; 00271 typedef unsigned short uint16; 00272 typedef unsigned char uint8; 00273 typedef int int32; 00274 typedef short int16; 00275 typedef char int8; 00276 // define uint64 type 00277 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00278 typedef unsigned __int64 uint64; 00279 typedef __int64 int64; 00280 #else 00281 typedef unsigned long long uint64; 00282 typedef long long int64; 00283 #endif 00284 00285 00286 } 00287 00288 #endif
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:22