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-2006 Torus Knot Software Ltd 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 00024 You may alternatively use this source under the terms of a specific version of 00025 the OGRE Unrestricted License provided you have obtained such a license from 00026 Torus Knot Software Ltd. 00027 ----------------------------------------------------------------------------- 00028 */ 00029 #ifndef __Platform_H_ 00030 #define __Platform_H_ 00031 00032 #include "OgreConfig.h" 00033 00034 namespace Ogre { 00035 /* Initial platform/compiler-related stuff to set. 00036 */ 00037 #define OGRE_PLATFORM_WIN32 1 00038 #define OGRE_PLATFORM_LINUX 2 00039 #define OGRE_PLATFORM_APPLE 3 00040 00041 #define OGRE_COMPILER_MSVC 1 00042 #define OGRE_COMPILER_GNUC 2 00043 #define OGRE_COMPILER_BORL 3 00044 00045 #define OGRE_ENDIAN_LITTLE 1 00046 #define OGRE_ENDIAN_BIG 2 00047 00048 #define OGRE_ARCHITECTURE_32 1 00049 #define OGRE_ARCHITECTURE_64 2 00050 00051 /* Finds the compiler type and version. 00052 */ 00053 #if defined( _MSC_VER ) 00054 # define OGRE_COMPILER OGRE_COMPILER_MSVC 00055 # define OGRE_COMP_VER _MSC_VER 00056 00057 #elif defined( __GNUC__ ) 00058 # define OGRE_COMPILER OGRE_COMPILER_GNUC 00059 # define OGRE_COMP_VER (((__GNUC__)*100) + \ 00060 (__GNUC_MINOR__*10) + \ 00061 __GNUC_PATCHLEVEL__) 00062 00063 #elif defined( __BORLANDC__ ) 00064 # define OGRE_COMPILER OGRE_COMPILER_BORL 00065 # define OGRE_COMP_VER __BCPLUSPLUS__ 00066 00067 #else 00068 # pragma error "No known compiler. Abort! Abort!" 00069 00070 #endif 00071 00072 /* See if we can use __forceinline or if we need to use __inline instead */ 00073 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00074 # if OGRE_COMP_VER >= 1200 00075 # define FORCEINLINE __forceinline 00076 # endif 00077 #elif defined(__MINGW32__) 00078 # if !defined(FORCEINLINE) 00079 # define FORCEINLINE __inline 00080 # endif 00081 #else 00082 # define FORCEINLINE __inline 00083 #endif 00084 00085 /* Finds the current platform */ 00086 00087 #if defined( __WIN32__ ) || defined( _WIN32 ) 00088 # define OGRE_PLATFORM OGRE_PLATFORM_WIN32 00089 00090 #elif defined( __APPLE_CC__) 00091 # define OGRE_PLATFORM OGRE_PLATFORM_APPLE 00092 00093 #else 00094 # define OGRE_PLATFORM OGRE_PLATFORM_LINUX 00095 #endif 00096 00097 /* Find the arch type */ 00098 #if defined(__x86_64__) || defined(_M_X64) 00099 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64 00100 #else 00101 # define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32 00102 #endif 00103 00104 // For generating compiler warnings - should work on any compiler 00105 // As a side note, if you start your message with 'Warning: ', the MSVC 00106 // IDE actually does catch a warning :) 00107 #define OGRE_QUOTE_INPLACE(x) # x 00108 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x) 00109 #define OGRE_WARN( x ) message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" ) 00110 00111 //---------------------------------------------------------------------------- 00112 // Windows Settings 00113 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 00114 00115 // If we're not including this from a client build, specify that the stuff 00116 // should get exported. Otherwise, import it. 00117 # if defined( OGRE_STATIC_LIB ) 00118 // Linux compilers don't have symbol import/export directives. 00119 # define _OgreExport 00120 # define _OgrePrivate 00121 # else 00122 # if defined( OGRE_NONCLIENT_BUILD ) 00123 # define _OgreExport __declspec( dllexport ) 00124 # else 00125 # if defined( __MINGW32__ ) 00126 # define _OgreExport 00127 # else 00128 # define _OgreExport __declspec( dllimport ) 00129 # endif 00130 # endif 00131 # define _OgrePrivate 00132 # endif 00133 // Win32 compilers use _DEBUG for specifying debug builds. 00134 # ifdef _DEBUG 00135 # define OGRE_DEBUG_MODE 1 00136 # else 00137 # define OGRE_DEBUG_MODE 0 00138 # endif 00139 00140 #if !defined( __MINGW32__ ) 00141 #define snprintf _snprintf 00142 #define vsnprintf _vsnprintf 00143 #endif 00144 00145 // Disable unicode support on MingW at the moment, poorly supported in stdlibc++ 00146 // STLPORT fixes this though so allow if found 00147 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h 00148 #if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION) 00149 # include<_mingw.h> 00150 # if defined(__MINGW32_TOOLBOX_UNICODE__) 00151 # define OGRE_UNICODE_SUPPORT 1 00152 # else 00153 # define OGRE_UNICODE_SUPPORT 0 00154 # endif 00155 #else 00156 # define OGRE_UNICODE_SUPPORT 1 00157 #endif 00158 00159 #endif 00160 //---------------------------------------------------------------------------- 00161 00162 //---------------------------------------------------------------------------- 00163 // Linux/Apple Settings 00164 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE 00165 00166 // Enable GCC symbol visibility 00167 # if defined( OGRE_GCC_VISIBILITY ) 00168 # define _OgreExport __attribute__ ((visibility("default"))) 00169 # define _OgrePrivate __attribute__ ((visibility("hidden"))) 00170 # else 00171 # define _OgreExport 00172 # define _OgrePrivate 00173 # endif 00174 00175 // A quick define to overcome different names for the same function 00176 # define stricmp strcasecmp 00177 00178 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when 00179 // specifying a debug build. 00180 // (??? this is wrong, on Linux debug builds aren't marked in any way unless 00181 // you mark it yourself any way you like it -- zap ???) 00182 # ifdef DEBUG 00183 # define OGRE_DEBUG_MODE 1 00184 # else 00185 # define OGRE_DEBUG_MODE 0 00186 # endif 00187 00188 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 00189 #define OGRE_PLATFORM_LIB "OgrePlatform.bundle" 00190 #else 00191 //OGRE_PLATFORM_LINUX 00192 #define OGRE_PLATFORM_LIB "libOgrePlatform.so" 00193 #endif 00194 00195 // Always enable unicode support for the moment 00196 // Perhaps disable in old versions of gcc if necessary 00197 #define OGRE_UNICODE_SUPPORT 1 00198 00199 #endif 00200 00201 //For apple, we always have a custom config.h file 00202 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 00203 # include "config.h" 00204 #endif 00205 00206 //---------------------------------------------------------------------------- 00207 00208 //---------------------------------------------------------------------------- 00209 // Endian Settings 00210 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly 00211 #ifdef OGRE_CONFIG_BIG_ENDIAN 00212 # define OGRE_ENDIAN OGRE_ENDIAN_BIG 00213 #else 00214 # define OGRE_ENDIAN OGRE_ENDIAN_LITTLE 00215 #endif 00216 00217 // Integer formats of fixed bit width 00218 typedef unsigned int uint32; 00219 typedef unsigned short uint16; 00220 typedef unsigned char uint8; 00221 00222 } 00223 00224 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun May 6 10:54:22 2007