Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/EngineConfig.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _ENGINE_CONFIG_H_
00004 #define _ENGINE_CONFIG_H_
00005 
00007 // Init Section
00008 #define PLATFORM_WIN32 1
00009 #define PLATFORM_LINUX 2
00010 #define PLATFORM_APPLE 3
00011 
00012 #define COMPILER_MSVC 1
00013 #define COMPILER_GNUC 2
00014 #define COMPILER_BORL 3
00015 
00016 #define COMPILER_DEBUG 1
00017 #define COMPILER_RELEASE 2
00018 
00019 #define ARCHITECTURE_32 1
00020 #define ARCHITECTURE_64 2
00021 
00022 #define ENDIAN_LITTLE 1
00023 #define ENDIAN_BIG 2
00024 
00025 // Init Section
00027 
00029 // Config Section
00030 
00032 #define KG_VERSION "0.3.0"
00033 
00034 #define ENGINE_UNIT 100
00035 // Config Section
00037 
00039 // Platform Section
00040 #if defined(__APPLE__)
00041 #       define ENGINE_PLATFORM PLATFORM_APPLE
00042 
00043 #elif defined(WIN32) || defined(WIN64) || defined(__WIN32__) || defined(_WIN32)
00044 #       define ENGINE_PLATFORM PLATFORM_WIN32
00045 
00046 #elif !defined(WIN32) && !defined(_XBOX) && !defined(OS2) && !defined(MACOSX)
00047 #       define ENGINE_PLATFORM PLATFORM_LINUX
00048 
00049 #else
00050 #       pragma error "No known OS. Abort! Abort!"
00051 
00052 #endif
00053 // Platform Section
00055 
00057 // Compiler Section
00058 #if defined(_MSC_VER)
00059 #       define ENGINE_COMPILER COMPILER_MSVC
00060 #       define ENGINE_COMPILER_VERSION _MSC_VER
00061 
00062 #elif defined(__GNUC__)
00063 #       define ENGINE_COMPILER COMPILER_GNUC
00064 #       define ENGINE_COMPILER_VERSION (((__GNUC__)*100) + (__GNUC_MINOR__*10) + __GNUC_PATCHLEVEL__)
00065 
00066 #elif defined(__BORLANDC__)
00067 #       define ENGINE_COMPILER COMPILER_BORL
00068 #       define ENGINE_COMPILER_VERSION __BCPLUSPLUS__
00069 
00070 #else
00071 #       pragma error "No known compiler. Abort! Abort!"
00072 
00073 #endif
00074 
00075 #if ENGINE_PLATFORM == PLATFORM_WIN32
00076 // Win32 compilers use _DEBUG for specifying debug builds.
00077 #       ifdef _DEBUG
00078 #               define ENGINE_COMPILER_MODE COMPILER_DEBUG
00079 #       else
00080 #               define ENGINE_COMPILER_MODE COMPILER_RELEASE
00081 #       endif
00082 #elif ENGINE_PLATFORM == PLATFORM_LINUX || ENGINE_PLATFORM == PLATFORM_APPLE
00083 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00084 // specifying a debug build.
00085 // (??? this is wrong, on Linux debug builds aren't marked in any way unless
00086 // you mark it yourself any way you like it -- zap ???)
00087 #       ifdef DEBUG
00088 #               define ENGINE_COMPILER_MODE COMPILER_DEBUG
00089 #       else
00090 #               define ENGINE_COMPILER_MODE COMPILER_RELEASE
00091 #       endif
00092 #endif
00093 
00094 // Compiler Section
00096 
00098 // Architecture Type Section
00099 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
00100 #       define ENGINE_ARCHITECTURE_TYPE ARCHITECTURE_64
00101 #else
00102 #       define ENGINE_ARCHITECTURE_TYPE ARCHITECTURE_32
00103 #endif
00104 
00105 #if defined(__sparc__) || defined(__sun__)
00106 #       define ENGINE_ARCHITECTURE_ENDIAN ENDIAN_BIG
00107 #else
00108 #       define ENGINE_ARCHITECTURE_ENDIAN ENDIAN_LITTLE
00109 #endif
00110 // Architecture Type Section
00112 
00114 // Unicode Section
00115 #if ENGINE_PLATFORM == PLATFORM_WIN32
00116 // Disable unicode support on MingW at the moment, poorly supported in stdlibc++
00117 // STLPORT fixes this though so allow if found
00118 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h
00119 #       if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
00120 #               include<_mingw.h>
00121 #               if defined(__MINGW32_TOOLBOX_UNICODE__)
00122 #                       define ENGINE_UNICODE_SUPPORT 1
00123 #               else
00124 #                       define ENGINE_UNICODE_SUPPORT 0
00125 #               endif
00126 #       else
00127 #               define ENGINE_UNICODE_SUPPORT 1
00128 #       endif
00129 
00130 #elif ENGINE_PLATFORM == PLATFORM_LINUX || ENGINE_PLATFORM == PLATFORM_APPLE
00131 // Always enable unicode support for the moment
00132 // Perhaps disable in old versions of gcc if necessary
00133 #       define ENGINE_UNICODE_SUPPORT 1
00134 
00135 #endif
00136 // Unicode Section
00138 
00140 // Export Section
00141 #if ENGINE_PLATFORM == PLATFORM_WIN32
00142 // If we're not including this from a client build, specify that the stuff
00143 // should get exported. Otherwise, import it.
00144 #       if defined(MINGW) || defined(__MINGW32__)
00145 // Linux compilers don't have symbol import/export directives.
00146 #               define ENGINE_PUBLIC_EXPORT
00147 #               define ENGINE_TEMPLATE_EXPORT
00148 #               define ENGINE_PRIVATE_EXPORT
00149 #       else
00150 #               ifdef GAME_ENGINE_DLL
00151 #                       define ENGINE_PUBLIC_EXPORT                     __declspec(dllexport)
00152 #                       define ENGINE_TEMPLATE_EXPORT           __declspec(dllexport)
00153 #               else
00154 #                       define ENGINE_PUBLIC_EXPORT                     __declspec(dllimport)
00155 #                       define ENGINE_TEMPLATE_EXPORT
00156 #               endif
00157 #               define ENGINE_PRIVATE_EXPORT
00158 #       endif
00159 #elif ENGINE_PLATFORM == PLATFORM_LINUX || ENGINE_PLATFORM == PLATFORM_APPLE
00160 // Enable GCC 4.0 symbol visibility
00161 #       if ENGINE_COMPILER_VERSION >= 400
00162 #               define ENGINE_PUBLIC_EXPORT                             __attribute__ ((visibility("default")))
00163 #               define ENGINE_TEMPLATE_EXPORT                   __attribute__ ((visibility("default")))
00164 #               define ENGINE_PRIVATE_EXPORT                    __attribute__ ((visibility("hidden")))
00165 #       else
00166 #               define ENGINE_PUBLIC_EXPORT
00167 #               define ENGINE_TEMPLATE_EXPORT
00168 #               define ENGINE_PRIVATE_EXPORT
00169 #       endif
00170 #else
00171 #       define ENGINE_PUBLIC_EXPORT
00172 #       define ENGINE_TEMPLATE_EXPORT
00173 #       define ENGINE_PRIVATE_EXPORT
00174 #endif
00175 // Export Section
00177 
00178 #if ENGINE_PLATFORM == PLATFORM_WIN32
00179 #       if ENGINE_COMPILER == COMPILER_MSVC
00180 #               define ENGINE_CALLBACK                          __stdcall
00181 #               define ENGINE_CALLCONV                          __cdecl
00182 #       else
00183 #               define ENGINE_CALLBACK
00184 #               define ENGINE_CALLCONV
00185 #       endif
00186 #elif ENGINE_PLATFORM == PLATFORM_LINUX || ENGINE_PLATFORM == PLATFORM_APPLE
00187 #       define ENGINE_CALLBACK
00188 #       define ENGINE_CALLCONV
00189 #else
00190 #       define ENGINE_CALLBACK
00191 #       define ENGINE_CALLCONV
00192 #endif
00193 
00194 #if ENGINE_PLATFORM == PLATFORM_WIN32
00195 #       if ENGINE_COMPILER == COMPILER_MSVC
00196 #               define  snprintf        _snprintf
00197 #               if !defined(_CRT_SECURE_NO_DEPRECATE)
00198 #                       define _CRT_SECURE_NO_DEPRECATE
00199 #               endif
00200 #       endif
00201 #endif
00202 
00203 #if (ENGINE_COMPILER == COMPILER_GNUC) && !defined(STLPORT)
00204 #       if ENGINE_COMPILER_VERSION >= 430
00205 #               include <tr1/unordered_map>
00206 #               include <tr1/unordered_set>
00207 #       else
00208 #               include <ext/hash_map>
00209 #               include <ext/hash_set>
00210 #       endif
00211 #else
00212 #       if (ENGINE_COMPILER == COMPILER_MSVC) && !defined(STLPORT) && ENGINE_COMPILER_VERSION >= 1600 // VC++ 10.0
00213 #               include <unordered_map>
00214 #               include <unordered_set>
00215 #       else
00216 #               include <hash_set>
00217 #               include <hash_map>
00218 #       endif
00219 #endif
00220 
00221 #if ENGINE_PLATFORM == COMPILER_GNUC && ENGINE_COMPILER_VERSION >= 310 && !defined(STLPORT)
00222 #       if ENGINE_COMPILER_VERSION >= 430
00223 #               define hashmap ::std::tr1::unordered_map
00224 #               define hashset ::std::tr1::unordered_set
00225 #       else
00226 #               define hashmap ::__gnu_cxx::hash_map
00227 #               define hashset ::__gnu_cxx::hash_set
00228 #       endif
00229 #else
00230 #   if ENGINE_COMPILER == COMPILER_MSVC
00231 #       if ENGINE_COMPILER_VERSION >= 1600 // VC++ 10.0
00232 #                       define hashmap ::std::tr1::unordered_map
00233 #                       define hashset ::std::tr1::unordered_set
00234 #               elif ENGINE_COMPILER_VERSION > 1300 && !defined(_STLP_MSVC)
00235 #                       define hashmap ::stdext::hash_map
00236 #                       define hashset ::stdext::hash_set
00237 #               else
00238 #                       define hashmap ::std::hash_map
00239 #                       define hashset ::std::hash_set
00240 #               endif
00241 #       else
00242 #               define hashmap ::std::hash_map
00243 #               define hashset ::std::hash_set
00244 #       endif
00245 #endif
00246 
00248 // Warnings Section
00249 #if ENGINE_COMPILER == COMPILER_MSVC
00250 // Turn off warnings generated by long std templates
00251 // This warns about truncation to 255 characters in debug/browse info
00252 #       pragma warning (disable : 4786)
00253 
00254 // Turn off warnings generated by long std templates
00255 // This warns about truncation to 255 characters in debug/browse info
00256 #       pragma warning (disable : 4503)
00257 
00258 // disable: "<type> needs to have dll-interface to be used by clients'
00259 // Happens on STL member variables which are not public therefore is ok
00260 #       pragma warning (disable : 4251)
00261 
00262 // disable: "non dll-interface class used as base for dll-interface class"
00263 // Happens when deriving from Singleton because bug in compiler ignores
00264 // template export
00265 //#     pragma warning (disable : 4275)
00266 
00267 // disable: "conversion from 'double' to 'float', possible loss of data
00268 //#     pragma warning (disable : 4244)
00269 
00270 // disable: "truncation from 'double' to 'float'
00271 //#     pragma warning (disable : 4305)
00272 
00273 // disable: "C++ Exception Specification ignored"
00274 // This is because MSVC 6 did not implement all the C++ exception
00275 // specifications in the ANSI C++ draft.
00276 //#     pragma warning( disable : 4290 )
00277 
00278 // disable: "no suitable definition provided for explicit template
00279 // instantiation request" Occurs in VC7 for no justifiable reason on all
00280 // #includes of Singleton
00281 //#     pragma warning( disable: 4661)
00282 
00283 // disable: deprecation warnings when using CRT calls in VC8
00284 // These show up on all C runtime lib code in VC8, disable since they clutter
00285 // the warnings with things we may not be able to do anything about (e.g.
00286 // generated code from nvparse etc). I doubt very much that these calls
00287 // will ever be actually removed from VC anyway, it would break too much code.
00288 //#     pragma warning( disable: 4996)
00289 
00290 #endif
00291 // Warnings Section
00293 
00295 // Memory Tracking Section
00296 //#define ENGINE_MEMORY_TRACKER
00297 
00298 #if defined(_DEBUG) && defined(ENGINE_MEMORY_TRACKER)
00299 #include "crtdbg.h"
00300 #define ENGINE_CLIENTBLOCK   new(_CLIENT_BLOCK, __FILE__, __LINE__)
00301 #else
00302 #define ENGINE_CLIENTBLOCK
00303 #endif // _DEBUG
00304 
00305 // Memory Tracking Section
00307 
00308 #include <wchar.h>
00309 #include <assert.h>
00310 
00311 #ifdef _DEBUG
00312 #       include <iostream>
00313 #endif
00314 
00315 #endif // _CONFIG_H_

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)