OGRE: OgrePlatform.h Source File - OGRE Documentation

# 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-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __Platform_H_
    00030 #define __Platform_H_
    00031
    00032 #include "OgreConfig.h"
    00033
    00034 namespace Ogre {
    00035 /* Initial platform/compiler-related stuff to set.
    00036 */
    00037 #define OGRE_PLATFORM_WIN32 1
    00038 #define OGRE_PLATFORM_LINUX 2
    00039 #define OGRE_PLATFORM_APPLE 3
    00040
    00041 #define OGRE_COMPILER_MSVC 1
    00042 #define OGRE_COMPILER_GNUC 2
    00043 #define OGRE_COMPILER_BORL 3
    00044
    00045 #define OGRE_ENDIAN_LITTLE 1
    00046 #define OGRE_ENDIAN_BIG 2
    00047
    00048 #define OGRE_ARCHITECTURE_32 1
    00049 #define OGRE_ARCHITECTURE_64 2
    00050
    00051 /* Finds the compiler type and version.
    00052 */
    00053 #if defined( _MSC_VER )
    00054 #   define OGRE_COMPILER OGRE_COMPILER_MSVC
    00055 #   define OGRE_COMP_VER _MSC_VER
    00056
    00057 #elif defined( __GNUC__ )
    00058 #   define OGRE_COMPILER OGRE_COMPILER_GNUC
    00059 #   define OGRE_COMP_VER (((__GNUC__)*100) + \
    00060         (__GNUC_MINOR__*10) + \
    00061         __GNUC_PATCHLEVEL__)
    00062
    00063 #elif defined( __BORLANDC__ )
    00064 #   define OGRE_COMPILER OGRE_COMPILER_BORL
    00065 #   define OGRE_COMP_VER __BCPLUSPLUS__
    00066 #   define __FUNCTION__ __FUNC__
    00067 #else
    00068 #   pragma error "No known compiler. Abort! Abort!"
    00069
    00070 #endif
    00071
    00072 /* See if we can use __forceinline or if we need to use __inline instead */
    00073 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
    00074 #   if OGRE_COMP_VER >= 1200
    00075 #       define FORCEINLINE __forceinline
    00076 #   endif
    00077 #elif defined(__MINGW32__)
    00078 #   if !defined(FORCEINLINE)
    00079 #       define FORCEINLINE __inline
    00080 #   endif
    00081 #else
    00082 #   define FORCEINLINE __inline
    00083 #endif
    00084
    00085 /* Finds the current platform */
    00086
    00087 #if defined( __WIN32__ ) || defined( _WIN32 )
    00088 #   define OGRE_PLATFORM OGRE_PLATFORM_WIN32
    00089
    00090 #elif defined( __APPLE_CC__)
    00091 #   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
    00092
    00093 #else
    00094 #   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
    00095 #endif
    00096
    00097     /* Find the arch type */
    00098 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
    00099 #   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
    00100 #else
    00101 #   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
    00102 #endif
    00103
    00104 // For generating compiler warnings - should work on any compiler
    00105 // As a side note, if you start your message with 'Warning: ', the MSVC
    00106 // IDE actually does catch a warning :)
    00107 #define OGRE_QUOTE_INPLACE(x) # x
    00108 #define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
    00109 #define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
    00110
    00111 //----------------------------------------------------------------------------
    00112 // Windows Settings
    00113 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    00114
    00115 // If we're not including this from a client build, specify that the stuff
    00116 // should get exported. Otherwise, import it.
    00117 #   if defined( OGRE_STATIC_LIB )
    00118         // Linux compilers don't have symbol import/export directives.
    00119 #       define _OgreExport
    00120 #       define _OgrePrivate
    00121 #   else
    00122 #       if defined( OGRE_NONCLIENT_BUILD )
    00123 #           define _OgreExport __declspec( dllexport )
    00124 #       else
    00125 #           if defined( __MINGW32__ )
    00126 #               define _OgreExport
    00127 #           else
    00128 #               define _OgreExport __declspec( dllimport )
    00129 #           endif
    00130 #       endif
    00131 #       define _OgrePrivate
    00132 #   endif
    00133 // Win32 compilers use _DEBUG for specifying debug builds.
    00134 #   ifdef _DEBUG
    00135 #       define OGRE_DEBUG_MODE 1
    00136 #   else
    00137 #       define OGRE_DEBUG_MODE 0
    00138 #   endif
    00139
    00140 // Disable unicode support on MingW at the moment, poorly supported in stdlibc++
    00141 // STLPORT fixes this though so allow if found
    00142 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h
    00143 #if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
    00144 #   include<_mingw.h>
    00145 #   if defined(__MINGW32_TOOLBOX_UNICODE__)
    00146 #       define OGRE_UNICODE_SUPPORT 1
    00147 #   else
    00148 #       define OGRE_UNICODE_SUPPORT 0
    00149 #   endif
    00150 #else
    00151 #   define OGRE_UNICODE_SUPPORT 1
    00152 #endif
    00153
    00154 #endif
    00155 //----------------------------------------------------------------------------
    00156
    00157 //----------------------------------------------------------------------------
    00158 // Linux/Apple Settings
    00159 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    00160
    00161 // Enable GCC symbol visibility
    00162 #   if defined( OGRE_GCC_VISIBILITY )
    00163 #       define _OgreExport  __attribute__ ((visibility("default")))
    00164 #       define _OgrePrivate __attribute__ ((visibility("hidden")))
    00165 #   else
    00166 #       define _OgreExport
    00167 #       define _OgrePrivate
    00168 #   endif
    00169
    00170 // A quick define to overcome different names for the same function
    00171 #   define stricmp strcasecmp
    00172
    00173 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
    00174 // specifying a debug build.
    00175 // (??? this is wrong, on Linux debug builds aren't marked in any way unless
    00176 // you mark it yourself any way you like it -- zap ???)
    00177 #   ifdef DEBUG
    00178 #       define OGRE_DEBUG_MODE 1
    00179 #   else
    00180 #       define OGRE_DEBUG_MODE 0
    00181 #   endif
    00182
    00183 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    00184     #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
    00185 #else
    00186     //OGRE_PLATFORM_LINUX
    00187     #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
    00188 #endif
    00189
    00190 // Always enable unicode support for the moment
    00191 // Perhaps disable in old versions of gcc if necessary
    00192 #define OGRE_UNICODE_SUPPORT 1
    00193
    00194 #endif
    00195
    00196 //For apple, we always have a custom config.h file
    00197 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    00198 #    include "config.h"
    00199 #endif
    00200
    00201 //----------------------------------------------------------------------------
    00202
    00203 //----------------------------------------------------------------------------
    00204 // Endian Settings
    00205 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
    00206 #ifdef OGRE_CONFIG_BIG_ENDIAN
    00207 #    define OGRE_ENDIAN OGRE_ENDIAN_BIG
    00208 #else
    00209 #    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
    00210 #endif
    00211
    00212 // Integer formats of fixed bit width
    00213 typedef unsigned int uint32;
    00214 typedef unsigned short uint16;
    00215 typedef unsigned char uint8;
    00216 // define uint64 type
    00217 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
    00218     typedef unsigned __int64 uint64;
    00219 #else
    00220     typedef unsigned long long uint64;
    00221 #endif
    00222
    00223
    00224 }
    00225
    00226 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:32:19 2009