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://ogre.sourceforge.net/
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 #elif defined( __APPLE_CC__)
00086 #   define OGRE_PLATFORM PLATFORM_APPLE
00087 #else
00088 #   define OGRE_PLATFORM PLATFORM_LINUX
00089 #endif
00090 
00091 // For generating compiler warnings - should work on any compiler
00092 // As a side note, if you start your message with 'Warning: ', the MSVC
00093 // IDE actually does catch a warning :)
00094 #define _QUOTE_INPLACE_(x) # x
00095 #define QUOTE(x) _QUOTE_INPLACE_(x)
00096 #define warn( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00097 
00098 //----------------------------------------------------------------------------
00099 // Windows Settings
00100 #if OGRE_PLATFORM == PLATFORM_WIN32
00101 
00102 // If we're not including this from a client build, specify that the stuff
00103 // should get exported. Otherwise, import it.
00104 #   if defined( OGRE_NONCLIENT_BUILD )
00105 #       define _OgreExport __declspec( dllexport )
00106 #   else
00107 #       define _OgreExport __declspec( dllimport )
00108 #   endif
00109 
00110 // Win32 compilers use _DEBUG for specifying debug builds.
00111 #   ifdef _DEBUG
00112 #       define OGRE_DEBUG_MODE 1
00113 #   else
00114 #       define OGRE_DEBUG_MODE 0
00115 #   endif
00116 
00117 // A quick define to overcome different names for the same function
00118 #   define snprintf _snprintf
00119 
00120 #endif
00121 //----------------------------------------------------------------------------
00122 
00123 //----------------------------------------------------------------------------
00124 // Linux/Apple Settings
00125 #if OGRE_PLATFORM == PLATFORM_LINUX || OGRE_PLATFORM == PLATFORM_APPLE
00126 
00127 // Linux compilers don't have symbol import/export directives.
00128 #   define _OgreExport
00129 
00130 // A quick define to overcome different names for the same function
00131 #   define stricmp strcasecmp
00132 
00133 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00134 // specifying a debug build.
00135 #   ifdef DEBUG
00136 #       define OGRE_DEBUG_MODE 1
00137 #   else
00138 #       define OGRE_DEBUG_MODE 0
00139 #   endif
00140 
00141 #endif
00142 //----------------------------------------------------------------------------
00143 
00144 //----------------------------------------------------------------------------
00145 // Endian Settings
00146 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
00147 #ifdef CONFIG_BIG_ENDIAN
00148 #    define OGRE_ENDIAN ENDIAN_BIG
00149 #else
00150 #    define OGRE_ENDIAN ENDIAN_LITTLE
00151 #endif
00152 
00153 
00154 #endif

Copyright © 2002 by The OGRE Team