Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgrePlatform.h

Go to the documentation of this file.
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 © 2000-2002 The OGRE Team
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 */
00025 #ifndef __Platform_H_
00026 #define __Platform_H_
00027 
00028 #include "OgreConfig.h"
00029 
00030 /* Initial platform/compiler-related stuff to set.
00031 */
00032 #define PLATFORM_WIN32 1
00033 #define PLATFORM_LINUX 2
00034 #define PLATFORM_APPLE 3
00035 
00036 #define COMPILER_MSVC 1
00037 #define COMPILER_GNUC 2
00038 #define COMPILER_BORL 3
00039 
00040 #define ENDIAN_LITTLE 1
00041 #define ENDIAN_BIG 2
00042 
00043 /* Finds the compiler type and version.
00044 */
00045 #if defined( _MSC_VER )
00046 #   define OGRE_COMPILER COMPILER_MSVC
00047 #   define OGRE_COMP_VER _MSC_VER
00048 
00049 #elif defined( __GNUC__ )
00050 #   define OGRE_COMPILER COMPILER_GNUC
00051 #   define OGRE_COMP_VER __VERSION__
00052 
00053 #elif defined( __BORLANDC__ )
00054 #   define OGRE_COMPILER COMPILER_BORL
00055 #   define OGRE_COMP_VER __BCPLUSPLUS__
00056 
00057 #else
00058 #   pragma error "No known compiler. Abort! Abort!"
00059 
00060 #endif
00061 
00062 /* Hack to get the release version of STLport 4.5.3 to compile when using
00063    the release build in VC7.   
00064 */
00065 #if OGRE_COMPILER == COMPILER_MSVC
00066     // Has to be nested because some compilers return strings for their version
00067 #   if OGRE_COMP_VER >= 1300
00068 #       define _STLP_LIB_BASENAME "stlport_vc7"
00069 #   endif
00070 #endif
00071 
00072 /* See if we can use __forceinline or if we need to use __inline instead */
00073 #if OGRE_COMPILER == COMPILER_MSVC 
00074 #   if OGRE_COMP_VER >= 1200
00075 #       define FORCEINLINE __forceinline
00076 #   endif
00077 #else
00078 #   define FORCEINLINE __inline
00079 #endif
00080 
00081 /* Finds the current platform */
00082 
00083 #if defined( __WIN32__ ) || defined( _WIN32 )
00084 #   define OGRE_PLATFORM PLATFORM_WIN32
00085 
00086 #elif defined( __APPLE_CC__)
00087 #   define OGRE_PLATFORM PLATFORM_APPLE
00088 
00089 #else
00090 #   define OGRE_PLATFORM PLATFORM_LINUX
00091 #endif
00092 
00093 // For generating compiler warnings - should work on any compiler
00094 // As a side note, if you start your message with 'Warning: ', the MSVC
00095 // IDE actually does catch a warning :)
00096 #define _QUOTE_INPLACE_(x) # x
00097 #define QUOTE(x) _QUOTE_INPLACE_(x)
00098 #define warn( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00099 
00100 //----------------------------------------------------------------------------
00101 // Windows Settings
00102 #if OGRE_PLATFORM == PLATFORM_WIN32
00103 
00104 // If we're not including this from a client build, specify that the stuff
00105 // should get exported. Otherwise, import it.
00106 #   if defined( OGRE_NONCLIENT_BUILD )
00107 #       define _OgreExport __declspec( dllexport )
00108 #   else
00109 #       define _OgreExport __declspec( dllimport )
00110 #   endif
00111 
00112 // Win32 compilers use _DEBUG for specifying debug builds.
00113 #   ifdef _DEBUG
00114 #       define OGRE_DEBUG_MODE 1
00115 #   else
00116 #       define OGRE_DEBUG_MODE 0
00117 #   endif
00118 
00119 // A quick define to overcome different names for the same function
00120 #   define snprintf _snprintf
00121 #   define vsnprintf _vsnprintf
00122 
00123 #endif
00124 //----------------------------------------------------------------------------
00125 
00126 //----------------------------------------------------------------------------
00127 // Linux/Apple Settings
00128 #if OGRE_PLATFORM == PLATFORM_LINUX || OGRE_PLATFORM == PLATFORM_APPLE
00129 
00130 // Linux compilers don't have symbol import/export directives.
00131 #   define _OgreExport
00132 
00133 // A quick define to overcome different names for the same function
00134 #   define stricmp strcasecmp
00135 
00136 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00137 // specifying a debug build.
00138 #   ifdef DEBUG
00139 #       define OGRE_DEBUG_MODE 1
00140 #   else
00141 #       define OGRE_DEBUG_MODE 0
00142 #   endif
00143 
00144 #endif
00145 
00146 //For apple, we always have a custom config.h file
00147 #if OGRE_PLATFORM == PLATFORM_APPLE
00148 #    include "config.h"
00149 //SDL_main must be included in the file that contains
00150 //the application's main() function.
00151 #   include <SDL/SDL_main.h>
00152 
00153 #endif
00154 
00155 //----------------------------------------------------------------------------
00156 
00157 //----------------------------------------------------------------------------
00158 // Endian Settings
00159 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
00160 #ifdef CONFIG_BIG_ENDIAN
00161 #    define OGRE_ENDIAN ENDIAN_BIG
00162 #else
00163 #    define OGRE_ENDIAN ENDIAN_LITTLE
00164 #endif
00165 
00166 
00167 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:21 2004