KeosPlatform.h

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 
00022 #ifndef KEOS_PLATFORM_H
00023 #define KEOS_PLATFORM_H
00024 
00025 #include "KeosConfig.h"
00026 
00027 namespace Keos
00028 {
00029 
00030   /* Initial platform/compiler-related stuff to set.
00031    */
00032 #define KEOS_PLATFORM_WIN32 1
00033 
00034 #define KEOS_COMPILER_MSVC 1
00035 #define KEOS_COMPILER_GNUC 2
00036 
00037   /* Finds the compiler type and version.
00038    */
00039 #if defined( _MSC_VER )
00040 #   define KEOS_COMPILER KEOS_COMPILER_MSVC
00041 #   define KEOS_COMP_VER _MSC_VER
00042 
00043 #elif defined( __GNUC__ )
00044 #   define KEOS_COMPILER KEOS_COMPILER_GNUC
00045 #   define KEOS_COMP_VER (((__GNUC__)*100)+__GNUC_MINOR__)
00046 
00047 #else
00048 #   pragma error "Work only under MSVC or GNU compiler !!"
00049 
00050 #endif
00051 
00052 #define MSVC_VER_6 1200
00053 #define MSVC_VER_7 1300
00054 
00055   /* Finds the current platform
00056    */
00057 #if defined( __WIN32__ ) || defined( _WIN32 )
00058 #   define KEOS_PLATFORM KEOS_PLATFORM_WIN32
00059 #else
00060 #   pragma error "Work only under Windows system !!"
00061 #endif
00062 
00063 // For generating compiler warnings - should work on any compiler
00064 // As a side note, if you start your message with 'Warning: ', the MSVC
00065 // IDE actually does catch a warning :)
00066 #define KEOS_QUOTE_INPLACE(x) # x
00067 #define KEOS_QUOTE(x) KEOS_QUOTE_INPLACE(x)
00068 #define KEOS_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
00069 
00070 //----------------------------------------------------------------------------
00071 // Windows Settings
00072 #if KEOS_PLATFORM == KEOS_PLATFORM_WIN32
00073 
00074 // If we're not including this from a client build, specify that the stuff
00075 // should get exported. Otherwise, import it.
00076 # if defined( __MINGW32__ )
00077   // Linux compilers don't have symbol import/export directives.
00078 #    define KEOS_EXPORT
00079 #   else
00080 #    if defined( KEOSENGINE_EXPORTS )
00081 #        define KEOS_EXPORT __declspec( dllexport )
00082 #    else
00083 #        define KEOS_EXPORT __declspec( dllimport )
00084 #    endif
00085 # endif
00086 
00087 // Win32 compilers use _DEBUG for specifying debug builds.
00088 #   ifdef _DEBUG
00089 #       define KEOS_DEBUG_MODE 1
00090 #   else
00091 #       define KEOS_DEBUG_MODE 0
00092 #   endif
00093 
00094 #if defined( __MINGW32__ )
00095 #define GCC_3_1
00096 #define EXT_HASH
00097 #else
00098 #define snprintf _snprintf
00099 #define vsnprintf _vsnprintf
00100 #endif
00101 
00102 #if KEOS_DEBUG_MODE
00103 #define KEOS_PLATFORM_LIB "PlatformManager_Win32_d.dll"
00104 #else
00105 #define KEOS_PLATFORM_LIB "PlatformManager_Win32.dll"
00106 #endif
00107 
00108 #endif
00109 
00110 #if KEOS_COMPILER == KEOS_COMPILER_MSVC
00111 
00112 // Turn off warnings generated by long std templates
00113 // This warns about truncation to 255 characters in debug/browse info
00114 #   pragma warning (disable : 4786)
00115 
00116 // Turn off warnings generated by long std templates
00117 // This warns about truncation to 255 characters in debug/browse info
00118 #   pragma warning (disable : 4503)
00119 
00120 // disable: "conversion from 'double' to 'float', possible loss of data
00121 #   pragma warning (disable : 4244)
00122 
00123 // disable: "truncation from 'double' to 'float'
00124 #   pragma warning (disable : 4305)
00125 
00126 // disable: "<type> needs to have dll-interface to be used by clients'
00127 // Happens on STL member variables which are not public therefore is ok
00128 #   pragma warning (disable : 4251)
00129 
00130 // disable: "non dll-interface class used as base for dll-interface class"
00131 // Happens when deriving from Singleton because bug in compiler ignores
00132 // template export
00133 #   pragma warning (disable : 4275)
00134 
00135 // disable: "C++ Exception Specification ignored"
00136 // This is because MSVC 6 did not implement all the C++ exception
00137 // specifications in the ANSI C++ draft.
00138 #   pragma warning( disable : 4290 )
00139 
00140 // disable: "no suitable definition provided for explicit template
00141 // instantiation request" Occurs in VC7 for no justifiable reason on all
00142 // #includes of Singleton
00143 #   pragma warning( disable: 4661)
00144 
00145 // disable: deprecation warnings when using CRT calls in VC8
00146 // These show up on all C runtime lib code in VC8, disable since they clutter
00147 // the warnings with things we may not be able to do anything about (e.g.
00148 // generated code from nvparse etc). I doubt very much that these calls
00149 // will ever be actually removed from VC anyway, it would break too much code.
00150 # pragma warning( disable: 4996)
00151 #endif
00152 
00153 #if KEOS_COMPILER == KEOS_COMPILER_MSVC
00154 #   undef _DEFINE_DEPRECATED_HASH_CLASSES
00155 #   if KEOS_COMP_VER > MSVC_VER_7
00156 #       define _DEFINE_DEPRECATED_HASH_CLASSES 0
00157 #   else
00158 #      define _DEFINE_DEPRECATED_HASH_CLASSES 1
00159 #   endif
00160 #endif
00161 
00162 }
00163 
00164 #endif // KEOS_PLATFORM_H

Generated on Fri Mar 9 14:29:02 2007 for Keos by  doxygen 1.5.1-p1