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

# 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 /* Initial platform/compiler-related stuff to set.
    00030  */
    00031 #define KEOS_PLATFORM_WIN32 1
    00032
    00033 #define KEOS_COMPILER_MSVC 1
    00034 #define KEOS_COMPILER_GNUC 2
    00035
    00036 /* Finds the compiler type and version.
    00037  */
    00038 #if defined( _MSC_VER )
    00039 #   define KEOS_COMPILER KEOS_COMPILER_MSVC
    00040 #   define KEOS_COMP_VER _MSC_VER
    00041
    00042 #elif defined( __GNUC__ )
    00043 #   define KEOS_COMPILER KEOS_COMPILER_GNUC
    00044 #   define KEOS_COMP_VER (((__GNUC__)*100)+__GNUC_MINOR__)
    00045
    00046 #else
    00047 #   pragma error "Work only under MSVC or GNU compiler !!"
    00048
    00049 #endif
    00050
    00051 #define MSVC_VER_6 1200
    00052 #define MSVC_VER_7 1300
    00053
    00054 /* Finds the current platform
    00055  */
    00056 #if defined( __WIN32__ ) || defined( _WIN32 )
    00057 #   define KEOS_PLATFORM KEOS_PLATFORM_WIN32
    00058 #else
    00059 #   pragma error "Work only under Windows system !!"
    00060 #endif
    00061
    00062 // For generating compiler warnings - should work on any compiler
    00063 // As a side note, if you start your message with 'Warning: ', the MSVC
    00064 // IDE actually does catch a warning :)
    00065 #define KEOS_QUOTE_INPLACE(x) # x
    00066 #define KEOS_QUOTE(x) KEOS_QUOTE_INPLACE(x)
    00067 #define KEOS_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
    00068
    00069 //----------------------------------------------------------------------------
    00070 // Windows Settings
    00071 #if KEOS_PLATFORM == KEOS_PLATFORM_WIN32
    00072
    00073 // If we're not including this from a client build, specify that the stuff
    00074 // should get exported. Otherwise, import it.
    00075 #       if defined( __MINGW32__ )
    00076                 // Linux compilers don't have symbol import/export directives.
    00077 #       define KEOS_EXPORT
    00078 #   else
    00079 #       if defined( KEOSENGINE_EXPORTS )
    00080 #               define KEOS_EXPORT __declspec( dllexport )
    00081 #       else
    00082 #               define KEOS_EXPORT __declspec( dllimport )
    00083 #       endif
    00084 #       endif
    00085
    00086 // Win32 compilers use _DEBUG for specifying debug builds.
    00087 #   ifdef _DEBUG
    00088 #       define KEOS_DEBUG_MODE 1
    00089 #   else
    00090 #       define KEOS_DEBUG_MODE 0
    00091 #   endif
    00092
    00093 #if defined( __MINGW32__ )
    00094     #define GCC_3_1
    00095     #define EXT_HASH
    00096 #else
    00097     #define snprintf _snprintf
    00098     #define vsnprintf _vsnprintf
    00099 #endif
    00100
    00101 #if KEOS_DEBUG_MODE
    00102     #define KEOS_PLATFORM_LIB "PlatformManager_Win32_d.dll"
    00103 #else
    00104     #define KEOS_PLATFORM_LIB "PlatformManager_Win32.dll"
    00105 #endif
    00106
    00107 #endif
    00108
    00109   #if KEOS_COMPILER == KEOS_COMPILER_MSVC
    00110
    00111 // Turn off warnings generated by long std templates
    00112 // This warns about truncation to 255 characters in debug/browse info
    00113 #   pragma warning (disable : 4786)
    00114
    00115 // Turn off warnings generated by long std templates
    00116 // This warns about truncation to 255 characters in debug/browse info
    00117 #   pragma warning (disable : 4503)
    00118
    00119 // disable: "conversion from 'double' to 'float', possible loss of data
    00120 #   pragma warning (disable : 4244)
    00121
    00122 // disable: "truncation from 'double' to 'float'
    00123 #   pragma warning (disable : 4305)
    00124
    00125 // disable: "<type> needs to have dll-interface to be used by clients'
    00126 // Happens on STL member variables which are not public therefore is ok
    00127 #   pragma warning (disable : 4251)
    00128
    00129 // disable: "non dll-interface class used as base for dll-interface class"
    00130 // Happens when deriving from Singleton because bug in compiler ignores
    00131 // template export
    00132 #   pragma warning (disable : 4275)
    00133
    00134 // disable: "C++ Exception Specification ignored"
    00135 // This is because MSVC 6 did not implement all the C++ exception
    00136 // specifications in the ANSI C++ draft.
    00137 #   pragma warning( disable : 4290 )
    00138
    00139 // disable: "no suitable definition provided for explicit template
    00140 // instantiation request" Occurs in VC7 for no justifiable reason on all
    00141 // #includes of Singleton
    00142 #   pragma warning( disable: 4661)
    00143
    00144 // disable: deprecation warnings when using CRT calls in VC8
    00145 // These show up on all C runtime lib code in VC8, disable since they clutter
    00146 // the warnings with things we may not be able to do anything about (e.g.
    00147 // generated code from nvparse etc). I doubt very much that these calls
    00148 // will ever be actually removed from VC anyway, it would break too much code.
    00149 #       pragma warning( disable: 4996)
    00150 #endif
    00151
    00152 #if KEOS_COMPILER == KEOS_COMPILER_MSVC
    00153 #   undef _DEFINE_DEPRECATED_HASH_CLASSES
    00154 #   if KEOS_COMP_VER > MSVC_VER_7
    00155 #       define _DEFINE_DEPRECATED_HASH_CLASSES 0
    00156 #   else
    00157 #      define _DEFINE_DEPRECATED_HASH_CLASSES 1
    00158 #   endif
    00159 #endif
    00160
    00161 }
    00162
    00163 #endif // KEOS_PLATFORM_H