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

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