Home | History | Annotate | Download | only in detail
      1 ///////////////////////////////////////////////////////////////////////////////////
      2 /// OpenGL Mathematics (glm.g-truc.net)
      3 ///
      4 /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
      5 /// Permission is hereby granted, free of charge, to any person obtaining a copy
      6 /// of this software and associated documentation files (the "Software"), to deal
      7 /// in the Software without restriction, including without limitation the rights
      8 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9 /// copies of the Software, and to permit persons to whom the Software is
     10 /// furnished to do so, subject to the following conditions:
     11 ///
     12 /// The above copyright notice and this permission notice shall be included in
     13 /// all copies or substantial portions of the Software.
     14 ///
     15 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     21 /// THE SOFTWARE.
     22 ///
     23 /// @ref core
     24 /// @file glm/core/setup.hpp
     25 /// @date 2006-11-13 / 2013-03-30
     26 /// @author Christophe Riccio
     27 ///////////////////////////////////////////////////////////////////////////////////
     28 
     29 #ifndef GLM_SETUP_INCLUDED
     30 #define GLM_SETUP_INCLUDED
     31 
     32 #include <cassert>
     33 
     34 ///////////////////////////////////////////////////////////////////////////////////////////////////
     35 // Version
     36 
     37 #define GLM_VERSION					95
     38 #define GLM_VERSION_MAJOR			0
     39 #define GLM_VERSION_MINOR			9
     40 #define GLM_VERSION_PATCH			5
     41 #define GLM_VERSION_REVISION		3
     42 
     43 ///////////////////////////////////////////////////////////////////////////////////////////////////
     44 // Platform
     45 
     46 #define GLM_PLATFORM_UNKNOWN		0x00000000
     47 #define GLM_PLATFORM_WINDOWS		0x00010000
     48 #define GLM_PLATFORM_LINUX			0x00020000
     49 #define GLM_PLATFORM_APPLE			0x00040000
     50 //#define GLM_PLATFORM_IOS			0x00080000
     51 #define GLM_PLATFORM_ANDROID		0x00100000
     52 #define GLM_PLATFORM_CHROME_NACL	0x00200000
     53 #define GLM_PLATFORM_UNIX			0x00400000
     54 #define GLM_PLATFORM_QNXNTO			0x00800000
     55 #define GLM_PLATFORM_WINCE			0x01000000
     56 
     57 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
     58 #	define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
     59 #elif defined(__QNXNTO__)
     60 #	define GLM_PLATFORM GLM_PLATFORM_QNXNTO
     61 #elif defined(__APPLE__)
     62 #	define GLM_PLATFORM GLM_PLATFORM_APPLE
     63 #elif defined(WINCE)
     64 #	define GLM_PLATFORM GLM_PLATFORM_WINCE
     65 #elif defined(_WIN32)
     66 #	define GLM_PLATFORM GLM_PLATFORM_WINDOWS
     67 #elif defined(__native_client__)
     68 #	define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
     69 #elif defined(__ANDROID__)
     70 #	define GLM_PLATFORM GLM_PLATFORM_ANDROID
     71 #elif defined(__linux)
     72 #	define GLM_PLATFORM GLM_PLATFORM_LINUX
     73 #elif defined(__unix)
     74 #	define GLM_PLATFORM GLM_PLATFORM_UNIX
     75 #else
     76 #	define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
     77 #endif//
     78 
     79 // Report platform detection
     80 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
     81 #	define GLM_MESSAGE_PLATFORM_DISPLAYED
     82 #	if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
     83 #		pragma message("GLM: QNX platform detected")
     84 //#	elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
     85 //#		pragma message("GLM: iOS platform detected")
     86 #	elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
     87 #		pragma message("GLM: Apple platform detected")
     88 #	elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
     89 #		pragma message("GLM: WinCE platform detected")
     90 #	elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
     91 #		pragma message("GLM: Windows platform detected")
     92 #	elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
     93 #		pragma message("GLM: Native Client detected")
     94 #	elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
     95 #		pragma message("GLM: Android platform detected")
     96 #	elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
     97 #		pragma message("GLM: Linux platform detected")
     98 #	elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
     99 #		pragma message("GLM: UNIX platform detected")
    100 #	elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
    101 #		pragma message("GLM: platform unknown")
    102 #	else
    103 #		pragma message("GLM: platform not detected")
    104 #	endif
    105 #endif//GLM_MESSAGE
    106 
    107 ///////////////////////////////////////////////////////////////////////////////////////////////////
    108 // Compiler
    109 
    110 // User defines: GLM_FORCE_COMPILER_UNKNOWN
    111 // TODO ? __llvm__
    112 
    113 #define GLM_COMPILER_UNKNOWN		0x00000000
    114 
    115 // Intel
    116 #define GLM_COMPILER_INTEL			0x00100000
    117 #define GLM_COMPILER_INTEL9			0x00100010
    118 #define GLM_COMPILER_INTEL10_0		0x00100020
    119 #define GLM_COMPILER_INTEL10_1		0x00100030
    120 #define GLM_COMPILER_INTEL11_0		0x00100040
    121 #define GLM_COMPILER_INTEL11_1		0x00100050
    122 #define GLM_COMPILER_INTEL12_0		0x00100060
    123 #define GLM_COMPILER_INTEL12_1		0x00100070
    124 #define GLM_COMPILER_INTEL13_0		0x00100080
    125 
    126 // Visual C++ defines
    127 #define GLM_COMPILER_VC				0x01000000
    128 #define GLM_COMPILER_VC8			0x01000070
    129 #define GLM_COMPILER_VC9			0x01000080
    130 #define GLM_COMPILER_VC10			0x01000090
    131 #define GLM_COMPILER_VC11			0x010000A0
    132 #define GLM_COMPILER_VC12			0x010000B0
    133 
    134 // GCC defines
    135 #define GLM_COMPILER_GCC			0x02000000
    136 #define GLM_COMPILER_GCC34			0x02000050
    137 #define GLM_COMPILER_GCC35			0x02000060
    138 #define GLM_COMPILER_GCC40			0x02000070
    139 #define GLM_COMPILER_GCC41			0x02000080
    140 #define GLM_COMPILER_GCC42			0x02000090
    141 #define GLM_COMPILER_GCC43			0x020000A0
    142 #define GLM_COMPILER_GCC44			0x020000B0
    143 #define GLM_COMPILER_GCC45			0x020000C0
    144 #define GLM_COMPILER_GCC46			0x020000D0
    145 #define GLM_COMPILER_GCC47			0x020000E0
    146 #define GLM_COMPILER_GCC48			0x020000F0
    147 #define GLM_COMPILER_GCC49			0x02000100
    148 
    149 // Borland C++
    150 #define GLM_COMPILER_BC				0x04000000
    151 
    152 // CodeWarrior
    153 #define GLM_COMPILER_CODEWARRIOR	0x08000000
    154 
    155 // CUDA
    156 #define GLM_COMPILER_CUDA			0x10000000
    157 #define GLM_COMPILER_CUDA30			0x10000010
    158 #define GLM_COMPILER_CUDA31			0x10000020
    159 #define GLM_COMPILER_CUDA32			0x10000030
    160 #define GLM_COMPILER_CUDA40			0x10000040
    161 #define GLM_COMPILER_CUDA41			0x10000050
    162 #define GLM_COMPILER_CUDA42			0x10000060
    163 
    164 // Clang
    165 #define GLM_COMPILER_CLANG			0x20000000
    166 #define GLM_COMPILER_CLANG26		0x20000010
    167 #define GLM_COMPILER_CLANG27		0x20000020
    168 #define GLM_COMPILER_CLANG28		0x20000030
    169 #define GLM_COMPILER_CLANG29		0x20000040
    170 #define GLM_COMPILER_CLANG30		0x20000050
    171 #define GLM_COMPILER_CLANG31		0x20000060
    172 #define GLM_COMPILER_CLANG32		0x20000070
    173 #define GLM_COMPILER_CLANG33		0x20000080
    174 #define GLM_COMPILER_CLANG40		0x20000090
    175 #define GLM_COMPILER_CLANG41		0x200000A0
    176 #define GLM_COMPILER_CLANG42		0x200000B0
    177 #define GLM_COMPILER_CLANG43		0x200000C0
    178 #define GLM_COMPILER_CLANG50		0x200000D0
    179 
    180 // LLVM GCC
    181 #define GLM_COMPILER_LLVM_GCC		0x40000000
    182 
    183 // Build model
    184 #define GLM_MODEL_32				0x00000010
    185 #define GLM_MODEL_64				0x00000020
    186 
    187 // Force generic C++ compiler
    188 #ifdef GLM_FORCE_COMPILER_UNKNOWN
    189 #	define GLM_COMPILER GLM_COMPILER_UNKNOWN
    190 
    191 #elif defined(__INTEL_COMPILER)
    192 #	if __INTEL_COMPILER == 900
    193 #		define GLM_COMPILER GLM_COMPILER_INTEL9
    194 #	elif __INTEL_COMPILER == 1000
    195 #		define GLM_COMPILER GLM_COMPILER_INTEL10_0
    196 #	elif __INTEL_COMPILER == 1010
    197 #		define GLM_COMPILER GLM_COMPILER_INTEL10_1
    198 #	elif __INTEL_COMPILER == 1100
    199 #		define GLM_COMPILER GLM_COMPILER_INTEL11_0
    200 #	elif __INTEL_COMPILER == 1110
    201 #		define GLM_COMPILER GLM_COMPILER_INTEL11_1
    202 #	elif __INTEL_COMPILER == 1200
    203 #		define GLM_COMPILER GLM_COMPILER_INTEL12_0
    204 #	elif __INTEL_COMPILER == 1210
    205 #		define GLM_COMPILER GLM_COMPILER_INTEL12_1
    206 #	elif __INTEL_COMPILER >= 1300
    207 #		define GLM_COMPILER GLM_COMPILER_INTEL13_0
    208 #	else
    209 #		define GLM_COMPILER GLM_COMPILER_INTEL
    210 #	endif
    211 
    212 // CUDA
    213 #elif defined(__CUDACC__)
    214 #	if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
    215 #		include <cuda.h>  // make sure version is defined since nvcc does not define it itself!
    216 #	endif
    217 #	if CUDA_VERSION < 3000
    218 #		error "GLM requires CUDA 3.0 or higher"
    219 #	else
    220 #		define GLM_COMPILER GLM_COMPILER_CUDA
    221 #	endif
    222 
    223 // Visual C++
    224 #elif defined(_MSC_VER)
    225 #	if _MSC_VER < 1400
    226 #		error "GLM requires Visual C++ 2005 or higher"
    227 #	elif _MSC_VER == 1400
    228 #		define GLM_COMPILER GLM_COMPILER_VC8
    229 #	elif _MSC_VER == 1500
    230 #		define GLM_COMPILER GLM_COMPILER_VC9
    231 #	elif _MSC_VER == 1600
    232 #		define GLM_COMPILER GLM_COMPILER_VC10
    233 #	elif _MSC_VER == 1700
    234 #		define GLM_COMPILER GLM_COMPILER_VC11
    235 #	elif _MSC_VER >= 1800
    236 #		define GLM_COMPILER GLM_COMPILER_VC12
    237 #	else//_MSC_VER
    238 #		define GLM_COMPILER GLM_COMPILER_VC
    239 #	endif//_MSC_VER
    240 
    241 // Clang
    242 #elif defined(__clang__)
    243 #	if (__clang_major__ <= 1) || ((__clang_major__ == 2) && (__clang_minor__ < 6))
    244 #		error "GLM requires Clang 2.6 or higher"
    245 #	elif(__clang_major__ == 2) && (__clang_minor__ == 6)
    246 #		define GLM_COMPILER GLM_COMPILER_CLANG26
    247 #	elif(__clang_major__ == 2) && (__clang_minor__ == 7)
    248 #		define GLM_COMPILER GLM_COMPILER_CLANG27
    249 #	elif(__clang_major__ == 2) && (__clang_minor__ == 8)
    250 #		define GLM_COMPILER GLM_COMPILER_CLANG28
    251 #	elif(__clang_major__ == 2) && (__clang_minor__ == 9)
    252 #		define GLM_COMPILER GLM_COMPILER_CLANG29
    253 #	elif(__clang_major__ == 3) && (__clang_minor__ == 0)
    254 #		define GLM_COMPILER GLM_COMPILER_CLANG30
    255 #	elif(__clang_major__ == 3) && (__clang_minor__ == 1)
    256 #		define GLM_COMPILER GLM_COMPILER_CLANG31
    257 #	elif(__clang_major__ == 3) && (__clang_minor__ == 2)
    258 #		define GLM_COMPILER GLM_COMPILER_CLANG32
    259 #	elif(__clang_major__ == 3) && (__clang_minor__ == 3)
    260 #		define GLM_COMPILER GLM_COMPILER_CLANG33
    261 #	elif(__clang_major__ == 4) && (__clang_minor__ == 0)
    262 #		define GLM_COMPILER GLM_COMPILER_CLANG40
    263 #	elif(__clang_major__ == 4) && (__clang_minor__ == 1)
    264 #		define GLM_COMPILER GLM_COMPILER_CLANG41
    265 #	elif(__clang_major__ == 4) && (__clang_minor__ == 2)
    266 #		define GLM_COMPILER GLM_COMPILER_CLANG42
    267 #	elif(__clang_major__ == 4) && (__clang_minor__ >= 3)
    268 #		define GLM_COMPILER GLM_COMPILER_CLANG43
    269 #	elif(__clang_major__ > 4)
    270 #		define GLM_COMPILER GLM_COMPILER_CLANG50
    271 #	else
    272 #		define GLM_COMPILER GLM_COMPILER_CLANG
    273 #	endif
    274 
    275 // G++
    276 #elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
    277 #	if (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
    278 #		define GLM_COMPILER GLM_COMPILER_GCC34
    279 #	elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
    280 #		define GLM_COMPILER GLM_COMPILER_GCC35
    281 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
    282 #		define GLM_COMPILER (GLM_COMPILER_GCC40)
    283 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
    284 #		define GLM_COMPILER (GLM_COMPILER_GCC41)
    285 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
    286 #		define GLM_COMPILER (GLM_COMPILER_GCC42)
    287 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
    288 #		define GLM_COMPILER (GLM_COMPILER_GCC43)
    289 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
    290 #		define GLM_COMPILER (GLM_COMPILER_GCC44)
    291 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
    292 #		define GLM_COMPILER (GLM_COMPILER_GCC45)
    293 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
    294 #		define GLM_COMPILER (GLM_COMPILER_GCC46)
    295 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
    296 #		define GLM_COMPILER (GLM_COMPILER_GCC47)
    297 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
    298 #		define GLM_COMPILER (GLM_COMPILER_GCC48)
    299 #	elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
    300 #		define GLM_COMPILER (GLM_COMPILER_GCC49)
    301 #	elif (__GNUC__ > 4 )
    302 #		define GLM_COMPILER (GLM_COMPILER_GCC49)
    303 #	else
    304 #		define GLM_COMPILER (GLM_COMPILER_GCC)
    305 #	endif
    306 
    307 // Borland C++
    308 #elif defined(_BORLANDC_)
    309 #	define GLM_COMPILER GLM_COMPILER_BC
    310 
    311 // Codewarrior
    312 #elif defined(__MWERKS__)
    313 #	define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
    314 
    315 #else
    316 #	define GLM_COMPILER GLM_COMPILER_UNKNOWN
    317 #endif
    318 
    319 #ifndef GLM_COMPILER
    320 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
    321 #endif//GLM_COMPILER
    322 
    323 // Report compiler detection
    324 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
    325 #	define GLM_MESSAGE_COMPILER_DISPLAYED
    326 #	if(GLM_COMPILER & GLM_COMPILER_CUDA)
    327 #		pragma message("GLM: CUDA compiler detected")
    328 #	elif(GLM_COMPILER & GLM_COMPILER_VC)
    329 #		pragma message("GLM: Visual C++ compiler detected")
    330 #	elif(GLM_COMPILER & GLM_COMPILER_CLANG)
    331 #		pragma message("GLM: Clang compiler detected")
    332 #	elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
    333 #		pragma message("GLM: LLVM GCC compiler detected")
    334 #	elif(GLM_COMPILER & GLM_COMPILER_INTEL)
    335 #		pragma message("GLM: Intel Compiler detected")
    336 #	elif(GLM_COMPILER & GLM_COMPILER_GCC)
    337 #		if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
    338 #			pragma message("GLM: LLVM GCC compiler detected")
    339 #		elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
    340 #			pragma message("GLM: CLANG compiler detected")
    341 #		else
    342 #			pragma message("GLM: GCC compiler detected")
    343 #		endif
    344 #	elif(GLM_COMPILER & GLM_COMPILER_BC)
    345 #		pragma message("GLM: Borland compiler detected but not supported")
    346 #	elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
    347 #		pragma message("GLM: Codewarrior compiler detected but not supported")
    348 #	else
    349 #		pragma message("GLM: Compiler not detected")
    350 #	endif
    351 #endif//GLM_MESSAGE
    352 
    353 /////////////////
    354 // Build model //
    355 
    356 #if(defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__))
    357 #		define GLM_MODEL	GLM_MODEL_64
    358 #elif(defined(__i386__) || defined(__ppc__))
    359 #	define GLM_MODEL	GLM_MODEL_32
    360 #else
    361 #	define GLM_MODEL	GLM_MODEL_32
    362 #endif//
    363 
    364 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
    365 #	error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
    366 #endif//GLM_MODEL
    367 
    368 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
    369 #	define GLM_MESSAGE_MODEL_DISPLAYED
    370 #	if(GLM_MODEL == GLM_MODEL_64)
    371 #		pragma message("GLM: 64 bits model")
    372 #	elif(GLM_MODEL == GLM_MODEL_32)
    373 #		pragma message("GLM: 32 bits model")
    374 #	endif//GLM_MODEL
    375 #endif//GLM_MESSAGE
    376 
    377 /////////////////
    378 // C++ Version //
    379 
    380 // User defines: GLM_FORCE_CXX98
    381 
    382 #define GLM_LANG_CXX_FLAG			(1 << 0)
    383 #define GLM_LANG_CXX98_FLAG			(1 << 1)
    384 #define GLM_LANG_CXX03_FLAG			(1 << 2)
    385 #define GLM_LANG_CXX0X_FLAG			(1 << 3)
    386 #define GLM_LANG_CXX11_FLAG			(1 << 4)
    387 #define GLM_LANG_CXX1Y_FLAG			(1 << 5)
    388 #define GLM_LANG_CXXMS_FLAG			(1 << 6)
    389 #define GLM_LANG_CXXGNU_FLAG		(1 << 7)
    390 
    391 #define GLM_LANG_CXX			GLM_LANG_CXX_FLAG
    392 #define GLM_LANG_CXX98			(GLM_LANG_CXX | GLM_LANG_CXX98_FLAG)
    393 #define GLM_LANG_CXX03			(GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
    394 #define GLM_LANG_CXX0X			(GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
    395 #define GLM_LANG_CXX11			(GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
    396 #define GLM_LANG_CXX1Y			(GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
    397 #define GLM_LANG_CXXMS			GLM_LANG_CXXMS_FLAG
    398 #define GLM_LANG_CXXGNU			GLM_LANG_CXXGNU_FLAG
    399 
    400 #if(defined(GLM_FORCE_CXX1Y))
    401 #	define GLM_LANG GLM_LANG_CXX1Y
    402 #elif(defined(GLM_FORCE_CXX11))
    403 #	define GLM_LANG GLM_LANG_CXX11
    404 #elif(defined(GLM_FORCE_CXX03))
    405 #	define GLM_LANG GLM_LANG_CXX03
    406 #elif(defined(GLM_FORCE_CXX98))
    407 #	define GLM_LANG GLM_LANG_CXX98
    408 #else
    409 #	if(__cplusplus >= 201103L)
    410 #		define GLM_LANG GLM_LANG_CXX11
    411 #	elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG)
    412 #		if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
    413 #			define GLM_DETAIL_MAJOR 1
    414 #		else
    415 #			define GLM_DETAIL_MAJOR 0
    416 #		endif
    417 #		if(__clang_major__ < (2 + GLM_DETAIL_MAJOR))
    418 #			define GLM_LANG GLM_LANG_CXX
    419 #		elif(__has_feature(cxx_auto_type))
    420 #			define GLM_LANG GLM_LANG_CXX0X
    421 #		else
    422 #			define GLM_LANG GLM_LANG_CXX98
    423 #		endif
    424 #	elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC)
    425 #		if defined(__GXX_EXPERIMENTAL_CXX0X__)
    426 #			define GLM_LANG GLM_LANG_CXX0X
    427 #		else
    428 #			define GLM_LANG GLM_LANG_CXX98
    429 #		endif
    430 #	elif(GLM_COMPILER & GLM_COMPILER_VC)
    431 #		if(defined(_MSC_EXTENSIONS))
    432 #			if(GLM_COMPILER >= GLM_COMPILER_VC10)
    433 #				define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
    434 #			else
    435 #				define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
    436 #			endif
    437 #		else
    438 #			if(GLM_COMPILER >= GLM_COMPILER_VC10)
    439 #				define GLM_LANG GLM_LANG_CXX0X
    440 #			else
    441 #				define GLM_LANG GLM_LANG_CXX98
    442 #			endif
    443 #		endif
    444 #	elif(GLM_COMPILER & GLM_COMPILER_INTEL)
    445 #		if(defined(_MSC_EXTENSIONS))
    446 #			if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
    447 #				define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
    448 #			else
    449 #				define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
    450 #			endif
    451 #		else
    452 #			if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
    453 #				define GLM_LANG (GLM_LANG_CXX0X)
    454 #			else
    455 #				define GLM_LANG (GLM_LANG_CXX98)
    456 #			endif
    457 #		endif
    458 #	elif(__cplusplus >= 199711L)
    459 #		define GLM_LANG GLM_LANG_CXX98
    460 #	else
    461 #		define GLM_LANG GLM_LANG_CXX
    462 #	endif
    463 #endif
    464 
    465 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
    466 #	define GLM_MESSAGE_LANG_DISPLAYED
    467 #	if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
    468 #		pragma message("GLM: C++ with language extensions")
    469 #	elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
    470 #		pragma message("GLM: C++ with language extensions")
    471 #	elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
    472 #		pragma message("GLM: C++11")
    473 #	elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
    474 #		pragma message("GLM: C++0x")
    475 #	elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
    476 #		pragma message("GLM: C++03")
    477 #	elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
    478 #		pragma message("GLM: C++98")
    479 #	else
    480 #		pragma message("GLM: C++ language undetected")
    481 #	endif//GLM_MODEL
    482 #	pragma message("GLM: #define GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_LANG_CXX11 or GLM_FORCE_CXX1Y to force using a specific version of the C++ language")
    483 #endif//GLM_MESSAGE
    484 
    485 ///////////////////////////////////////////////////////////////////////////////////////////////////
    486 // Has of C++ features
    487 
    488 #ifndef __has_feature
    489 #	define __has_feature(x) 0  // Compatibility with non-clang compilers.
    490 #endif
    491 #ifndef __has_extension
    492 #	define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
    493 #endif
    494 
    495 // http://clang.llvm.org/cxx_status.html
    496 // http://gcc.gnu.org/projects/cxx0x.html
    497 // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
    498 
    499 // N1720
    500 #define GLM_HAS_STATIC_ASSERT ( \
    501 	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
    502 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10)) || \
    503 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
    504 	__has_feature(cxx_static_assert))
    505 
    506 // N1988
    507 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
    508 	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
    509 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
    510 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
    511 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG29)))
    512 
    513 // N2235
    514 #define GLM_HAS_CONSTEXPR ( \
    515 	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
    516 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
    517 	__has_feature(cxx_constexpr))
    518 
    519 // N2672
    520 #define GLM_HAS_INITIALIZER_LISTS ( \
    521 	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
    522 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
    523 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
    524 	__has_feature(cxx_generalized_initializers))
    525 
    526 // OpenMP
    527 #ifdef _OPENMP
    528 #	if(GLM_COMPILER & GLM_COMPILER_GCC)
    529 #		if(GLM_COMPILER > GLM_COMPILER_GCC47)
    530 #			define GLM_HAS_OPENMP 31
    531 #		elif(GLM_COMPILER > GLM_COMPILER_GCC44)
    532 #			define GLM_HAS_OPENMP 30
    533 #		elif(GLM_COMPILER > GLM_COMPILER_GCC42)
    534 #			define GLM_HAS_OPENMP 25
    535 #		endif
    536 #	endif//(GLM_COMPILER & GLM_COMPILER_GCC)
    537 
    538 #	if(GLM_COMPILER & GLM_COMPILER_VC)
    539 #		if(GLM_COMPILER > GLM_COMPILER_VC8)
    540 #			define GLM_HAS_OPENMP 20
    541 #		endif
    542 #	endif//(GLM_COMPILER & GLM_COMPILER_GCC)
    543 #endif
    544 
    545 // Not standard
    546 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
    547 
    548 /////////////////
    549 // Platform
    550 
    551 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_AVX
    552 
    553 #define GLM_ARCH_PURE		0x0000
    554 #define GLM_ARCH_SSE2		0x0001
    555 #define GLM_ARCH_SSE3		0x0002// | GLM_ARCH_SSE2
    556 #define GLM_ARCH_AVX		0x0008// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
    557 #define GLM_ARCH_AVX2		0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
    558 
    559 #if(defined(GLM_FORCE_PURE))
    560 #	define GLM_ARCH GLM_ARCH_PURE
    561 #elif(defined(GLM_FORCE_AVX2))
    562 #	define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    563 #elif(defined(GLM_FORCE_AVX))
    564 #	define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    565 #elif(defined(GLM_FORCE_SSE3))
    566 #	define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    567 #elif(defined(GLM_FORCE_SSE2))
    568 #	define GLM_ARCH (GLM_ARCH_SSE2)
    569 #elif(GLM_COMPILER & GLM_COMPILER_VC)
    570 #	if _M_IX86_FP == 2 && defined(__AVX__)
    571 #		define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    572 #	elif _M_IX86_FP == 2
    573 #		define GLM_ARCH (GLM_ARCH_SSE2)
    574 #	else
    575 #		define GLM_ARCH (GLM_ARCH_PURE)
    576 #	endif
    577 #elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC))
    578 #	define GLM_ARCH GLM_ARCH_PURE
    579 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC))
    580 #	if defined(__AVX2__)
    581 #		define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    582 #	elif defined(__AVX__)
    583 #		define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    584 #	elif defined(__SSE3__)
    585 #		define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
    586 #	elif defined(__SSE2__)
    587 #		define GLM_ARCH (GLM_ARCH_SSE2)
    588 #	else
    589 #		define GLM_ARCH (GLM_ARCH_PURE)
    590 #	endif
    591 #else
    592 #	define GLM_ARCH GLM_ARCH_PURE
    593 #endif
    594 
    595 // With MinGW-W64, including intrinsic headers before intrin.h will produce some errors. The problem is
    596 // that windows.h (and maybe other headers) will silently include intrin.h, which of course causes problems.
    597 // To fix, we just explicitly include intrin.h here.
    598 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
    599 #	include <intrin.h>
    600 #endif
    601 
    602 //#if(GLM_ARCH != GLM_ARCH_PURE)
    603 #if(GLM_ARCH & GLM_ARCH_AVX2)
    604 #	include <immintrin.h>
    605 #endif//GLM_ARCH
    606 #if(GLM_ARCH & GLM_ARCH_AVX)
    607 #	include <immintrin.h>
    608 #endif//GLM_ARCH
    609 #if(GLM_ARCH & GLM_ARCH_SSE4)
    610 #	include <smmintrin.h>
    611 #endif//GLM_ARCH
    612 #if(GLM_ARCH & GLM_ARCH_SSE3)
    613 #	include <pmmintrin.h>
    614 #endif//GLM_ARCH
    615 #if(GLM_ARCH & GLM_ARCH_SSE2)
    616 #	include <emmintrin.h>
    617 #	if(GLM_COMPILER == GLM_COMPILER_VC8) // VC8 is missing some intrinsics, workaround
    618 		inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
    619 		inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
    620 		inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
    621 		inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
    622 		inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
    623 #	endif
    624 #endif//GLM_ARCH
    625 //#endif//(GLM_ARCH != GLM_ARCH_PURE)
    626 
    627 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
    628 #	define GLM_MESSAGE_ARCH_DISPLAYED
    629 #	if(GLM_ARCH == GLM_ARCH_PURE)
    630 #		pragma message("GLM: Platform independent code")
    631 #	elif(GLM_ARCH & GLM_ARCH_SSE2)
    632 #		pragma message("GLM: SSE2 instruction set")
    633 #	elif(GLM_ARCH & GLM_ARCH_SSE3)
    634 #		pragma message("GLM: SSE3 instruction set")
    635 #	elif(GLM_ARCH & GLM_ARCH_SSE4)
    636 #		pragma message("GLM: SSE4 instruction set")
    637 #	elif(GLM_ARCH & GLM_ARCH_AVX)
    638 #		pragma message("GLM: AVX instruction set")
    639 #	elif(GLM_ARCH & GLM_ARCH_AVX2)
    640 #		pragma message("GLM: AVX2 instruction set")
    641 #	endif//GLM_ARCH
    642 #	pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
    643 #endif//GLM_MESSAGE
    644 
    645 ///////////////////////////////////////////////////////////////////////////////////////////////////
    646 // Radians
    647 
    648 //#define GLM_FORCE_RADIANS
    649 
    650 ///////////////////////////////////////////////////////////////////////////////////////////////////
    651 // Static assert
    652 
    653 #if GLM_HAS_STATIC_ASSERT
    654 #	define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
    655 #elif(defined(BOOST_STATIC_ASSERT))
    656 #	define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
    657 #elif(GLM_COMPILER & GLM_COMPILER_VC)
    658 #	define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
    659 #else
    660 #	define GLM_STATIC_ASSERT(x, message)
    661 #	define GLM_STATIC_ASSERT_NULL
    662 #endif//GLM_LANG
    663 
    664 ///////////////////////////////////////////////////////////////////////////////////////////////////
    665 // Qualifiers
    666 
    667 // User defines: GLM_FORCE_INLINE GLM_FORCE_CUDA
    668 
    669 #if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
    670 #	define GLM_CUDA_FUNC_DEF __device__ __host__
    671 #	define GLM_CUDA_FUNC_DECL __device__ __host__
    672 #else
    673 #	define GLM_CUDA_FUNC_DEF
    674 #	define GLM_CUDA_FUNC_DECL
    675 #endif
    676 
    677 #if GLM_COMPILER & GLM_COMPILER_GCC
    678 #	define GLM_VAR_USED __attribute__ ((unused))
    679 #else
    680 #	define GLM_VAR_USED
    681 #endif
    682 
    683 #if(defined(GLM_FORCE_INLINE))
    684 #	if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
    685 #		define GLM_INLINE __forceinline
    686 #	elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
    687 #		define GLM_INLINE __attribute__((always_inline)) inline
    688 #	elif(GLM_COMPILER & GLM_COMPILER_CLANG)
    689 #		define GLM_INLINE __attribute__((always_inline))
    690 #	else
    691 #		define GLM_INLINE inline
    692 #	endif//GLM_COMPILER
    693 #else
    694 #	define GLM_INLINE inline
    695 #endif//defined(GLM_FORCE_INLINE)
    696 
    697 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
    698 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
    699 
    700 ///////////////////////////////////////////////////////////////////////////////////////////////////
    701 // Swizzle operators
    702 
    703 // User defines: GLM_SWIZZLE
    704 
    705 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
    706 #	define GLM_MESSAGE_SWIZZLE_DISPLAYED
    707 #	if defined(GLM_SWIZZLE)
    708 #		pragma message("GLM: Swizzling operators enabled")
    709 #	else
    710 #		pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
    711 #	endif
    712 #endif//GLM_MESSAGE
    713 
    714 ///////////////////////////////////////////////////////////////////////////////////////////////////
    715 // Length type
    716 
    717 // User defines: GLM_FORCE_SIZE_T_LENGTH
    718 
    719 namespace glm
    720 {
    721 #if defined(GLM_FORCE_SIZE_T_LENGTH)
    722 	typedef std::size_t length_t;
    723 #else
    724 	typedef int length_t;
    725 #endif
    726 }//namespace glm
    727 
    728 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
    729 #	define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
    730 #	if defined(GLM_FORCE_SIZE_T_LENGTH)
    731 #		pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
    732 #	else
    733 #		pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
    734 #		pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
    735 #	endif
    736 #endif//GLM_MESSAGE
    737 
    738 ///////////////////////////////////////////////////////////////////////////////////////////////////
    739 // Qualifiers
    740 
    741 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
    742 #	define GLM_DEPRECATED __declspec(deprecated)
    743 #	define GLM_ALIGN(x) __declspec(align(x))
    744 #	define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
    745 #	define GLM_RESTRICT __declspec(restrict)
    746 #	define GLM_RESTRICT_VAR __restrict
    747 #elif(GLM_COMPILER & GLM_COMPILER_INTEL)
    748 #	define GLM_DEPRECATED
    749 #	define GLM_ALIGN(x) __declspec(align(x))
    750 #	define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
    751 #	define GLM_RESTRICT
    752 #	define GLM_RESTRICT_VAR __restrict
    753 #elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
    754 #	define GLM_DEPRECATED __attribute__((__deprecated__))
    755 #	define GLM_ALIGN(x) __attribute__((aligned(x)))
    756 #	define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
    757 #	define GLM_RESTRICT __restrict__
    758 #	define GLM_RESTRICT_VAR __restrict__
    759 #else
    760 #	define GLM_DEPRECATED
    761 #	define GLM_ALIGN
    762 #	define GLM_ALIGNED_STRUCT(x)
    763 #	define GLM_RESTRICT
    764 #	define GLM_RESTRICT_VAR
    765 #endif//GLM_COMPILER
    766 
    767 #if GLM_HAS_CONSTEXPR
    768 #	define GLM_CONSTEXPR constexpr
    769 #else
    770 #	define GLM_CONSTEXPR
    771 #endif
    772 
    773 #endif//GLM_SETUP_INCLUDED
    774