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 (__GNUC__ * 10000 \
00052                           + __GNUC_MINOR__ * 100 \
00053                           +__GNUC_PATCHLEVEL__)
00054 
00055 #elif defined( __BORLANDC__ )
00056 #   define OGRE_COMPILER COMPILER_BORL
00057 #   define OGRE_COMP_VER __BCPLUSPLUS__
00058 
00059 #else
00060 #   pragma error "No known compiler. Abort! Abort!"
00061 
00062 #endif
00063 
00064 /* See if we can use __forceinline or if we need to use __inline instead */
00065 #if OGRE_COMPILER == COMPILER_MSVC 
00066 #   if OGRE_COMP_VER >= 1200
00067 #       define FORCEINLINE __forceinline
00068 #   endif
00069 #else
00070 #   define FORCEINLINE __inline
00071 #endif
00072 
00073 /* Finds the current platform */
00074 
00075 #if defined( __WIN32__ ) || defined( _WIN32 )
00076 #   define OGRE_PLATFORM PLATFORM_WIN32
00077 
00078 #elif defined( __APPLE_CC__)
00079 #   define OGRE_PLATFORM PLATFORM_APPLE
00080 
00081 #else
00082 #   define OGRE_PLATFORM PLATFORM_LINUX
00083 #endif
00084 
00085 // For generating compiler warnings - should work on any compiler
00086 // As a side note, if you start your message with 'Warning: ', the MSVC
00087 // IDE actually does catch a warning :)
00088 #define _QUOTE_INPLACE_(x) # x
00089 #define QUOTE(x) _QUOTE_INPLACE_(x)
00090 #define warn( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00091 
00092 //----------------------------------------------------------------------------
00093 // Windows Settings
00094 #if OGRE_PLATFORM == PLATFORM_WIN32
00095 
00096 // If we're not including this from a client build, specify that the stuff
00097 // should get exported. Otherwise, import it.
00098 #   if defined( OGRE_NONCLIENT_BUILD )
00099 #       define _OgreExport __declspec( dllexport )
00100 #   else
00101 #       define _OgreExport __declspec( dllimport )
00102 #   endif
00103 
00104 // Win32 compilers use _DEBUG for specifying debug builds.
00105 #   ifdef _DEBUG
00106 #       define OGRE_DEBUG_MODE 1
00107 #   else
00108 #       define OGRE_DEBUG_MODE 0
00109 #   endif
00110 
00111 #if defined( __MINGW32__ )
00112     #define GCC_3_1
00113     #define EXT_HASH
00114 #else
00115     #define snprintf _snprintf
00116     #define vsnprintf _vsnprintf
00117 #endif
00118 
00119 #endif
00120 //----------------------------------------------------------------------------
00121 
00122 //----------------------------------------------------------------------------
00123 // Linux/Apple Settings
00124 #if OGRE_PLATFORM == PLATFORM_LINUX || OGRE_PLATFORM == PLATFORM_APPLE
00125 
00126 // Linux compilers don't have symbol import/export directives.
00127 #   define _OgreExport
00128 
00129 // A quick define to overcome different names for the same function
00130 #   define stricmp strcasecmp
00131 
00132 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00133 // specifying a debug build.
00134 #   ifdef DEBUG
00135 #       define OGRE_DEBUG_MODE 1
00136 #   else
00137 #       define OGRE_DEBUG_MODE 0
00138 #   endif
00139 
00140 #endif
00141 
00142 //For apple, we always have a custom config.h file
00143 #if OGRE_PLATFORM == PLATFORM_APPLE
00144 #    include "config.h"
00145 //SDL_main must be included in the file that contains
00146 //the application's main() function.
00147 #ifndef OGRE_NONCLIENT_BUILD
00148 #   include <SDL/SDL_main.h>
00149 #endif
00150 
00151 #endif
00152 
00153 //----------------------------------------------------------------------------
00154 
00155 //----------------------------------------------------------------------------
00156 // Endian Settings
00157 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
00158 #ifdef CONFIG_BIG_ENDIAN
00159 #    define OGRE_ENDIAN ENDIAN_BIG
00160 #else
00161 #    define OGRE_ENDIAN ENDIAN_LITTLE
00162 #endif
00163 
00164 
00165 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:39 2004