- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List

# setup.hpp

    00001
    00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
    00004 // Created : 2006-11-13
    00005 // Updated : 2011-01-26
    00006 // Licence : This source is under MIT License
    00007 // File    : glm/setup.hpp
    00009
    00010 #ifndef glm_setup
    00011 #define glm_setup
    00012
    00014 // Version
    00015
    00016 #define GLM_VERSION                                     91
    00017 #define GLM_VERSION_MAJOR                       0
    00018 #define GLM_VERSION_MINOR                       9
    00019 #define GLM_VERSION_PATCH                       1
    00020 #define GLM_VERSION_REVISION            0
    00021
    00023 // Compiler
    00024
    00025 // User defines: GLM_FORCE_COMPILER_UNKNOWN
    00026
    00027 #define GLM_COMPILER_UNKNOWN            0x00000000
    00028
    00029 // Visual C++ defines
    00030 #define GLM_COMPILER_VC                         0x01000000
    00031 #define GLM_COMPILER_VC2                        0x01000010
    00032 #define GLM_COMPILER_VC4                        0x01000020
    00033 #define GLM_COMPILER_VC5                        0x01000030
    00034 #define GLM_COMPILER_VC6                        0x01000040
    00035 #define GLM_COMPILER_VC2002                     0x01000050
    00036 #define GLM_COMPILER_VC2003                     0x01000060
    00037 #define GLM_COMPILER_VC2005                     0x01000070
    00038 #define GLM_COMPILER_VC2008                     0x01000080
    00039 #define GLM_COMPILER_VC2010                     0x01000090
    00040
    00041 // GCC defines
    00042 #define GLM_COMPILER_GCC            0x02000000
    00043 #define GLM_COMPILER_GCC30                      0x02000010
    00044 #define GLM_COMPILER_GCC31                      0x02000020
    00045 #define GLM_COMPILER_GCC32                      0x02000030
    00046 #define GLM_COMPILER_GCC33                      0x02000040
    00047 #define GLM_COMPILER_GCC34                      0x02000050
    00048 #define GLM_COMPILER_GCC35                      0x02000060
    00049 #define GLM_COMPILER_GCC40                      0x02000070
    00050 #define GLM_COMPILER_GCC41                      0x02000080
    00051 #define GLM_COMPILER_GCC42                      0x02000090
    00052 #define GLM_COMPILER_GCC43                      0x020000A0
    00053 #define GLM_COMPILER_GCC44                      0x020000B0
    00054 #define GLM_COMPILER_GCC45                      0x020000C0
    00055 #define GLM_COMPILER_GCC46                      0x020000D0
    00056 #define GLM_COMPILER_GCC47                      0x020000E0
    00057 #define GLM_COMPILER_GCC48                      0x020000F0
    00058 #define GLM_COMPILER_GCC49                      0x02000100
    00059 #define GLM_COMPILER_GCC50                      0x02000200
    00060
    00061 // G++ command line to display defined
    00062 // echo "" | g++ -E -dM -x c++ - | sort
    00063
    00064 // Borland C++ defines. How to identify BC?
    00065 #define GLM_COMPILER_BC                         0x03000000
    00066 #define GLM_COMPILER_BCB4                       0x03000100
    00067 #define GLM_COMPILER_BCB5                       0x03000200
    00068 #define GLM_COMPILER_BCB6                       0x03000300
    00069 //#define GLM_COMPILER_BCBX                     0x03000400 // What's the version value?
    00070 #define GLM_COMPILER_BCB2009            0x03000500
    00071
    00072 #define GLM_MODEL_32                            0x00000010
    00073 #define GLM_MODEL_64                            0x00000020
    00074
    00075 // CodeWarrior
    00076 #define GLM_COMPILER_CODEWARRIOR        0x04000000
    00077
    00078 // Force generic C++ compiler
    00079 #ifdef GLM_FORCE_COMPILER_UNKNOWN
    00080 #               define GLM_COMPILER GLM_COMPILER_UNKNOWN
    00081 // Visual C++
    00082 #elif defined(_MSC_VER)
    00083 #       if _MSC_VER == 900
    00084 #               define GLM_COMPILER GLM_COMPILER_VC2
    00085 #       elif _MSC_VER == 1000
    00086 #               define GLM_COMPILER GLM_COMPILER_VC4
    00087 #       elif _MSC_VER == 1100
    00088 #               define GLM_COMPILER GLM_COMPILER_VC5
    00089 #       elif _MSC_VER == 1200
    00090 #               define GLM_COMPILER GLM_COMPILER_VC6
    00091 #       elif _MSC_VER == 1300
    00092 #               define GLM_COMPILER GLM_COMPILER_VC2002
    00093 #       elif _MSC_VER == 1310
    00094 #               define GLM_COMPILER GLM_COMPILER_VC2003
    00095 #       elif _MSC_VER == 1400
    00096 #               define GLM_COMPILER GLM_COMPILER_VC2005
    00097 #       elif _MSC_VER == 1500
    00098 #               define GLM_COMPILER GLM_COMPILER_VC2008
    00099 #       elif _MSC_VER == 1600
    00100 #               define GLM_COMPILER GLM_COMPILER_VC2010
    00101 #       else//_MSC_VER
    00102 #               define GLM_COMPILER GLM_COMPILER_VC
    00103 #       endif//_MSC_VER
    00104
    00105 // G++
    00106 #elif defined(__GNUC__)
    00107 #       if   (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
    00108 #               define GLM_COMPILER GLM_COMPILER_GCC32
    00109 #       elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
    00110 #               define GLM_COMPILER GLM_COMPILER_GCC33
    00111 #       elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
    00112 #               define GLM_COMPILER GLM_COMPILER_GCC34
    00113 #       elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
    00114 #               define GLM_COMPILER GLM_COMPILER_GCC35
    00115 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
    00116 #               define GLM_COMPILER GLM_COMPILER_GCC40
    00117 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
    00118 #               define GLM_COMPILER GLM_COMPILER_GCC41
    00119 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
    00120 #               define GLM_COMPILER GLM_COMPILER_GCC42
    00121 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
    00122 #               define GLM_COMPILER GLM_COMPILER_GCC43
    00123 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
    00124 #               define GLM_COMPILER GLM_COMPILER_GCC44
    00125 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
    00126 #               define GLM_COMPILER GLM_COMPILER_GCC45
    00127 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
    00128 #               define GLM_COMPILER GLM_COMPILER_GCC46
    00129 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
    00130 #               define GLM_COMPILER GLM_COMPILER_GCC47
    00131 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
    00132 #               define GLM_COMPILER GLM_COMPILER_GCC48
    00133 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
    00134 #               define GLM_COMPILER GLM_COMPILER_GCC49
    00135 #       elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
    00136 #               define GLM_COMPILER GLM_COMPILER_GCC50
    00137 #       else
    00138 #               define GLM_COMPILER GLM_COMPILER_GCC
    00139 #       endif
    00140
    00141 // Borland C++
    00142 #elif defined(_BORLANDC_)
    00143 #       if defined(VER125)
    00144 #               define GLM_COMPILER GLM_COMPILER_BCB4
    00145 #       elif defined(VER130)
    00146 #               define GLM_COMPILER GLM_COMPILER_BCB5
    00147 #       elif defined(VER140)
    00148 #               define GLM_COMPILER GLM_COMPILER_BCB6
    00149 #       elif defined(VER200)
    00150 #               define GLM_COMPILER GLM_COMPILER_BCB2009
    00151 #       else
    00152 #               define GLM_COMPILER GLM_COMPILER_BC
    00153 #       endif
    00154
    00155 // Codewarrior
    00156 #elif defined(__MWERKS__)
    00157 #       define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
    00158
    00159 #else
    00160 #       define GLM_COMPILER GLM_COMPILER_UNKNOWN
    00161 #endif
    00162
    00163 #ifndef GLM_COMPILER
    00164 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
    00165 #endif//GLM_COMPILER
    00166
    00167 // Report compiler detection
    00168 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
    00169 #       define GLM_MESSAGE_COMPILER_DISPLAYED
    00170 #       if(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_VC)
    00171 #               pragma message("GLM: Visual C++ compiler detected")
    00172 #       elif(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_GCC)
    00173 #               pragma message("GLM: GCC compiler detected")
    00174 #       elif(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_BC)
    00175 #               pragma message("GLM: Borland compiler detected but not supported")
    00176 #       elif(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
    00177 #               pragma message("GLM: Codewarrior compiler detected but not supported")
    00178 #       else
    00179 #               pragma message("GLM: Compiler not detected")
    00180 #       endif
    00181 #endif//GLM_MESSAGE
    00182
    00184 // Build model //
    00185
    00186 #if(GLM_COMPILER & GLM_COMPILER_VC)
    00187 #       if defined(_M_X64)
    00188 #               define GLM_MODEL        GLM_MODEL_64
    00189 #       else
    00190 #               define GLM_MODEL        GLM_MODEL_32
    00191 #       endif//_M_X64
    00192 #elif(GLM_COMPILER & GLM_COMPILER_GCC)
    00193 #       if(defined(__WORDSIZE) && (__WORDSIZE == 64)) || defined(__arch64__) || defined(__LP64__) || defined(__x86_64__)
    00194 #               define GLM_MODEL        GLM_MODEL_64
    00195 #       else
    00196 #               define GLM_MODEL        GLM_MODEL_32
    00197 #       endif//
    00198 #else
    00199 #       define GLM_MODEL        GLM_MODEL_32
    00200 #endif//
    00201
    00202 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
    00203 #error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
    00204 #endif//GLM_MODEL
    00205
    00206 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
    00207 #       define GLM_MESSAGE_MODEL_DISPLAYED
    00208 #       if(GLM_MODEL == GLM_MODEL_64)
    00209 #               pragma message("GLM: 64 bits model")
    00210 #       elif(GLM_MODEL == GLM_MODEL_32)
    00211 #               pragma message("GLM: 32 bits model")
    00212 #       endif//GLM_MODEL
    00213 #endif//GLM_MESSAGE
    00214
    00216 // C++ Version //
    00217
    00218 // User defines: GLM_FORCE_CXX98
    00219
    00220 #define GLM_LANG_CXX                    0
    00221 #define GLM_LANG_CXX98                  1
    00222 #define GLM_LANG_CXX0X                  2
    00223 #define GLM_LANG_CXXMS                  3
    00224 #define GLM_LANG_CXXGNU                 4
    00225
    00226 #if(defined(GLM_FORCE_CXX98))
    00227 #       define GLM_LANG GLM_LANG_CXX98
    00228 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) // -std=c++0x or -std=gnu++0x
    00229 #       define GLM_LANG GLM_LANG_CXX0X
    00230 #elif(GLM_COMPILER == GLM_COMPILER_VC2010) //_MSC_EXTENSIONS for MS language extensions
    00231 #       define GLM_LANG GLM_LANG_CXX0X
    00232 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__))
    00233 #       define GLM_LANG GLM_LANG_CXX98
    00234 #elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && !defined(_MSC_EXTENSIONS))
    00235 #       define GLM_LANG GLM_LANG_CXX98
    00236 #else
    00237 #       define GLM_LANG GLM_LANG_CXX
    00238 #endif
    00239
    00240 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
    00241 #       define GLM_MESSAGE_LANG_DISPLAYED
    00242 #       if(GLM_LANG == GLM_LANG_CXX98)
    00243 #               pragma message("GLM: C++98")
    00244 #       elif(GLM_LANG == GLM_LANG_CXX0X)
    00245 #               pragma message("GLM: C++0x")
    00246 #       endif//GLM_MODEL
    00247 #endif//GLM_MESSAGE
    00248
    00250 // Platform
    00251
    00252 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_AVX
    00253
    00254 #define GLM_ARCH_PURE           0x0000 //(0x0000)
    00255 #define GLM_ARCH_SSE2           0x0001 //(0x0001)
    00256 #define GLM_ARCH_SSE3           0x0003 //(0x0002 | GLM_ARCH_SSE2)
    00257 #define GLM_ARCH_AVX            0x0007 //(0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    00258
    00259 #if(defined(GLM_FORCE_PURE))
    00260 #       define GLM_ARCH GLM_ARCH_PURE
    00261 #elif(defined(GLM_FORCE_AVX))
    00262 #       define GLM_ARCH GLM_ARCH_AVX
    00263 #elif(defined(GLM_FORCE_SSE3))
    00264 #       define GLM_ARCH GLM_ARCH_SSE3
    00265 #elif(defined(GLM_FORCE_SSE2))
    00266 #       define GLM_ARCH GLM_ARCH_SSE2
    00267 #elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
    00268 #       if(defined(_M_CEE_PURE))
    00269 #               define GLM_ARCH GLM_ARCH_PURE
    00270 #       elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
    00271 #               if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
    00272 #                       define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1)
    00273 #               else
    00274 #                       define GLM_ARCH GLM_ARCH_SSE3
    00275 #               endif
    00276 #       elif(GLM_COMPILER >= GLM_COMPILER_VC2008)
    00277 #               define GLM_ARCH GLM_ARCH_SSE3
    00278 #       elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
    00279 #               define GLM_ARCH GLM_ARCH_SSE2
    00280 #       else
    00281 #               define GLM_ARCH GLM_ARCH_PURE
    00282 #       endif
    00283 #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
    00284 #       if(defined(__AVX__))
    00285 #               define GLM_ARCH GLM_ARCH_AVX
    00286 #       elif(defined(__SSE3__))
    00287 #               define GLM_ARCH GLM_ARCH_SSE3
    00288 #       elif(defined(__SSE2__))
    00289 #               define GLM_ARCH GLM_ARCH_SSE2
    00290 #       else
    00291 #               define GLM_ARCH GLM_ARCH_PURE
    00292 #       endif
    00293 #else
    00294 #       define GLM_ARCH GLM_ARCH_PURE
    00295 #endif
    00296
    00297 #if(GLM_ARCH != GLM_ARCH_PURE)
    00298 #if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
    00299 #       include <immintrin.h>
    00300 #endif//GLM_ARCH
    00301 #if((GLM_ARCH & GLM_ARCH_SSE3) == GLM_ARCH_SSE3)
    00302 #       include <pmmintrin.h>
    00303 #endif//GLM_ARCH
    00304 #if((GLM_ARCH & GLM_ARCH_SSE2) == GLM_ARCH_SSE2)
    00305 #       include <emmintrin.h>
    00306 #endif//GLM_ARCH
    00307 #endif//(GLM_ARCH != GLM_ARCH_PURE)
    00308
    00309 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
    00310 #       define GLM_MESSAGE_ARCH_DISPLAYED
    00311 #       if(GLM_ARCH == GLM_ARCH_PURE)
    00312 #               pragma message("GLM: Platform independent")
    00313 #       elif(GLM_ARCH == GLM_ARCH_SSE2)
    00314 #               pragma message("GLM: SSE2 build platform")
    00315 #       elif(GLM_ARCH == GLM_ARCH_SSE3)
    00316 #               pragma message("GLM: SSE3 build platform")
    00317 #       elif(GLM_ARCH == GLM_ARCH_AVX)
    00318 #               pragma message("GLM: AVX build platform")
    00319 #       endif//GLM_ARCH
    00320 #endif//GLM_MESSAGE
    00321
    00323 // Components
    00324
    00325 //#define GLM_FORCE_ONLY_XYZW
    00326 #define GLM_COMPONENT_GLSL_NAMES                        0
    00327 #define GLM_COMPONENT_ONLY_XYZW                         1 // To disable multiple vector component names access.
    00328 #define GLM_COMPONENT_MS_EXT                            2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
    00329
    00330 #ifndef GLM_FORCE_ONLY_XYZW
    00331 #       if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS))
    00332 #               define GLM_COMPONENT GLM_COMPONENT_MS_EXT
    00333 #       else
    00334 #               define GLM_COMPONENT GLM_COMPONENT_GLSL_NAMES
    00335 #       endif
    00336 #else
    00337 #       define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
    00338 #endif
    00339
    00340 #if((GLM_COMPONENT == GLM_COMPONENT_MS_EXT) && !(GLM_COMPILER & GLM_COMPILER_VC))
    00341 #       error "GLM_COMPONENT value is GLM_COMPONENT_MS_EXT but this is not allowed with the current compiler."
    00342 #endif
    00343
    00344 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
    00345 #       define GLM_MESSAGE_COMPONENT_DISPLAYED
    00346 #       if(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
    00347 #               pragma message("GLM: GLSL multiple vector component names")
    00348 #       elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
    00349 #               pragma message("GLM: x,y,z,w vector component names only")
    00350 #       elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
    00351 #               pragma message("GLM: Multiple vector component names through Visual C++ language extensions")
    00352 #       else
    00353 #               error "GLM_COMPONENT value unknown"
    00354 #       endif//GLM_MESSAGE_COMPONENT_DISPLAYED
    00355 #endif//GLM_MESSAGE
    00356
    00358 // Static assert
    00359
    00360 #if(GLM_LANG == GLM_LANG_CXX0X)
    00361 #       define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
    00362 #elif(defined(BOOST_STATIC_ASSERT))
    00363 #       define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
    00364 #elif(GLM_COMPILER & GLM_COMPILER_VC)
    00365 #       define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
    00366 #else
    00367 #       define GLM_STATIC_ASSERT(x, message)
    00368 #       define GLM_STATIC_ASSERT_NULL
    00369 #endif//GLM_LANG
    00370
    00372 // inline
    00373
    00374 // User defines: GLM_FORCE_INLINE
    00375
    00376 #if(defined(GLM_FORCE_INLINE))
    00377 #       if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
    00378 #               define GLM_INLINE __forceinline
    00379 #       elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
    00380 #               define GLM_INLINE __attribute__((always_inline))
    00381 #       else
    00382 #               define GLM_INLINE inline
    00383 #       endif//GLM_COMPILER
    00384 #else
    00385 #       define GLM_INLINE inline
    00386 #endif//defined(GLM_FORCE_INLINE)
    00387
    00389 // Swizzle operators
    00390
    00391 // User defines: GLM_SWIZZLE_XYZW GLM_SWIZZLE_RGBA GLM_SWIZZLE_STQP GLM_SWIZZLE
    00392
    00393 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
    00394 #       define GLM_MESSAGE_SWIZZLE_DISPLAYED
    00395 #       if(defined(GLM_SWIZZLE))
    00396 #               pragma message("GLM: Full swizzling operator enabled")
    00397 #       elif(!defined(GLM_SWIZZLE_XYZW) && !defined(GLM_SWIZZLE_RGBA) && !defined(GLM_SWIZZLE_STQP) && !defined(GLM_SWIZZLE))
    00398 #               pragma message("GLM: No swizzling operator enabled")
    00399 #       else
    00400 #               pragma message("GLM: Partial swizzling operator enabled")
    00401 #       endif
    00402 #endif//GLM_MESSAGE
    00403
    00405 // Precision
    00406
    00407 #define GLM_PRECISION_NONE                      0x00000000
    00408
    00409 #define GLM_PRECISION_LOWP_FLOAT        0x00000011
    00410 #define GLM_PRECISION_MEDIUMP_FLOAT     0x00000012
    00411 #define GLM_PRECISION_HIGHP_FLOAT       0x00000013
    00412
    00413 #define GLM_PRECISION_LOWP_INT          0x00001100
    00414 #define GLM_PRECISION_MEDIUMP_INT       0x00001200
    00415 #define GLM_PRECISION_HIGHP_INT         0x00001300
    00416
    00417 #define GLM_PRECISION_LOWP_UINT         0x00110000
    00418 #define GLM_PRECISION_MEDIUMP_UINT      0x00120000
    00419 #define GLM_PRECISION_HIGHP_UINT        0x00130000
    00420
    00421 #endif//glm_setup