29 #ifndef GLM_SETUP_INCLUDED
30 #define GLM_SETUP_INCLUDED
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 1
46 #define GLM_PLATFORM_UNKNOWN 0x00000000
47 #define GLM_PLATFORM_WINDOWS 0x00010000
48 #define GLM_PLATFORM_LINUX 0x00020000
49 #define GLM_PLATFORM_APPLE 0x00040000
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
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
64 # define GLM_PLATFORM GLM_PLATFORM_WINCE
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
74 # define GLM_PLATFORM GLM_PLATFORM_UNIX
76 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
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")
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")
103 # pragma message("GLM: platform not detected")
113 #define GLM_COMPILER_UNKNOWN 0x00000000
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
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
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
150 #define GLM_COMPILER_BC 0x04000000
153 #define GLM_COMPILER_CODEWARRIOR 0x08000000
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
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
181 #define GLM_COMPILER_LLVM_GCC 0x40000000
184 #define GLM_MODEL_32 0x00000010
185 #define GLM_MODEL_64 0x00000020
188 #ifdef GLM_FORCE_COMPILER_UNKNOWN
189 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
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
209 # define GLM_COMPILER GLM_COMPILER_INTEL
213 #elif defined(__CUDACC__)
214 # if CUDA_VERSION < 3000
215 # error "GLM requires CUDA 3.0 or higher"
217 # define GLM_COMPILER GLM_COMPILER_CUDA
221 #elif defined(_MSC_VER)
223 # error "GLM requires Visual C++ 2005 or higher"
224 # elif _MSC_VER == 1400
225 # define GLM_COMPILER GLM_COMPILER_VC8
226 # elif _MSC_VER == 1500
227 # define GLM_COMPILER GLM_COMPILER_VC9
228 # elif _MSC_VER == 1600
229 # define GLM_COMPILER GLM_COMPILER_VC10
230 # elif _MSC_VER == 1700
231 # define GLM_COMPILER GLM_COMPILER_VC11
232 # elif _MSC_VER >= 1800
233 # define GLM_COMPILER GLM_COMPILER_VC12
235 # define GLM_COMPILER GLM_COMPILER_VC
239 #elif defined(__clang__)
240 # if (__clang_major__ <= 1) || ((__clang_major__ == 2) && (__clang_minor__ < 6))
241 # error "GLM requires Clang 2.6 or higher"
242 # elif(__clang_major__ == 2) && (__clang_minor__ == 6)
243 # define GLM_COMPILER GLM_COMPILER_CLANG26
244 # elif(__clang_major__ == 2) && (__clang_minor__ == 7)
245 # define GLM_COMPILER GLM_COMPILER_CLANG27
246 # elif(__clang_major__ == 2) && (__clang_minor__ == 8)
247 # define GLM_COMPILER GLM_COMPILER_CLANG28
248 # elif(__clang_major__ == 2) && (__clang_minor__ == 9)
249 # define GLM_COMPILER GLM_COMPILER_CLANG29
250 # elif(__clang_major__ == 3) && (__clang_minor__ == 0)
251 # define GLM_COMPILER GLM_COMPILER_CLANG30
252 # elif(__clang_major__ == 3) && (__clang_minor__ == 1)
253 # define GLM_COMPILER GLM_COMPILER_CLANG31
254 # elif(__clang_major__ == 3) && (__clang_minor__ == 2)
255 # define GLM_COMPILER GLM_COMPILER_CLANG32
256 # elif(__clang_major__ == 3) && (__clang_minor__ == 3)
257 # define GLM_COMPILER GLM_COMPILER_CLANG33
258 # elif(__clang_major__ == 4) && (__clang_minor__ == 0)
259 # define GLM_COMPILER GLM_COMPILER_CLANG40
260 # elif(__clang_major__ == 4) && (__clang_minor__ == 1)
261 # define GLM_COMPILER GLM_COMPILER_CLANG41
262 # elif(__clang_major__ == 4) && (__clang_minor__ == 2)
263 # define GLM_COMPILER GLM_COMPILER_CLANG42
264 # elif(__clang_major__ == 4) && (__clang_minor__ >= 3)
265 # define GLM_COMPILER GLM_COMPILER_CLANG43
266 # elif(__clang_major__ > 4)
267 # define GLM_COMPILER GLM_COMPILER_CLANG50
269 # define GLM_COMPILER GLM_COMPILER_CLANG
273 #elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
274 # if (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
275 # define GLM_COMPILER GLM_COMPILER_GCC34
276 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
277 # define GLM_COMPILER GLM_COMPILER_GCC35
278 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
279 # define GLM_COMPILER (GLM_COMPILER_GCC40)
280 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
281 # define GLM_COMPILER (GLM_COMPILER_GCC41)
282 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
283 # define GLM_COMPILER (GLM_COMPILER_GCC42)
284 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
285 # define GLM_COMPILER (GLM_COMPILER_GCC43)
286 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
287 # define GLM_COMPILER (GLM_COMPILER_GCC44)
288 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
289 # define GLM_COMPILER (GLM_COMPILER_GCC45)
290 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
291 # define GLM_COMPILER (GLM_COMPILER_GCC46)
292 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
293 # define GLM_COMPILER (GLM_COMPILER_GCC47)
294 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
295 # define GLM_COMPILER (GLM_COMPILER_GCC48)
296 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
297 # define GLM_COMPILER (GLM_COMPILER_GCC49)
298 # elif (__GNUC__ > 4 )
299 # define GLM_COMPILER (GLM_COMPILER_GCC49)
301 # define GLM_COMPILER (GLM_COMPILER_GCC)
305 #elif defined(_BORLANDC_)
306 # define GLM_COMPILER GLM_COMPILER_BC
309 #elif defined(__MWERKS__)
310 # define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
313 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
317 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
321 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
322 # define GLM_MESSAGE_COMPILER_DISPLAYED
323 # if(GLM_COMPILER & GLM_COMPILER_CUDA)
324 # pragma message("GLM: CUDA compiler detected")
325 # elif(GLM_COMPILER & GLM_COMPILER_VC)
326 # pragma message("GLM: Visual C++ compiler detected")
327 # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
328 # pragma message("GLM: Clang compiler detected")
329 # elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
330 # pragma message("GLM: LLVM GCC compiler detected")
331 # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
332 # pragma message("GLM: Intel Compiler detected")
333 # elif(GLM_COMPILER & GLM_COMPILER_GCC)
334 # if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
335 # pragma message("GLM: LLVM GCC compiler detected")
336 # elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
337 # pragma message("GLM: CLANG compiler detected")
339 # pragma message("GLM: GCC compiler detected")
341 # elif(GLM_COMPILER & GLM_COMPILER_BC)
342 # pragma message("GLM: Borland compiler detected but not supported")
343 # elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
344 # pragma message("GLM: Codewarrior compiler detected but not supported")
346 # pragma message("GLM: Compiler not detected")
353 #if(defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__))
354 # define GLM_MODEL GLM_MODEL_64
355 #elif(defined(__i386__) || defined(__ppc__))
356 # define GLM_MODEL GLM_MODEL_32
358 # define GLM_MODEL GLM_MODEL_32
361 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
362 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
365 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
366 # define GLM_MESSAGE_MODEL_DISPLAYED
367 # if(GLM_MODEL == GLM_MODEL_64)
368 # pragma message("GLM: 64 bits model")
369 # elif(GLM_MODEL == GLM_MODEL_32)
370 # pragma message("GLM: 32 bits model")
379 #define GLM_LANG_CXX_FLAG (1 << 0)
380 #define GLM_LANG_CXX98_FLAG (1 << 1)
381 #define GLM_LANG_CXX03_FLAG (1 << 2)
382 #define GLM_LANG_CXX0X_FLAG (1 << 3)
383 #define GLM_LANG_CXX11_FLAG (1 << 4)
384 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
385 #define GLM_LANG_CXXMS_FLAG (1 << 6)
386 #define GLM_LANG_CXXGNU_FLAG (1 << 7)
388 #define GLM_LANG_CXX GLM_LANG_CXX_FLAG
389 #define GLM_LANG_CXX98 (GLM_LANG_CXX | GLM_LANG_CXX98_FLAG)
390 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
391 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
392 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
393 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
394 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
395 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
397 #if(defined(GLM_FORCE_CXX1Y))
398 # define GLM_LANG GLM_LANG_CXX1Y
399 #elif(defined(GLM_FORCE_CXX11))
400 # define GLM_LANG GLM_LANG_CXX11
401 #elif(defined(GLM_FORCE_CXX03))
402 # define GLM_LANG GLM_LANG_CXX03
403 #elif(defined(GLM_FORCE_CXX98))
404 # define GLM_LANG GLM_LANG_CXX98
406 # if(__cplusplus >= 201103L)
407 # define GLM_LANG GLM_LANG_CXX11
408 # elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG)
409 # if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
410 # define GLM_DETAIL_MAJOR 1
412 # define GLM_DETAIL_MAJOR 0
414 # if(__clang_major__ < (2 + GLM_DETAIL_MAJOR))
415 # define GLM_LANG GLM_LANG_CXX
416 # elif(__has_feature(cxx_auto_type))
417 # define GLM_LANG GLM_LANG_CXX0X
419 # define GLM_LANG GLM_LANG_CXX98
421 # elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC)
422 # if defined(__GXX_EXPERIMENTAL_CXX0X__)
423 # define GLM_LANG GLM_LANG_CXX0X
425 # define GLM_LANG GLM_LANG_CXX98
427 # elif(GLM_COMPILER & GLM_COMPILER_VC)
428 # if(defined(_MSC_EXTENSIONS))
429 # if(GLM_COMPILER >= GLM_COMPILER_VC10)
430 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
432 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
435 # if(GLM_COMPILER >= GLM_COMPILER_VC10)
436 # define GLM_LANG GLM_LANG_CXX0X
438 # define GLM_LANG GLM_LANG_CXX98
441 # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
442 # if(defined(_MSC_EXTENSIONS))
443 # if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
444 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
446 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
449 # if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
450 # define GLM_LANG (GLM_LANG_CXX0X)
452 # define GLM_LANG (GLM_LANG_CXX98)
455 # elif(__cplusplus >= 199711L)
456 # define GLM_LANG GLM_LANG_CXX98
458 # define GLM_LANG GLM_LANG_CXX
462 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
463 # define GLM_MESSAGE_LANG_DISPLAYED
464 # if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
465 # pragma message("GLM: C++ with language extensions")
466 # elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
467 # pragma message("GLM: C++ with language extensions")
468 # elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
469 # pragma message("GLM: C++11")
470 # elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
471 # pragma message("GLM: C++0x")
472 # elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
473 # pragma message("GLM: C++03")
474 # elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
475 # pragma message("GLM: C++98")
477 # pragma message("GLM: C++ language undetected")
479 # 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")
485 #ifndef __has_feature
486 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
488 #ifndef __has_extension
489 # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
497 #define GLM_HAS_STATIC_ASSERT ( \
498 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
499 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10)) || \
500 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
501 __has_feature(cxx_static_assert))
504 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
505 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
506 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
507 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
508 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG29)))
511 #define GLM_HAS_CONSTEXPR ( \
512 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
513 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
514 __has_feature(cxx_constexpr))
517 #define GLM_HAS_INITIALIZER_LISTS ( \
518 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
519 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
520 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
521 __has_feature(cxx_generalized_initializers))
525 # if(GLM_COMPILER & GLM_COMPILER_GCC)
526 # if(GLM_COMPILER > GLM_COMPILER_GCC47)
527 # define GLM_HAS_OPENMP 31
528 # elif(GLM_COMPILER > GLM_COMPILER_GCC44)
529 # define GLM_HAS_OPENMP 30
530 # elif(GLM_COMPILER > GLM_COMPILER_GCC42)
531 # define GLM_HAS_OPENMP 25
533 # endif//(GLM_COMPILER & GLM_COMPILER_GCC)
535 # if(GLM_COMPILER & GLM_COMPILER_VC)
536 # if(GLM_COMPILER > GLM_COMPILER_VC8)
537 # define GLM_HAS_OPENMP 20
539 # endif//(GLM_COMPILER & GLM_COMPILER_GCC)
543 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
550 #define GLM_ARCH_PURE 0x0000
551 #define GLM_ARCH_SSE2 0x0001
552 #define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2
553 #define GLM_ARCH_SSE4 0x0004// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
554 #define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
555 #define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
557 #if(defined(GLM_FORCE_PURE))
558 # define GLM_ARCH GLM_ARCH_PURE
559 #elif(defined(GLM_FORCE_AVX2))
560 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
561 #elif(defined(GLM_FORCE_AVX))
562 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
563 #elif(defined(GLM_FORCE_SSE4))
564 # define GLM_ARCH (GLM_ARCH_SSE4 | 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) && (defined(_M_IX86) || defined(_M_X64)))
570 # if(GLM_PLATFORM == GLM_PLATFORM_WINCE)
571 # define GLM_ARCH GLM_ARCH_PURE
572 # elif(defined(_M_CEE_PURE))
573 # define GLM_ARCH GLM_ARCH_PURE
584 # elif(GLM_COMPILER >= GLM_COMPILER_VC11)
585 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
586 # elif(GLM_COMPILER >= GLM_COMPILER_VC10)
587 # if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
588 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)//GLM_ARCH_AVX (Require SP1)
590 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
592 # elif(GLM_COMPILER >= GLM_COMPILER_VC9)
593 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
594 # elif(GLM_COMPILER >= GLM_COMPILER_VC8)
595 # define GLM_ARCH GLM_ARCH_SSE2
597 # define GLM_ARCH GLM_ARCH_PURE
599 #elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC))
600 # define GLM_ARCH GLM_ARCH_PURE
601 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC))
602 # define GLM_ARCH (GLM_ARCH_PURE \
603 | (defined(__AVX2__) ? GLM_ARCH_AVX2 : 0) \
604 | (defined(__AVX__) ? GLM_ARCH_AVX : 0) \
605 | (defined(__SSE4__) ? GLM_ARCH_SSE4 : 0) \
606 | (defined(__SSE3__) ? GLM_ARCH_SSE3 : 0) \
607 | (defined(__SSE2__) ? GLM_ARCH_SSE2 : 0))
609 # define GLM_ARCH GLM_ARCH_PURE
615 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
620 #if(GLM_ARCH & GLM_ARCH_AVX2)
621 # include <immintrin.h>
623 #if(GLM_ARCH & GLM_ARCH_AVX)
624 # include <immintrin.h>
626 #if(GLM_ARCH & GLM_ARCH_SSE4)
627 # include <smmintrin.h>
629 #if(GLM_ARCH & GLM_ARCH_SSE3)
630 # include <pmmintrin.h>
632 #if(GLM_ARCH & GLM_ARCH_SSE2)
633 # include <emmintrin.h>
634 # if(GLM_COMPILER == GLM_COMPILER_VC8) // VC8 is missing some intrinsics, workaround
635 inline float _mm_cvtss_f32(__m128 A) {
return A.m128_f32[0]; }
636 inline __m128 _mm_castpd_ps(__m128d PD) {
union { __m128 ps; __m128d pd; } c; c.pd = PD;
return c.ps; }
637 inline __m128d _mm_castps_pd(__m128 PS) {
union { __m128 ps; __m128d pd; } c; c.ps = PS;
return c.pd; }
638 inline __m128i _mm_castps_si128(__m128 PS) {
union { __m128 ps; __m128i
pi; } c; c.ps = PS;
return c.pi; }
639 inline __m128 _mm_castsi128_ps(__m128i PI) {
union { __m128 ps; __m128i
pi; } c; c.pi = PI;
return c.ps; }
644 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
645 # define GLM_MESSAGE_ARCH_DISPLAYED
646 # if(GLM_ARCH == GLM_ARCH_PURE)
647 # pragma message("GLM: Platform independent")
648 # elif(GLM_ARCH & GLM_ARCH_SSE2)
649 # pragma message("GLM: SSE2 instruction set")
650 # elif(GLM_ARCH & GLM_ARCH_SSE3)
651 # pragma message("GLM: SSE3 instruction set")
652 # elif(GLM_ARCH & GLM_ARCH_SSE4)
653 # pragma message("GLM: SSE4 instruction set")
654 # elif(GLM_ARCH & GLM_ARCH_AVX)
655 # pragma message("GLM: AVX instruction set")
656 # elif(GLM_ARCH & GLM_ARCH_AVX2)
657 # pragma message("GLM: AVX2 instruction set")
659 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
670 #if GLM_HAS_STATIC_ASSERT
671 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
672 #elif(defined(BOOST_STATIC_ASSERT))
673 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
674 #elif(GLM_COMPILER & GLM_COMPILER_VC)
675 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
677 # define GLM_STATIC_ASSERT(x, message)
678 # define GLM_STATIC_ASSERT_NULL
686 #if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
687 # define GLM_CUDA_FUNC_DEF __device__ __host__
688 # define GLM_CUDA_FUNC_DECL __device__ __host__
690 # define GLM_CUDA_FUNC_DEF
691 # define GLM_CUDA_FUNC_DECL
694 #if GLM_COMPILER & GLM_COMPILER_GCC
695 # define GLM_VAR_USED __attribute__ ((unused))
697 # define GLM_VAR_USED
700 #if(defined(GLM_FORCE_INLINE))
701 # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
702 # define GLM_INLINE __forceinline
703 # elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
704 # define GLM_INLINE __attribute__((always_inline)) inline
705 # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
706 # define GLM_INLINE __attribute__((always_inline))
708 # define GLM_INLINE inline
709 # endif//GLM_COMPILER
711 # define GLM_INLINE inline
712 #endif//defined(GLM_FORCE_INLINE)
714 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
715 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
722 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
723 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
724 # if defined(GLM_SWIZZLE)
725 # pragma message("GLM: Swizzling operators enabled")
727 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
738 #if defined(GLM_FORCE_SIZE_T_LENGTH)
739 typedef std::size_t length_t;
741 typedef int length_t;
745 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
746 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
747 # if defined(GLM_FORCE_SIZE_T_LENGTH)
748 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
750 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
751 # pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
758 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
759 # define GLM_DEPRECATED __declspec(deprecated)
760 # define GLM_ALIGN(x) __declspec(align(x))
761 # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
762 # define GLM_RESTRICT __declspec(restrict)
763 # define GLM_RESTRICT_VAR __restrict
764 #elif(GLM_COMPILER & GLM_COMPILER_INTEL)
765 # define GLM_DEPRECATED
766 # define GLM_ALIGN(x) __declspec(align(x))
767 # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
768 # define GLM_RESTRICT
769 # define GLM_RESTRICT_VAR __restrict
770 #elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
771 # define GLM_DEPRECATED __attribute__((__deprecated__))
772 # define GLM_ALIGN(x) __attribute__((aligned(x)))
773 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
774 # define GLM_RESTRICT __restrict__
775 # define GLM_RESTRICT_VAR __restrict__
777 # define GLM_DEPRECATED
779 # define GLM_ALIGNED_STRUCT(x)
780 # define GLM_RESTRICT
781 # define GLM_RESTRICT_VAR
784 #if GLM_HAS_CONSTEXPR
785 # define GLM_CONSTEXPR constexpr
787 # define GLM_CONSTEXPR
790 #endif//GLM_SETUP_INCLUDED
GLM_FUNC_DECL genType pi()
Return the pi constant.