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

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:33 2004