Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 10, 2008, 1:37:36 AM (16 years ago)
Author:
rgrieder
Message:

merged gui back to trunk.
update the media repository!

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util/OrxonoxPlatform.h

    r1505 r1755  
    2525 *      Reto Grieder
    2626 *
     27 *   Original code: OgrePlatform.h, licensed under the LGPL. The code
     28 *   has changed quite a bit however.
     29 *
    2730 */
    2831
    2932/**
    3033 @file
    31  @brief Various constants for compiler, architecture and platform. It's a mere
    32         copy of the file found in the Ogre source code (OgrePlatform.h).
     34 @brief
     35    Various constants for compiler, architecture and platform.
    3336 */
    3437
     
    3639#define _OrxonoxPlatform_H__
    3740
    38 /* Initial platform/compiler-related stuff to set.
    39 */
     41/* Initial platform/compiler-related stuff to set. */
     42
    4043#define ORXONOX_PLATFORM_WIN32 1
    4144#define ORXONOX_PLATFORM_LINUX 2
     
    5255#define ORXONOX_ARCHITECTURE_64 2
    5356
    54 /* Finds the compiler type and version.
    55 */
     57
     58/* Finds the compiler type and version. */
     59
    5660#if defined( _MSC_VER )
    5761#  define ORXONOX_COMPILER ORXONOX_COMPILER_MSVC
     
    7377#endif
    7478
     79
    7580/* See if we can use __forceinline or if we need to use __inline instead */
    7681#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     
    8792
    8893/* Finds the current platform */
    89 
    9094#if defined( __WIN32__ ) || defined( _WIN32 )
    9195#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_WIN32
    92 
    9396#elif defined( __APPLE_CC__)
    9497#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_APPLE
    95 
    9698#else
    9799#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_LINUX
    98100#endif
    99101
    100     /* Find the arch type */
     102/* Find the arch type */
    101103#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
    102104#  define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_64
     
    105107#endif
    106108
    107 // For generating compiler warnings - should work on any compiler
    108 // As a side note, if you start your message with 'Warning: ', the MSVC
    109 // IDE actually does catch a warning :)
    110 // FIXME: Try this on linux box. Doesn't work with msvc
    111 //#define ORXONOX_QUOTE_INPLACE(x) # x
    112 //#define ORXONOX_QUOTE(x) ORXONOX_QUOTE_INPLACE(x)
    113 //#define ORXONOX_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
    114 
    115 //----------------------------------------------------------------------------
    116 // Windows Settings
     109/* Try to define function information */
     110#ifndef __FUNCTIONNAME__
     111#  if ORXONOX_COMPILER == ORXONOX_COMPILER_BORL
     112#    define __FUNCTIONNAME__ __FUNC__
     113#  elif ORXONOX_COMPILER == ORXONOX_COMPILER_GNUC
     114#    define __FUNCTIONNAME__ __PRETTY_FUNCTION__
     115#  elif ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     116#    define __FUNCTIONNAME__ __FUNCTION__
     117#  else
     118#    define __FUNCTIONNAME__
     119#  endif
     120#endif
     121
     122/* Determine whether we're building in debug mode */
     123#if defined(_DEBUG) || defined(DEBUG)
     124#  define ORXONOX_DEBUG_MODE 1
     125#else
     126#  define ORXONOX_DEBUG_MODE 0
     127#endif
     128
     129/* Define configurable floating point type */
     130namespace orxonox
     131{
     132#ifdef ORXONOX_DOUBLE_PRECISION
     133    typedef double Real;
     134#else
     135    typedef float  Real;
     136#endif
     137}
     138
     139
     140
     141/*---------------------------------
     142 * Windows Settings
     143 *-------------------------------*/
    117144#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
    118 
    119 // Win32 compilers use _DEBUG for specifying debug builds.
    120 #  ifdef _DEBUG
    121 #    define ORXONOX_DEBUG_MODE 1
    122 #  else
    123 #    define ORXONOX_DEBUG_MODE 0
    124 #  endif
    125 
    126 // Disable unicode support on MingW at the moment, poorly supported in stdlibc++
    127 // STLPORT fixes this though so allow if found
    128 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h
     145/* Disable unicode support on MingW at the moment, poorly supported in stdlibc++
     146 * STLPORT fixes this though so allow if found
     147 * MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h */
    129148#  if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
    130149#    include<_mingw.h>
     
    137156#    define ORXONOX_UNICODE_SUPPORT 1
    138157#  endif
    139 
    140158#endif /* Platform Win32 */
    141 //----------------------------------------------------------------------------
    142 
    143 //----------------------------------------------------------------------------
    144 // Linux/Apple Settings
     159
     160
     161/*---------------------------------
     162 * Linux/Apple Settings
     163 *-------------------------------*/
    145164#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_LINUX || ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    146165
    147 
    148 // A quick define to overcome different names for the same function
     166/* A quick define to overcome different names for the same function */
    149167#  define stricmp strcasecmp
    150168
    151 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
    152 // specifying a debug build.
    153 // (??? this is wrong, on Linux debug builds aren't marked in any way unless
    154 // you mark it yourself any way you like it -- zap ???)
    155 #  ifdef DEBUG
    156 #    define ORXONOX_DEBUG_MODE 1
    157 #  else
    158 #    define ORXONOX_DEBUG_MODE 0
    159 #  endif
    160 
    161 /* FIXME: Check what this actually is and whether we need it or not
     169/* TODO: Check what this actually is and whether we need it or not */
     170#if 0
    162171#  if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    163172#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
    164173#  else
    165 // ORXONOX_PLATFORM_LINUX
     174/* ORXONOX_PLATFORM_LINUX */
    166175#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
    167176#  endif
    168 */
    169 
    170 // Always enable unicode support for the moment
    171 // Perhaps disable in old versions of gcc if necessary
     177#endif
     178
     179/* Always enable unicode support for the moment
     180 * Perhaps disable in old versions of gcc if necessary */
    172181#  define ORXONOX_UNICODE_SUPPORT 1
    173182
    174183#endif /* Patform Linux/Apple */
    175184
    176 //For apple, we always have a custom config.h file
     185
     186/*---------------------------------
     187 * Apple Settings
     188 *-------------------------------*/
     189/* For apple, we always have a custom config.h file */
    177190#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    178191#  include "config.h"
    179192#endif
    180193
    181 //----------------------------------------------------------------------------
    182 
    183 //----------------------------------------------------------------------------
    184 // Endian Settings
    185 // check for BIG_ENDIAN config flag, set ORXONOX_ENDIAN correctly
    186 #ifdef ORXONOX_CONFIG_BIG_ENDIAN
    187 #  define ORXONOX_ENDIAN ORXONOX_ENDIAN_BIG
    188 #else
    189 #  define ORXONOX_ENDIAN ORXONOX_ENDIAN_LITTLE
    190 #endif
    191 
    192 //-----------------------------------------------------------------------
    193 // fixed width integers
    194 //-----------------------------------------------------------------------
     194
     195/*---------------------------------
     196 * Visual Studio Settings
     197 *-------------------------------*/
    195198#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
    196 typedef __int8            int8_t;
    197 typedef __int16           int16_t;
    198 typedef __int32           int32_t;
    199 typedef __int64           int64_t;
    200 typedef unsigned __int8   uint8_t;
    201 typedef unsigned __int16  uint16_t;
    202 typedef unsigned __int32  uint32_t;
    203 typedef unsigned __int64  uint64_t;
    204 #else
    205 # include "inttypes.h"
    206 #endif
    207 
    208 namespace orxonox {
    209 #ifdef ORXONOX_DOUBLE_PRECISION
    210 typedef double Real;
    211 #else
    212 typedef float Real;
    213 #endif
    214 }
    215 
    216 
    217 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
    218 // Turn off warnings generated by long std templates
    219 // This warns about truncation to 255 characters in debug/browse info
    220 //#   pragma warning (disable : 4786)
    221 
    222 // Turn off warnings generated by long std templates
    223 // This warns about truncation to 255 characters in debug/browse info
    224 //#   pragma warning (disable : 4503)
    225 
    226 // disable: conversion from 'double' to 'float', possible loss of data
    227 // disable: conversion from 'ogg_int64_t' to 'long', possible loss of data
    228 // This has been dealt with in base_properties of the solution since the
    229 // warning primarily occurs in library header files (which are mostly
    230 // included before OrxonoxPlatform.h is)
    231 //#   pragma warning (disable : 4244)
    232 
    233 // disable: "conversion from 'size_t' to 'unsigned int', possible loss of data
    234 //#   pragma warning (disable : 4267)
    235 
    236 // disable: "truncation from 'double' to 'float'
    237 //#   pragma warning (disable : 4305)
    238 
    239 // set to level 4: "<type> needs to have dll-interface to be used by clients'
    240 // Happens on STL member variables which are not public therefore is ok
     199/* Turn off warnings generated by long std templates
     200 * This warns about truncation to 255 characters in debug/browse info */
     201/*#   pragma warning (disable : 4786)*/
     202
     203/* Turn off warnings generated by long std templates
     204 * This warns about truncation to 255 characters in debug/browse info */
     205/*#   pragma warning (disable : 4503)*/
     206
     207/* disable: conversion from 'double' to 'float', possible loss of data
     208 * disable: conversion from 'ogg_int64_t' to 'long', possible loss of data
     209 * This has been dealt with in base_properties of the solution since the
     210 * warning primarily occurs in library header files (which are mostly
     211 * included before OrxonoxPlatform.h is) */
     212/*#   pragma warning (disable : 4244)*/
     213
     214/* disable: "conversion from 'size_t' to 'unsigned int', possible loss of data */
     215/*#   pragma warning (disable : 4267)*/
     216
     217/* disable: "truncation from 'double' to 'float' */
     218/*#   pragma warning (disable : 4305)*/
     219
     220/* set to level 4: "<type> needs to have dll-interface to be used by clients'
     221 * Happens on STL member variables which are not public therefore is ok */
    241222#   pragma warning (disable : 4251)
    242223
    243 // disable: 'MultiTypeString' : multiple assignment operators specified
    244 // Used in MultiType and works fine so far
    245 //#   pragma warning (disable : 4522)
    246 
    247 // disable: "non dll-interface class used as base for dll-interface class"
    248 // Happens when deriving from Singleton because bug in compiler ignores
    249 // template export
    250 //#   pragma warning (disable : 4275)
    251 
    252 // disable: "C++ Exception Specification ignored"
    253 // This is because MSVC 6 did not implement all the C++ exception
    254 // specifications in the ANSI C++ draft.
    255 //#   pragma warning( disable : 4290 )
    256 
    257 // disable: "no suitable definition provided for explicit template
    258 // instantiation request" Occurs in VC7 for no justifiable reason on all
    259 // #includes of Singleton
    260 //#   pragma warning( disable: 4661)
    261 
    262 // disable: deprecation warnings when using CRT calls in VC8
    263 // These show up on all C runtime lib code in VC8, disable since they clutter
    264 // the warnings with things we may not be able to do anything about (e.g.
    265 // generated code from nvparse etc). I doubt very much that these calls
    266 // will ever be actually removed from VC anyway, it would break too much code.
    267 //#     pragma warning( disable: 4996)
    268 
    269 // disable: "conditional expression constant", always occurs on
    270 // ORXONOX_MUTEX_CONDITIONAL when no threading enabled
    271 //#   pragma warning (disable : 201)
    272 
    273 
    274 // Define the english written operators like and, or, xor
     224/* disable: 'MultiTypeString' : multiple assignment operators specified
     225 * Used in MultiType and works fine so far */
     226/*#   pragma warning (disable : 4522)*/
     227
     228/* disable: "non dll-interface class used as base for dll-interface class"
     229 * Happens when deriving from Singleton because bug in compiler ignores
     230 * template export */
     231/*#   pragma warning (disable : 4275)*/
     232
     233/* disable: "C++ Exception Specification ignored"
     234 * This is because MSVC 6 did not implement all the C++ exception
     235 * specifications in the ANSI C++ draft. */
     236/*#   pragma warning( disable : 4290 )*/
     237
     238/* disable: "no suitable definition provided for explicit template
     239 * instantiation request" Occurs in VC7 for no justifiable reason on all
     240 * #includes of Singleton */
     241/*#   pragma warning( disable: 4661)*/
     242
     243/* disable: deprecation warnings when using CRT calls in VC8
     244 * These show up on all C runtime lib code in VC8, disable since they clutter
     245 * the warnings with things we may not be able to do anything about (e.g.
     246 * generated code from nvparse etc). I doubt very much that these calls
     247 * will ever be actually removed from VC anyway, it would break too much code. */
     248/*# pragma warning( disable: 4996)*/
     249
     250/* disable: "conditional expression constant", always occurs on
     251 * ORXONOX_MUTEX_CONDITIONAL when no threading enabled */
     252/*#   pragma warning (disable : 201)*/
     253
     254
     255/* Define the english written operators like and, or, xor */
    275256#include <iso646.h>
    276257
     258/* include visual leak detector to search for memory leaks */
     259/* #include <vld.h> */
     260
    277261#endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC */
    278262
    279 // include visual leak detector to search for memory leaks
    280 //#include <vld.h>
    281 
    282263#endif /* _OrxonoxPlatform_H__ */
Note: See TracChangeset for help on using the changeset viewer.