Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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 #elif defined(__MINGW32__)
00074 #   if !defined(FORCEINLINE)
00075 #       define FORCEINLINE __inline
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 OGRE_PLATFORM_WIN32
00085 
00086 #elif defined( __APPLE_CC__)
00087 #   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
00088 
00089 #else
00090 #   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
00091 #endif
00092 
00093     /* Find the arch type */
00094 #if defined(__x86_64__) || defined(_M_X64)
00095 #   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
00096 #else
00097 #   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
00098 #endif
00099 
00100 // For generating compiler warnings - should work on any compiler
00101 // As a side note, if you start your message with 'Warning: ', the MSVC
00102 // IDE actually does catch a warning :)
00103 #define OGRE_QUOTE_INPLACE(x) # x
00104 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
00105 #define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00106 
00107 //----------------------------------------------------------------------------
00108 // Windows Settings
00109 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
00110 
00111 // If we're not including this from a client build, specify that the stuff
00112 // should get exported. Otherwise, import it.
00113 #   if defined( __MINGW32__ )
00114         // Linux compilers don't have symbol import/export directives.
00115 #       define _OgreExport
00116 #       define _OgrePrivate
00117 #   else
00118 #       if defined( OGRE_NONCLIENT_BUILD )
00119 #           define _OgreExport __declspec( dllexport )
00120 #       else
00121 #           define _OgreExport __declspec( dllimport )
00122 #       endif
00123 #       define _OgrePrivate
00124 #   endif
00125 // Win32 compilers use _DEBUG for specifying debug builds.
00126 #   ifdef _DEBUG
00127 #       define OGRE_DEBUG_MODE 1
00128 #   else
00129 #       define OGRE_DEBUG_MODE 0
00130 #   endif
00131 
00132 #if defined( __MINGW32__ )
00133     #define EXT_HASH
00134 #else
00135     #define snprintf _snprintf
00136     #define vsnprintf _vsnprintf
00137 #endif
00138 
00139 #if OGRE_DEBUG_MODE
00140     #define OGRE_PLATFORM_LIB "OgrePlatform_d.dll"
00141 #else
00142     #define OGRE_PLATFORM_LIB "OgrePlatform.dll"
00143 #endif
00144 
00145 #endif
00146 //----------------------------------------------------------------------------
00147 
00148 //----------------------------------------------------------------------------
00149 // Linux/Apple Settings
00150 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00151 
00152 // Enable GCC 4.0 symbol visibility
00153 #   if OGRE_COMP_VER >= 400
00154 #       define _OgreExport  __attribute__ ((visibility("default")))
00155 #       define _OgrePrivate __attribute__ ((visibility("hidden")))
00156 #   else
00157 #       define _OgreExport
00158 #       define _OgrePrivate
00159 #   endif
00160 
00161 // A quick define to overcome different names for the same function
00162 #   define stricmp strcasecmp
00163 
00164 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00165 // specifying a debug build.
00166 #   ifdef DEBUG
00167 #       define OGRE_DEBUG_MODE 1
00168 #   else
00169 #       define OGRE_DEBUG_MODE 0
00170 #   endif
00171 
00172 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00173     #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
00174 #else
00175     //OGRE_PLATFORM_LINUX
00176     #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
00177 #endif
00178 
00179 #endif
00180 
00181 //For apple, we always have a custom config.h file
00182 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00183 #    include "config.h"
00184 //SDL_main must be included in the file that contains
00185 //the application's main() function.
00186 #ifndef OGRE_NONCLIENT_BUILD
00187 #   include <SDL/SDL_main.h>
00188 #endif
00189 
00190 #endif
00191 
00192 //----------------------------------------------------------------------------
00193 
00194 //----------------------------------------------------------------------------
00195 // Endian Settings
00196 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
00197 #ifdef CONFIG_BIG_ENDIAN
00198 #    define OGRE_ENDIAN OGRE_ENDIAN_BIG
00199 #else
00200 #    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
00201 #endif
00202 
00203 // Integer formats of fixed bit width
00204 typedef unsigned int uint32;
00205 typedef unsigned short uint16;
00206 typedef unsigned char uint8;
00207 
00208 }
00209 
00210 #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 Jun 11 10:46:40 2006