Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class 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 (c) 2000-2005 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 namespace Ogre {
00031 /* Initial platform/compiler-related stuff to set.
00032 */
00033 #define OGRE_PLATFORM_WIN32 1
00034 #define OGRE_PLATFORM_LINUX 2
00035 #define OGRE_PLATFORM_APPLE 3
00036 
00037 #define OGRE_COMPILER_MSVC 1
00038 #define OGRE_COMPILER_GNUC 2
00039 #define OGRE_COMPILER_BORL 3
00040 
00041 #define OGRE_ENDIAN_LITTLE 1
00042 #define OGRE_ENDIAN_BIG 2
00043 
00044 /* Finds the compiler type and version.
00045 */
00046 #if defined( _MSC_VER )
00047 #   define OGRE_COMPILER OGRE_COMPILER_MSVC
00048 #   define OGRE_COMP_VER _MSC_VER
00049 
00050 #elif defined( __GNUC__ )
00051 #   define OGRE_COMPILER OGRE_COMPILER_GNUC
00052 #   define OGRE_COMP_VER (((__GNUC__)*100)+__GNUC_MINOR__)
00053 
00054 #elif defined( __BORLANDC__ )
00055 #   define OGRE_COMPILER OGRE_COMPILER_BORL
00056 #   define OGRE_COMP_VER __BCPLUSPLUS__
00057 
00058 #else
00059 #   pragma error "No known compiler. Abort! Abort!"
00060 
00061 #endif
00062 
00063 /* See if we can use __forceinline or if we need to use __inline instead */
00064 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 
00065 #   if OGRE_COMP_VER >= 1200
00066 #       define FORCEINLINE __forceinline
00067 #   endif
00068 #else
00069 #   define FORCEINLINE __inline
00070 #endif
00071 
00072 /* Finds the current platform */
00073 
00074 #if defined( __WIN32__ ) || defined( _WIN32 )
00075 #   define OGRE_PLATFORM OGRE_PLATFORM_WIN32
00076 
00077 #elif defined( __APPLE_CC__)
00078 #   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
00079 
00080 #else
00081 #   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
00082 #endif
00083 
00084 // For generating compiler warnings - should work on any compiler
00085 // As a side note, if you start your message with 'Warning: ', the MSVC
00086 // IDE actually does catch a warning :)
00087 #define OGRE_QUOTE_INPLACE(x) # x
00088 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
00089 #define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00090 
00091 //----------------------------------------------------------------------------
00092 // Windows Settings
00093 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
00094 
00095 // If we're not including this from a client build, specify that the stuff
00096 // should get exported. Otherwise, import it.
00097 #   if defined( __MINGW32__ )
00098         // Linux compilers don't have symbol import/export directives.
00099 #       define _OgreExport
00100 #   else
00101 #       if defined( OGRE_NONCLIENT_BUILD )
00102 #           define _OgreExport __declspec( dllexport )
00103 #       else
00104 #           define _OgreExport __declspec( dllimport )
00105 #       endif
00106 #   endif
00107 // Win32 compilers use _DEBUG for specifying debug builds.
00108 #   ifdef _DEBUG
00109 #       define OGRE_DEBUG_MODE 1
00110 #   else
00111 #       define OGRE_DEBUG_MODE 0
00112 #   endif
00113 
00114 #if defined( __MINGW32__ )
00115     #define GCC_3_1
00116     #define EXT_HASH
00117 #else
00118     #define snprintf _snprintf
00119     #define vsnprintf _vsnprintf
00120 #endif
00121 
00122 #if OGRE_DEBUG_MODE
00123     #define OGRE_PLATFORM_LIB "OgrePlatform_d.dll"
00124 #else
00125     #define OGRE_PLATFORM_LIB "OgrePlatform.dll"
00126 #endif
00127 
00128 #endif
00129 //----------------------------------------------------------------------------
00130 
00131 //----------------------------------------------------------------------------
00132 // Linux/Apple Settings
00133 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00134 
00135 // Linux compilers don't have symbol import/export directives.
00136 #   define _OgreExport
00137 
00138 // A quick define to overcome different names for the same function
00139 #   define stricmp strcasecmp
00140 
00141 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00142 // specifying a debug build.
00143 #   ifdef DEBUG
00144 #       define OGRE_DEBUG_MODE 1
00145 #   else
00146 #       define OGRE_DEBUG_MODE 0
00147 #   endif
00148 
00149 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00150     #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
00151 #else
00152     //OGRE_PLATFORM_LINUX
00153     #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
00154 #endif
00155 
00156 #endif
00157 
00158 //For apple, we always have a custom config.h file
00159 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00160 #    include "config.h"
00161 //SDL_main must be included in the file that contains
00162 //the application's main() function.
00163 #ifndef OGRE_NONCLIENT_BUILD
00164 #   include <SDL/SDL_main.h>
00165 #endif
00166 
00167 #endif
00168 
00169 //----------------------------------------------------------------------------
00170 
00171 //----------------------------------------------------------------------------
00172 // Endian Settings
00173 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
00174 #ifdef CONFIG_BIG_ENDIAN
00175 #    define OGRE_ENDIAN OGRE_ENDIAN_BIG
00176 #else
00177 #    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
00178 #endif
00179 
00180 // Integer formats of fixed bit width
00181 typedef unsigned int uint32;
00182 typedef unsigned short uint16;
00183 typedef unsigned char uint8;
00184 
00185 }
00186 
00187 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Wed Feb 23 00:19:11 2005