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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:46 2006