Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

PeonPlatform.h

00001 
00002 /*
00003 -----------------------------------------------------------------------------
00004 This source file is part of OGRE
00005     (Object-oriented Graphics Rendering Engine)
00006 For the latest info, see http://www.ogre3d.org/
00007 
00008 Copyright (c) 2000-2005 The OGRE Team
00009 Also see acknowledgements in Readme.html
00010 
00011 This program is free software; you can redistribute it and/or modify it under
00012 the terms of the GNU Lesser General Public License as published by the Free Software
00013 Foundation; either version 2 of the License, or (at your option) any later
00014 version.
00015 
00016 This program is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00019 
00020 You should have received a copy of the GNU Lesser General Public License along with
00021 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00022 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00023 http://www.gnu.org/copyleft/lesser.txt.
00024 -----------------------------------------------------------------------------
00025 */
00026 
00027 #ifndef __PEONPLATFORM_H_
00028 #define __PEONPLATFORM_H_
00029 
00030 
00031 namespace peon {
00032 
00033 /* Initial platform/compiler-related stuff to set.
00034 */
00035 #define PEON_PLATFORM_WIN32 1
00036 #define PEON_PLATFORM_LINUX 2
00037 #define PEON_PLATFORM_APPLE 3
00038 
00039 #define PEON_COMPILER_MSVC 1
00040 #define PEON_COMPILER_GNUC 2
00041 #define PEON_COMPILER_BORL 3
00042 
00043 #define PEON_ENDIAN_LITTLE 1
00044 #define PEON_ENDIAN_BIG 2
00045 
00046 #define PEON_ARCHITECTURE_32 1
00047 #define PEON_ARCHITECTURE_64 2
00048 
00049 /* Finds the compiler type and version.
00050 */
00051 #if defined( _MSC_VER )
00052 #   define PEON_COMPILER PEON_COMPILER_MSVC
00053 #   define PEON_COMP_VER _MSC_VER
00054 
00055 #elif defined( __GNUC__ )
00056 #   define PEON_COMPILER PEON_COMPILER_GNUC
00057 #   define PEON_COMP_VER (((__GNUC__)*100) + \
00058         (__GNUC_MINOR__*10) + \
00059         __GNUC_PATCHLEVEL__)
00060 
00061 #elif defined( __BORLANDC__ )
00062 #   define PEON_COMPILER PEON_COMPILER_BORL
00063 #   define PEON_COMP_VER __BCPLUSPLUS__
00064 
00065 #else
00066 #   pragma error "No known compiler. Abort! Abort!"
00067 
00068 #endif
00069 
00070 /* See if we can use __forceinline or if we need to use __inline instead */
00071 #if PEON_COMPILER == PEON_COMPILER_MSVC 
00072 #   if PEON_COMP_VER >= 1200
00073 #       define FORCEINLINE __forceinline
00074 #   endif
00075 #else
00076 #   define FORCEINLINE __inline
00077 #endif
00078 
00079 /* Finds the current platform */
00080 
00081 #if defined( __WIN32__ ) || defined( _WIN32 )
00082 #   define PEON_PLATFORM PEON_PLATFORM_WIN32
00083 
00084 #elif defined( __APPLE_CC__)
00085 #   define PEON_PLATFORM PEON_PLATFORM_APPLE
00086 
00087 #else
00088 #   define PEON_PLATFORM PEON_PLATFORM_LINUX
00089 #endif
00090 
00091 /* Find the arch type */
00092 #if defined(__x86_64__)
00093 #   define PEON_ARCH_TYPE PEON_ARCHITECTURE_64
00094 #else
00095 #   define PEON_ARCH_TYPE PEON_ARCHITECTURE_32
00096 #endif
00097 // For generating compiler warnings - should work on any compiler
00098 // As a side note, if you start your message with 'Warning: ', the MSVC
00099 // IDE actually does catch a warning :)
00100 #define PEON_QUOTE_INPLACE(x) # x
00101 #define PEON_QUOTE(x) PEON_QUOTE_INPLACE(x)
00102 #define PEON_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00103 
00104 //----------------------------------------------------------------------------
00105 // Windows Settings
00106 #if PEON_PLATFORM == PEON_PLATFORM_WIN32
00107 
00108 // If we're not including this from a client build, specify that the stuff
00109 // should get exported. Otherwise, import it.
00110 #       if defined( __MINGW32__ )
00111                 // Linux compilers don't have symbol import/export directives.
00112 #       define _PeonExport
00113 #       define _PeonPrivate
00114 #   else
00115 #       if defined( PEON_NONCLIENT_BUILD )
00116 #               define _PeonExport __declspec( dllexport )
00117 #       else
00118 #               define _PeonExport __declspec( dllimport )
00119 #       endif
00120 #       define _PeonPrivate
00121 #       endif
00122 // Win32 compilers use _DEBUG for specifying debug builds.
00123 #   ifdef _DEBUG
00124 #       define PEON_DEBUG_MODE 1
00125 #   else
00126 #       define PEON_DEBUG_MODE 0
00127 #   endif
00128 
00129 #if defined( __MINGW32__ )
00130     #define EXT_HASH
00131 #else
00132     #define snprintf _snprintf
00133     #define vsnprintf _vsnprintf
00134 #endif
00135 
00136 
00137 #endif
00138 
00139 
00140 
00141 //----------------------------------------------------------------------------
00142 
00143 //----------------------------------------------------------------------------
00144 // Linux/Apple Settings
00145 #if PEON_PLATFORM == PEON_PLATFORM_LINUX || PEON_PLATFORM == PEON_PLATFORM_APPLE
00146 
00147 // Enable GCC 4.0 symbol visibility 
00148 #   if PEON_COMP_VER >= 400
00149 #       define _PeonExport  __attribute__ ((visibility("default")))
00150 #       define _PeonPrivate __attribute__ ((visibility("hidden")))
00151 #   else
00152 #       define _PeonExport
00153 #       define _PeonPrivate
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 PEON_DEBUG_MODE 1
00163 #   else
00164 #       define PEON_DEBUG_MODE 0
00165 #   endif
00166 
00167 
00168 
00169 #endif
00170 
00171 
00172 //----------------------------------------------------------------------------
00173 
00174 //----------------------------------------------------------------------------
00175 // Endian Settings
00176 // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
00177 #ifdef CONFIG_BIG_ENDIAN
00178 #    define PEON_ENDIAN PEON_ENDIAN_BIG
00179 #else
00180 #    define PEON_ENDIAN PEON_ENDIAN_LITTLE
00181 #endif
00182 
00183 // Integer formats of fixed bit width
00184 typedef unsigned int uint32;
00185 typedef unsigned short uint16;
00186 typedef unsigned char uint8;
00187 
00188 }
00189 
00190 #endif
00191 
00192 

Generated on Thu Dec 1 01:55:40 2005 for Peon by  doxygen 1.4.1