Platform.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
00004  *       mailto: <tevs@mpi-sb.mpg.de>                                      *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  ***************************************************************************
00012  *                                                                         *
00013  * Parts of this file was get from OGRE (Object-oriented Graphics          * 
00014  * Rendering Engine). see http://www.ogre3d.org                            *
00015  * Copyright (c) 2000-2005 The OGRE Team                                   *
00016  **************************************************************************/
00017 #ifndef __NR_PLATFORM_H_
00018 #define __NR_PLATFORM_H_
00019 
00020 #ifdef HAVE_CONFIG_H
00021 #include "config.h"
00022 #endif
00023 
00024 /* Initial platform/compiler-related stuff to set.
00025 */
00026 #define NR_PLATFORM_WIN32 1
00027 #define NR_PLATFORM_LINUX 2
00028 #define NR_PLATFORM_APPLE 3
00029 #define NR_PLATFORM_NETWARE 4
00030 #define NR_PLATFORM_OS2         5
00031 
00032 #define NR_COMPILER_MSVC 1
00033 #define NR_COMPILER_GNUC 2
00034 #define NR_COMPILER_BORL 3
00035 
00036 #define NR_ENDIAN_LITTLE 1
00037 #define NR_ENDIAN_BIG 2
00038 
00039 #define NR_ARCHITECTURE_32 1
00040 #define NR_ARCHITECTURE_64 2
00041 
00042 /* Finds the compiler type and version.
00043 */
00044 #if defined( _MSC_VER )
00045 #   define NR_COMPILER NR_COMPILER_MSVC
00046 #   define NR_COMP_VER _MSC_VER
00047 
00048 #elif defined( __GNUC__ )
00049 #   define NR_COMPILER NR_COMPILER_GNUC
00050 #   define NR_COMP_VER (((__GNUC__)*100)+__GNUC_MINOR__)
00051 
00052 #elif defined( __BORLANDC__ )
00053 #   define NR_COMPILER NR_COMPILER_BORL
00054 #   define NR_COMP_VER __BCPLUSPLUS__
00055 
00056 #else
00057 #   pragma warning "No known compiler. Behaivor is not defined :-)"
00058 
00059 #endif
00060 
00061 /* See if we can use __forceinline or if we need to use __inline instead */
00062 #if NR_COMPILER == NR_COMPILER_MSVC 
00063 #   if NR_COMP_VER >= 1200
00064 #       define NR_FORCEINLINE __forceinline
00065 #   endif
00066 #else
00067 #   define NR_FORCEINLINE __inline
00068 #endif
00069 
00070 
00071 /* Finds the current platform */
00072 #if defined( __WIN32__ ) || defined( _WIN32 )
00073 #   define NR_PLATFORM NR_PLATFORM_WIN32
00074 #elif defined( __APPLE_CC__)
00075 #   define NR_PLATFORM NR_PLATFORM_APPLE
00076 #else
00077 #   define NR_PLATFORM NR_PLATFORM_LINUX
00078 #endif
00079 
00080 
00081 /* Find the arch type */
00082 #if defined(__x86_64__)
00083 #   define NR_ARCH_TYPE NR_ARCHITECTURE_64
00084 #else
00085 #   define NR_ARCH_TYPE NR_ARCHITECTURE_32
00086 #endif
00087 
00088 
00089 //----------------------------------------------------------------------------
00090 // Windows Settings
00091 #if NR_PLATFORM == NR_PLATFORM_WIN32
00092 #include <windows.h>
00093 // If we're not including this from a client build, specify that the stuff
00094 // should get exported. Otherwise, import it.
00095 #if defined( NONCLIENT_BUILD ) || defined ( BUILDING_DLL ) || defined (BUILD_DLL)
00096 #       define _NRExport __declspec( dllexport )
00097 #elif defined (BUILDING_PLUGIN) || defined (BUILD_PLUGIN) || defined (CLIENT_BUILD)
00098 #       define _NRExport __declspec( dllimport )
00099 #else
00100 #   define _NRExport
00101 #endif
00102 
00103 // Win32 compilers use _DEBUG for specifying debug builds.
00104 #   ifdef _DEBUG
00105 #       define NR_DEBUG_MODE 1
00106 #   else
00107 #       define NR_DEBUG_MODE 0
00108 #   endif
00109 
00110 // Check for mingw compilers
00111 #if defined( __MINGW32__ )
00112     #define GCC_3_1
00113     #define EXT_HASH
00114 #else
00115     #define snprintf _snprintf
00116     #define vsnprintf _vsnprintf
00117 #endif
00118 
00119 #endif
00120 //----------------------------------------------------------------------------
00121 
00122 
00123 //----------------------------------------------------------------------------
00124 // Linux/Apple Settings
00125 #if NR_PLATFORM == NR_PLATFORM_LINUX || NR_PLATFORM == NR_PLATFORM_APPLE
00126 
00127 // Linux compilers don't have symbol import/export directives.
00128 #   define _NRExport
00129 
00130 // A quick define to overcome different names for the same function
00131 #   define stricmp strcasecmp
00132 
00133 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00134 // specifying a debug build.
00135 #   ifdef DEBUG
00136 #       define NR_DEBUG_MODE 1
00137 #   else
00138 #       define NR_DEBUG_MODE 0
00139 #   endif
00140 
00141 #endif
00142 
00143 //For apple, we always have a custom config.h file
00144 #if NR_PLATFORM == NR_PLATFORM_APPLE
00145 #    include "config.h"
00146 //SDL_main must be included in the file that contains
00147 //the application's main() function.
00148 // #ifndef NONCLIENT_BUILD
00149 // #   include <SDL/SDL_main.h>
00150 // #endif
00151 
00152 #endif
00153 //----------------------------------------------------------------------------
00154 
00155 
00156 //----------------------------------------------------------------------------
00157 // Endian Settings
00158 // check for BIG_ENDIAN config flag, set NR_ENDIAN correctly
00159 #ifdef CONFIG_BIG_ENDIAN
00160 #    define NR_ENDIAN NR_ENDIAN_BIG
00161 #else
00162 #    define NR_ENDIAN NR_ENDIAN_LITTLE
00163 #endif
00164 
00165 
00166 #endif

Generated on Wed Sep 12 23:19:42 2007 for nrEngine by  doxygen 1.5.1