setup.hpp
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef glm_setup
00030 #define glm_setup
00031 
00033 // Version
00034 
00035 #define GLM_VERSION                                     93
00036 #define GLM_VERSION_MAJOR                       0
00037 #define GLM_VERSION_MINOR                       9
00038 #define GLM_VERSION_PATCH                       3
00039 #define GLM_VERSION_REVISION            1
00040 
00042 // Platform
00043 
00044 #define GLM_PLATFORM_UNKNOWN            0x00000000
00045 #define GLM_PLATFORM_WINDOWS            0x00010000
00046 #define GLM_PLATFORM_LINUX                      0x00020000
00047 #define GLM_PLATFORM_APPLE                      0x00040000
00048 //#define GLM_PLATFORM_IOS                      0x00080000
00049 #define GLM_PLATFORM_ANDROID            0x00100000
00050 #define GLM_PLATFORM_CHROME_NACL        0x00200000
00051 #define GLM_PLATFORM_UNIX                       0x00400000
00052 
00053 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
00054 #       define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
00055 #elif defined(__APPLE__)
00056 #   define GLM_PLATFORM GLM_PLATFORM_APPLE
00057 #elif defined(_WIN32)
00058 #       define GLM_PLATFORM GLM_PLATFORM_WINDOWS
00059 #elif defined(__native_client__)
00060 #       define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
00061 #elif defined(ANDROID)
00062 #   define GLM_PLATFORM GLM_PLATFORM_ANDROID
00063 #elif defined(__linux)
00064 #   define GLM_PLATFORM GLM_PLATFORM_LINUX
00065 #elif defined(__unix)
00066 #   define GLM_PLATFORM GLM_PLATFORM_UNIX
00067 #else
00068 #       define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
00069 #endif//
00070 
00071 // Report platform detection
00072 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
00073 #       define GLM_MESSAGE_PLATFORM_DISPLAYED
00074 #       if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
00075 #               pragma message("GLM: Windows platform detected")
00076 //#     elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
00077 //#             pragma message("GLM: iOS platform detected")
00078 #       elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
00079 #               pragma message("GLM: Apple platform detected")
00080 #       elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
00081 #               pragma message("GLM: Linux platform detected")
00082 #       elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
00083 #               pragma message("GLM: UNIX platform detected")
00084 #       elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
00085 #               pragma message("GLM: Android platform detected")
00086 #       elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
00087 #               pragma message("GLM: Chrone Native Client detected")
00088 #       elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
00089 #               pragma message("GLM: platform unknown")
00090 #       else
00091 #               pragma message("GLM: platform not detected")
00092 #       endif
00093 #endif//GLM_MESSAGE
00094 
00096 // Compiler
00097 
00098 // User defines: GLM_FORCE_COMPILER_UNKNOWN
00099 // TODO ? __llvm__ 
00100 
00101 #define GLM_COMPILER_UNKNOWN            0x00000000
00102 
00103 // Visual C++ defines
00104 #define GLM_COMPILER_VC                         0x01000000
00105 #define GLM_COMPILER_VC2                        0x01000010
00106 #define GLM_COMPILER_VC4                        0x01000020
00107 #define GLM_COMPILER_VC5                        0x01000030
00108 #define GLM_COMPILER_VC6                        0x01000040
00109 #define GLM_COMPILER_VC2002                     0x01000050
00110 #define GLM_COMPILER_VC2003                     0x01000060
00111 #define GLM_COMPILER_VC2005                     0x01000070
00112 #define GLM_COMPILER_VC2008                     0x01000080
00113 #define GLM_COMPILER_VC2010                     0x01000090
00114 #define GLM_COMPILER_VC2011                     0x010000A0
00115 
00116 // GCC defines
00117 #define GLM_COMPILER_GCC            0x02000000
00118 #define GLM_COMPILER_GCC_LLVM       0x02000001
00119 #define GLM_COMPILER_GCC_CLANG      0x02000002
00120 #define GLM_COMPILER_GCC30                      0x02000010
00121 #define GLM_COMPILER_GCC31                      0x02000020
00122 #define GLM_COMPILER_GCC32                      0x02000030
00123 #define GLM_COMPILER_GCC33                      0x02000040
00124 #define GLM_COMPILER_GCC34                      0x02000050
00125 #define GLM_COMPILER_GCC35                      0x02000060
00126 #define GLM_COMPILER_GCC40                      0x02000070
00127 #define GLM_COMPILER_GCC41                      0x02000080
00128 #define GLM_COMPILER_GCC42                      0x02000090
00129 #define GLM_COMPILER_GCC43                      0x020000A0
00130 #define GLM_COMPILER_GCC44                      0x020000B0
00131 #define GLM_COMPILER_GCC45                      0x020000C0
00132 #define GLM_COMPILER_GCC46                      0x020000D0
00133 #define GLM_COMPILER_GCC47                      0x020000E0
00134 #define GLM_COMPILER_GCC48                      0x020000F0
00135 #define GLM_COMPILER_GCC49                      0x02000100
00136 #define GLM_COMPILER_GCC50                      0x02000200
00137 
00138 // G++ command line to display defined
00139 // echo "" | g++ -E -dM -x c++ - | sort
00140 
00141 // Borland C++ defines. How to identify BC?
00142 #define GLM_COMPILER_BC                         0x04000000
00143 #define GLM_COMPILER_BCB4                       0x04000100
00144 #define GLM_COMPILER_BCB5                       0x04000200
00145 #define GLM_COMPILER_BCB6                       0x04000300
00146 //#define GLM_COMPILER_BCBX                     0x04000400 // What's the version value?
00147 #define GLM_COMPILER_BCB2009            0x04000500
00148 
00149 // CodeWarrior
00150 #define GLM_COMPILER_CODEWARRIOR        0x08000000
00151 
00152 // CUDA
00153 #define GLM_COMPILER_CUDA           0x10000000
00154 #define GLM_COMPILER_CUDA30                     0x10000010
00155 #define GLM_COMPILER_CUDA31                     0x10000020
00156 #define GLM_COMPILER_CUDA32                     0x10000030
00157 #define GLM_COMPILER_CUDA40                     0x10000040
00158 #define GLM_COMPILER_CUDA41                     0x10000050
00159 #define GLM_COMPILER_CUDA42                     0x10000060
00160 
00161 // Clang
00162 #define GLM_COMPILER_CLANG          0x20000000
00163 #define GLM_COMPILER_CLANG26            0x20000010
00164 #define GLM_COMPILER_CLANG27            0x20000020
00165 #define GLM_COMPILER_CLANG28            0x20000030
00166 #define GLM_COMPILER_CLANG29            0x20000040
00167 #define GLM_COMPILER_CLANG30            0x20000050
00168 #define GLM_COMPILER_CLANG31            0x20000060
00169 #define GLM_COMPILER_CLANG32            0x20000070
00170 #define GLM_COMPILER_CLANG33            0x20000080
00171 
00172 // LLVM GCC
00173 #define GLM_COMPILER_LLVM_GCC           0x40000000
00174 
00175 // Intel
00176 #define GLM_COMPILER_INTEL          0x80000000
00177 #define GLM_COMPILER_INTEL9                     0x80000010
00178 #define GLM_COMPILER_INTEL10_0          0x80000020
00179 #define GLM_COMPILER_INTEL10_1          0x80000030
00180 #define GLM_COMPILER_INTEL11_0          0x80000040
00181 #define GLM_COMPILER_INTEL11_1          0x80000050
00182 #define GLM_COMPILER_INTEL12_0          0x80000060
00183 #define GLM_COMPILER_INTEL12_1          0x80000070
00184 #define GLM_COMPILER_INTEL13_0          0x80000080
00185 
00186 // Build model
00187 #define GLM_MODEL_32                            0x00000010
00188 #define GLM_MODEL_64                            0x00000020
00189 
00190 // Force generic C++ compiler
00191 #ifdef GLM_FORCE_COMPILER_UNKNOWN
00192 #       define GLM_COMPILER GLM_COMPILER_UNKNOWN
00193 
00194 #elif defined(__INTEL_COMPILER)
00195 #       if __INTEL_COMPILER == 900
00196 #               define GLM_COMPILER GLM_COMPILER_INTEL9
00197 #       elif __INTEL_COMPILER == 1000
00198 #               define GLM_COMPILER GLM_COMPILER_INTEL10_0
00199 #       elif __INTEL_COMPILER == 1010
00200 #               define GLM_COMPILER GLM_COMPILER_INTEL10_1
00201 #       elif __INTEL_COMPILER == 1100
00202 #               define GLM_COMPILER GLM_COMPILER_INTEL11_0
00203 #       elif __INTEL_COMPILER == 1110
00204 #               define GLM_COMPILER GLM_COMPILER_INTEL11_1
00205 #       elif __INTEL_COMPILER == 1200
00206 #               define GLM_COMPILER GLM_COMPILER_INTEL12_0
00207 #       elif __INTEL_COMPILER == 1210
00208 #               define GLM_COMPILER GLM_COMPILER_INTEL12_1
00209 #       elif __INTEL_COMPILER == 1300
00210 #               define GLM_COMPILER GLM_COMPILER_INTEL13_0
00211 #       else
00212 #               define GLM_COMPILER GLM_COMPILER_INTEL
00213 #       endif
00214 
00215 // CUDA
00216 #elif defined(__CUDACC__)
00217 #       define GLM_COMPILER GLM_COMPILER_CUDA
00218 /*
00219 #       if CUDA_VERSION < 3000
00220 #               error "GLM requires CUDA 3.0 or higher"
00221 #       elif CUDA_VERSION == 3000
00222 #               define GLM_COMPILER GLM_COMPILER_CUDA30 
00223 #       elif CUDA_VERSION == 3010
00224 #               define GLM_COMPILER GLM_COMPILER_CUDA31 
00225 #       elif CUDA_VERSION == 3020
00226 #               define GLM_COMPILER GLM_COMPILER_CUDA32 
00227 #       elif CUDA_VERSION == 4000
00228 #               define GLM_COMPILER GLM_COMPILER_CUDA40 
00229 #       elif CUDA_VERSION == 4010
00230 #               define GLM_COMPILER GLM_COMPILER_CUDA41 
00231 #       elif CUDA_VERSION == 4020
00232 #               define GLM_COMPILER GLM_COMPILER_CUDA42
00233 #       else
00234 #               define GLM_COMPILER GLM_COMPILER_CUDA
00235 #       endif
00236 */
00237 
00238 // Visual C++
00239 #elif defined(_MSC_VER)
00240 #       if _MSC_VER == 900
00241 #               define GLM_COMPILER GLM_COMPILER_VC2
00242 #       elif _MSC_VER == 1000
00243 #               define GLM_COMPILER GLM_COMPILER_VC4
00244 #       elif _MSC_VER == 1100
00245 #               define GLM_COMPILER GLM_COMPILER_VC5
00246 #       elif _MSC_VER == 1200
00247 #               define GLM_COMPILER GLM_COMPILER_VC6
00248 #       elif _MSC_VER == 1300
00249 #               define GLM_COMPILER GLM_COMPILER_VC2002
00250 #       elif _MSC_VER == 1310
00251 #               define GLM_COMPILER GLM_COMPILER_VC2003
00252 #       elif _MSC_VER == 1400
00253 #               define GLM_COMPILER GLM_COMPILER_VC2005
00254 #       elif _MSC_VER == 1500
00255 #               define GLM_COMPILER GLM_COMPILER_VC2008
00256 #       elif _MSC_VER == 1600
00257 #               define GLM_COMPILER GLM_COMPILER_VC2010
00258 #       elif _MSC_VER == 1700
00259 #               define GLM_COMPILER GLM_COMPILER_VC2011
00260 #       else//_MSC_VER
00261 #               define GLM_COMPILER GLM_COMPILER_VC
00262 #       endif//_MSC_VER
00263 
00264 // Clang
00265 #elif defined(__clang__)
00266 #       if(__clang_major__ == 2) && (__clang_minor__ == 6)
00267 #               define GLM_COMPILER GLM_COMPILER_CLANG26
00268 #       elif(__clang_major__ == 2) && (__clang_minor__ == 7)
00269 #               define GLM_COMPILER GLM_COMPILER_CLANG27
00270 #       elif(__clang_major__ == 2) && (__clang_minor__ == 8)
00271 #               define GLM_COMPILER GLM_COMPILER_CLANG28
00272 #       elif(__clang_major__ == 2) && (__clang_minor__ == 9)
00273 #               define GLM_COMPILER GLM_COMPILER_CLANG29
00274 #       elif(__clang_major__ == 3) && (__clang_minor__ == 0)
00275 #               define GLM_COMPILER GLM_COMPILER_CLANG30
00276 #       elif(__clang_major__ == 3) && (__clang_minor__ == 1)
00277 #               define GLM_COMPILER GLM_COMPILER_CLANG31
00278 #       elif(__clang_major__ == 3) && (__clang_minor__ == 2)
00279 #               define GLM_COMPILER GLM_COMPILER_CLANG32
00280 #       elif(__clang_major__ == 3) && (__clang_minor__ == 3)
00281 #               define GLM_COMPILER GLM_COMPILER_CLANG33
00282 #       else
00283 #               define GLM_COMPILER GLM_COMPILER_CLANG
00284 #   endif
00285 
00286 // G++ 
00287 #elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
00288 #   if defined (__llvm__)
00289 #       define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_LLVM
00290 #   elif defined (__clang__)
00291 #       define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_CLANG
00292 #   else
00293 #       define GLM_COMPILER_GCC_EXTRA 0
00294 #   endif
00295 #
00296 #       if   (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
00297 #               define GLM_COMPILER GLM_COMPILER_GCC32
00298 #       elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
00299 #               define GLM_COMPILER GLM_COMPILER_GCC33
00300 #       elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
00301 #               define GLM_COMPILER GLM_COMPILER_GCC34
00302 #       elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
00303 #               define GLM_COMPILER GLM_COMPILER_GCC35
00304 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
00305 #               define GLM_COMPILER (GLM_COMPILER_GCC40 | GLM_COMPILER_GCC_EXTRA)
00306 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
00307 #               define GLM_COMPILER (GLM_COMPILER_GCC41 | GLM_COMPILER_GCC_EXTRA)
00308 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
00309 #               define GLM_COMPILER (GLM_COMPILER_GCC42 | GLM_COMPILER_GCC_EXTRA)
00310 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
00311 #               define GLM_COMPILER (GLM_COMPILER_GCC43 | GLM_COMPILER_GCC_EXTRA)
00312 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
00313 #               define GLM_COMPILER (GLM_COMPILER_GCC44 | GLM_COMPILER_GCC_EXTRA)
00314 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
00315 #               define GLM_COMPILER (GLM_COMPILER_GCC45 | GLM_COMPILER_GCC_EXTRA)
00316 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
00317 #               define GLM_COMPILER (GLM_COMPILER_GCC46 | GLM_COMPILER_GCC_EXTRA)
00318 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
00319 #               define GLM_COMPILER (GLM_COMPILER_GCC47 | GLM_COMPILER_GCC_EXTRA)
00320 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
00321 #               define GLM_COMPILER (GLM_COMPILER_GCC48 | GLM_COMPILER_GCC_EXTRA)
00322 #       elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
00323 #               define GLM_COMPILER (GLM_COMPILER_GCC49 | GLM_COMPILER_GCC_EXTRA)
00324 #       elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
00325 #               define GLM_COMPILER (GLM_COMPILER_GCC50 | GLM_COMPILER_GCC_EXTRA)
00326 #       else
00327 #               define GLM_COMPILER (GLM_COMPILER_GCC | GLM_COMPILER_GCC_EXTRA)
00328 #       endif
00329 
00330 // Borland C++
00331 #elif defined(_BORLANDC_)
00332 #       if defined(VER125)
00333 #               define GLM_COMPILER GLM_COMPILER_BCB4
00334 #       elif defined(VER130)
00335 #               define GLM_COMPILER GLM_COMPILER_BCB5
00336 #       elif defined(VER140)
00337 #               define GLM_COMPILER GLM_COMPILER_BCB6
00338 #       elif defined(VER200)
00339 #               define GLM_COMPILER GLM_COMPILER_BCB2009
00340 #       else
00341 #               define GLM_COMPILER GLM_COMPILER_BC
00342 #       endif
00343 
00344 // Codewarrior
00345 #elif defined(__MWERKS__)
00346 #       define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
00347 
00348 #else
00349 #       define GLM_COMPILER GLM_COMPILER_UNKNOWN
00350 #endif
00351 
00352 #ifndef GLM_COMPILER
00353 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
00354 #endif//GLM_COMPILER
00355 
00356 // Report compiler detection
00357 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
00358 #       define GLM_MESSAGE_COMPILER_DISPLAYED
00359 #       if(GLM_COMPILER & GLM_COMPILER_CUDA)
00360 #               pragma message("GLM: CUDA compiler detected")
00361 #       elif(GLM_COMPILER & GLM_COMPILER_VC)
00362 #               pragma message("GLM: Visual C++ compiler detected")
00363 #       elif(GLM_COMPILER & GLM_COMPILER_CLANG)
00364 #               pragma message("GLM: Clang compiler detected")
00365 #       elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
00366 #               pragma message("GLM: LLVM GCC compiler detected")
00367 #       elif(GLM_COMPILER & GLM_COMPILER_GCC)
00368 #       if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
00369 #           pragma message("GLM: LLVM GCC compiler detected")
00370 #       elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
00371 #           pragma message("GLM: CLANG compiler detected")
00372 #       else
00373 #           pragma message("GLM: GCC compiler detected")
00374 #       endif
00375 #       elif(GLM_COMPILER & GLM_COMPILER_BC)
00376 #               pragma message("GLM: Borland compiler detected but not supported")
00377 #       elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
00378 #               pragma message("GLM: Codewarrior compiler detected but not supported")
00379 #       else
00380 #               pragma message("GLM: Compiler not detected")
00381 #       endif
00382 #endif//GLM_MESSAGE
00383 
00385 // Build model //
00386 
00387 #if((defined(__WORDSIZE) && (__WORDSIZE == 64)) || defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__))
00388 #               define GLM_MODEL        GLM_MODEL_64
00389 #elif(defined(__i386__) || defined(__ppc__))
00390 #       define GLM_MODEL        GLM_MODEL_32
00391 #else
00392 #       define GLM_MODEL        GLM_MODEL_32
00393 #endif//
00394 
00395 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
00396 #error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
00397 #endif//GLM_MODEL
00398 
00399 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
00400 #       define GLM_MESSAGE_MODEL_DISPLAYED
00401 #       if(GLM_MODEL == GLM_MODEL_64)
00402 #               pragma message("GLM: 64 bits model")
00403 #       elif(GLM_MODEL == GLM_MODEL_32)
00404 #               pragma message("GLM: 32 bits model")
00405 #       endif//GLM_MODEL
00406 #endif//GLM_MESSAGE
00407 
00409 // C++ Version //
00410 
00411 // User defines: GLM_FORCE_CXX98
00412 
00413 #define GLM_LANG_CXX                    (0 << 0)
00414 #define GLM_LANG_CXX98                  ((1 << 1) | GLM_LANG_CXX)
00415 #define GLM_LANG_CXX03                  ((1 << 2) | GLM_LANG_CXX98)
00416 #define GLM_LANG_CXX0X                  ((1 << 3) | GLM_LANG_CXX03)
00417 #define GLM_LANG_CXX11                  ((1 << 4) | GLM_LANG_CXX0X)
00418 #define GLM_LANG_CXXMS                  (1 << 5)
00419 #define GLM_LANG_CXXGNU                 (1 << 6)
00420 
00421 #if(defined(GLM_FORCE_CXX11))
00422 #       define GLM_LANG GLM_LANG_CXX11
00423 #elif(defined(GLM_FORCE_CXX03))
00424 #       define GLM_LANG GLM_LANG_CXX03
00425 #elif(defined(GLM_FORCE_CXX98))
00426 #       define GLM_LANG GLM_LANG_CXX98
00427 #else
00428 //  -std=c++0x or -std=gnu++0x
00429 #       if(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) 
00430 #               define GLM_LANG GLM_LANG_CXX0X
00431 #       elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS))
00432 #               define GLM_LANG GLM_LANG_CXXMS
00433 #       elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && !defined(_MSC_EXTENSIONS))
00434 #               if(GLM_COMPILER >= GLM_COMPILER_VC2010)
00435 #                       define GLM_LANG GLM_LANG_CXX0X
00436 #               else
00437 #                       define GLM_LANG GLM_LANG_CXX98
00438 #               endif//(GLM_COMPILER == GLM_COMPILER_VC2010)
00439 #       elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) //&& defined(__STRICT_ANSI__))
00440 #               define GLM_LANG GLM_LANG_CXX98
00441 #       elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG) 
00442 #               define GLM_LANG GLM_LANG_CXX98
00443 #       else
00444 #               define GLM_LANG GLM_LANG_CXX
00445 #       endif
00446 #endif
00447 
00448 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
00449 #       define GLM_MESSAGE_LANG_DISPLAYED
00450 #       if(GLM_LANG == GLM_LANG_CXX98)
00451 #               pragma message("GLM: C++98")
00452 #       elif(GLM_LANG == GLM_LANG_CXX03)
00453 #               pragma message("GLM: C++03")
00454 #       elif(GLM_LANG == GLM_LANG_CXX0X)
00455 #               pragma message("GLM: C++0x")
00456 #       elif(GLM_LANG == GLM_LANG_CXX11)
00457 #               pragma message("GLM: C++11")
00458 #       elif(GLM_LANG == GLM_LANG_CXXGNU)
00459 #               pragma message("GLM: C++ with GNU language extensions")
00460 #       elif(GLM_LANG == GLM_LANG_CXXMS)
00461 #               pragma message("GLM: C++ with VC language extensions")
00462 #   else
00463 #       pragma message("GLM: C++ language undetected")
00464 #       endif//GLM_MODEL
00465 #endif//GLM_MESSAGE
00466 
00468 // Platform 
00469 
00470 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_AVX
00471 
00472 #define GLM_ARCH_PURE           0x0000 //(0x0000)
00473 #define GLM_ARCH_SSE2           0x0001 //(0x0001)
00474 #define GLM_ARCH_SSE3           0x0003 //(0x0002 | GLM_ARCH_SSE2)
00475 #define GLM_ARCH_AVX            0x0007 //(0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00476 
00477 #if(defined(GLM_FORCE_PURE))
00478 #       define GLM_ARCH GLM_ARCH_PURE
00479 #elif(defined(GLM_FORCE_AVX))
00480 #       define GLM_ARCH GLM_ARCH_AVX
00481 #elif(defined(GLM_FORCE_SSE3))
00482 #       define GLM_ARCH GLM_ARCH_SSE3
00483 #elif(defined(GLM_FORCE_SSE2))
00484 #       define GLM_ARCH GLM_ARCH_SSE2
00485 #elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
00486 #       if(defined(_M_CEE_PURE))
00487 #               define GLM_ARCH GLM_ARCH_PURE
00488 #       elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
00489 #               if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
00490 #                       define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1)
00491 #               else
00492 #                       define GLM_ARCH GLM_ARCH_SSE3
00493 #               endif
00494 #       elif(GLM_COMPILER >= GLM_COMPILER_VC2008) 
00495 #               define GLM_ARCH GLM_ARCH_SSE3
00496 #       elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
00497 #               define GLM_ARCH GLM_ARCH_SSE2
00498 #       else
00499 #               define GLM_ARCH GLM_ARCH_PURE
00500 #       endif
00501 #elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
00502 #       if(defined(__AVX__))
00503 #               define GLM_ARCH GLM_ARCH_AVX
00504 #       elif(defined(__SSE3__))
00505 #               define GLM_ARCH GLM_ARCH_SSE3
00506 #       elif(defined(__SSE2__))
00507 #               define GLM_ARCH GLM_ARCH_SSE2
00508 #       else
00509 #               define GLM_ARCH GLM_ARCH_PURE
00510 #       endif
00511 #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
00512 #       if(defined(__AVX__))
00513 #               define GLM_ARCH GLM_ARCH_AVX
00514 #       elif(defined(__SSE3__))
00515 #               define GLM_ARCH GLM_ARCH_SSE3
00516 #       elif(defined(__SSE2__))
00517 #               define GLM_ARCH GLM_ARCH_SSE2
00518 #       else
00519 #               define GLM_ARCH GLM_ARCH_PURE
00520 #       endif
00521 #else
00522 #       define GLM_ARCH GLM_ARCH_PURE
00523 #endif
00524 
00525 #if(GLM_ARCH != GLM_ARCH_PURE)
00526 #if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
00527 #       include <immintrin.h>
00528 #endif//GLM_ARCH
00529 #if((GLM_ARCH & GLM_ARCH_SSE3) == GLM_ARCH_SSE3)
00530 #       include <pmmintrin.h>
00531 #endif//GLM_ARCH
00532 #if((GLM_ARCH & GLM_ARCH_SSE2) == GLM_ARCH_SSE2)
00533 #       include <emmintrin.h>
00534 #endif//GLM_ARCH
00535 #endif//(GLM_ARCH != GLM_ARCH_PURE)
00536 
00537 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
00538 #       define GLM_MESSAGE_ARCH_DISPLAYED
00539 #       if(GLM_ARCH == GLM_ARCH_PURE)
00540 #               pragma message("GLM: Platform independent")
00541 #       elif(GLM_ARCH == GLM_ARCH_SSE2)
00542 #               pragma message("GLM: SSE2 instruction set")
00543 #       elif(GLM_ARCH == GLM_ARCH_SSE3)
00544 #               pragma message("GLM: SSE3 instruction set")
00545 #       elif(GLM_ARCH == GLM_ARCH_AVX)
00546 #               pragma message("GLM: AVX instruction set")
00547 #       endif//GLM_ARCH
00548 #endif//GLM_MESSAGE
00549 
00551 // Support check macros
00552 
00553 #define GLM_SUPPORT_ANONYMOUS_UNION() \
00554         ((GLM_LANG & GLM_LANG_CXX98) == GLM_LANG_CXX98)
00555 
00556 #define GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() \
00557         (((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) || ((GLM_LANG & GLM_LANG_CXXMS) == GLM_LANG_CXXMS) || ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_LANG == GLM_LANG_CXX0X)))
00558 
00559 #define GLM_SUPPORT_SWIZZLE_OPERATOR() \
00560         (/*defined(GLM_SWIZZLE) && */GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE())
00561 
00562 #define GLM_SUPPORT_SWIZZLE_FUNCTION() defined(GLM_SWIZZLE)
00563 
00565 // Components
00566 
00567 //#define GLM_FORCE_ONLY_XYZW
00568 #define GLM_COMPONENT_ONLY_XYZW                         0 // To disable multiple vector component names access.
00569 #define GLM_COMPONENT_CXX98                                     1 //  
00570 #define GLM_COMPONENT_CXX11                                     2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
00571 
00572 #if(GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() && !defined(GLM_FORCE_ONLY_XYZW))
00573 #       define GLM_COMPONENT GLM_COMPONENT_CXX11
00574 #elif(GLM_SUPPORT_ANONYMOUS_UNION() && !defined(GLM_FORCE_ONLY_XYZW))
00575 #       define GLM_COMPONENT GLM_COMPONENT_CXX98
00576 #else
00577 #       define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
00578 #endif
00579 
00580 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
00581 #       define GLM_MESSAGE_COMPONENT_DISPLAYED
00582 #       if(GLM_COMPONENT == GLM_COMPONENT_CXX98)
00583 #               pragma message("GLM: x,y,z,w; r,g,b,a; s,t,p,q component names except of half based vector types")
00584 #       elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
00585 #               pragma message("GLM: x,y,z,w component names for all vector types")
00586 #       elif(GLM_COMPONENT == GLM_COMPONENT_CXX11)
00587 #               pragma message("GLM: x,y,z,w; r,g,b,a; s,t,p,q component names for all vector types")
00588 #       else
00589 #               error "GLM: GLM_COMPONENT value unknown"
00590 #       endif//GLM_MESSAGE_COMPONENT_DISPLAYED
00591 #endif//GLM_MESSAGE
00592 
00594 // Static assert
00595 
00596 #if(GLM_LANG == GLM_LANG_CXX0X)
00597 #       define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
00598 #elif(defined(BOOST_STATIC_ASSERT))
00599 #       define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
00600 #elif(GLM_COMPILER & GLM_COMPILER_VC)
00601 #       define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
00602 #else
00603 #       define GLM_STATIC_ASSERT(x, message)
00604 #       define GLM_STATIC_ASSERT_NULL
00605 #endif//GLM_LANG
00606 
00608 // Qualifiers 
00609 
00610 // User defines: GLM_FORCE_INLINE GLM_FORCE_CUDA
00611 
00612 #if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
00613 #   define GLM_CUDA_FUNC_DEF __device__ __host__ 
00614 #       define GLM_CUDA_FUNC_DECL __device__ __host__ 
00615 #else
00616 #   define GLM_CUDA_FUNC_DEF
00617 #       define GLM_CUDA_FUNC_DECL
00618 #endif
00619 
00620 #if GLM_COMPILER & GLM_COMPILER_GCC
00621 #define GLM_VAR_USED __attribute__ ((unused))
00622 #else
00623 #define GLM_VAR_USED
00624 #endif
00625 
00626 #if(defined(GLM_FORCE_INLINE))
00627 #   if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
00628 #       define GLM_INLINE __forceinline
00629 #   elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
00630 #       define GLM_INLINE __attribute__((always_inline))
00631 #   else
00632 #       define GLM_INLINE inline
00633 #   endif//GLM_COMPILER
00634 #else
00635 #   define GLM_INLINE inline
00636 #endif//defined(GLM_FORCE_INLINE)
00637 
00638 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
00639 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
00640 
00642 // Swizzle operators
00643 
00644 // User defines: GLM_SWIZZLE
00645 
00646 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
00647 #       define GLM_MESSAGE_SWIZZLE_DISPLAYED
00648 #       if(GLM_SUPPORT_SWIZZLE_OPERATOR())
00649 #               pragma message("GLM: Swizzling operators enabled")
00650 #       elif(GLM_SUPPORT_SWIZZLE_FUNCTION())
00651 #               pragma message("GLM: Swizzling operators supported through swizzling functions")
00652 #       else
00653 #               pragma message("GLM: Swizzling operators disabled")
00654 #       endif
00655 #endif//GLM_MESSAGE
00656 
00657 #endif//glm_setup