0.9.7: setup.hpp Source File

| 0.9.7

- Main Page
- Modules
- Files

- File List

setup.hpp
Go to the documentation of this file.
1
33 #pragma once
34
35 #include <cassert>
36 #include <cstddef>
37
39 // Version
40
41 #define GLM_VERSION 97
42 #define GLM_VERSION_MAJOR 0
43 #define GLM_VERSION_MINOR 9
44 #define GLM_VERSION_PATCH 7
45 #define GLM_VERSION_REVISION 0
46
47 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_VERSION_DISPLAYED))
48 # define GLM_MESSAGE_VERSION_DISPLAYED
49 # pragma message ("GLM: version 0.9.7")
50 #endif//GLM_MESSAGE
51
53 // Platform
54
55 #define GLM_PLATFORM_UNKNOWN 0x00000000
56 #define GLM_PLATFORM_WINDOWS 0x00010000
57 #define GLM_PLATFORM_LINUX 0x00020000
58 #define GLM_PLATFORM_APPLE 0x00040000
59 //#define GLM_PLATFORM_IOS 0x00080000
60 #define GLM_PLATFORM_ANDROID 0x00100000
61 #define GLM_PLATFORM_CHROME_NACL 0x00200000
62 #define GLM_PLATFORM_UNIX 0x00400000
63 #define GLM_PLATFORM_QNXNTO 0x00800000
64 #define GLM_PLATFORM_WINCE 0x01000000
65
66 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
67 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
68 #elif defined(__QNXNTO__)
69 # define GLM_PLATFORM GLM_PLATFORM_QNXNTO
70 #elif defined(__APPLE__)
71 # define GLM_PLATFORM GLM_PLATFORM_APPLE
72 #elif defined(WINCE)
73 # define GLM_PLATFORM GLM_PLATFORM_WINCE
74 #elif defined(_WIN32)
75 # define GLM_PLATFORM GLM_PLATFORM_WINDOWS
76 #elif defined(__native_client__)
77 # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
78 #elif defined(__ANDROID__)
79 # define GLM_PLATFORM GLM_PLATFORM_ANDROID
80 #elif defined(__linux)
81 # define GLM_PLATFORM GLM_PLATFORM_LINUX
82 #elif defined(__unix)
83 # define GLM_PLATFORM GLM_PLATFORM_UNIX
84 #else
85 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
86 #endif//
87
88 // Report platform detection
89 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
90 # define GLM_MESSAGE_PLATFORM_DISPLAYED
91 # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
92 # pragma message("GLM: QNX platform detected")
93 //# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
94 //# pragma message("GLM: iOS platform detected")
95 # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
96 # pragma message("GLM: Apple platform detected")
97 # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
98 # pragma message("GLM: WinCE platform detected")
99 # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
100 # pragma message("GLM: Windows platform detected")
101 # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
102 # pragma message("GLM: Native Client detected")
103 # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
104 # pragma message("GLM: Android platform detected")
105 # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
106 # pragma message("GLM: Linux platform detected")
107 # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
108 # pragma message("GLM: UNIX platform detected")
109 # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
110 # pragma message("GLM: platform unknown")
111 # else
112 # pragma message("GLM: platform not detected")
113 # endif
114 #endif//GLM_MESSAGE
115
117 // Compiler
118
119 // User defines: GLM_FORCE_COMPILER_UNKNOWN
120 // TODO ? __llvm__
121
122 #define GLM_COMPILER_UNKNOWN 0x00000000
123
124 // Intel
125 #define GLM_COMPILER_INTEL 0x00100000
126 #define GLM_COMPILER_INTEL12 0x00100010
127 #define GLM_COMPILER_INTEL12_1 0x00100020
128 #define GLM_COMPILER_INTEL13 0x00100030
129 #define GLM_COMPILER_INTEL14 0x00100040
130 #define GLM_COMPILER_INTEL15 0x00100050
131 #define GLM_COMPILER_INTEL16 0x00100060
132
133 // Visual C++ defines
134 #define GLM_COMPILER_VC 0x01000000
135 #define GLM_COMPILER_VC2010 0x01000090
136 #define GLM_COMPILER_VC2012 0x010000A0
137 #define GLM_COMPILER_VC2013 0x010000B0
138 #define GLM_COMPILER_VC2015 0x010000C0
139
140 // GCC defines
141 #define GLM_COMPILER_GCC 0x02000000
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 #define GLM_COMPILER_GCC50 0x02000200
149 #define GLM_COMPILER_GCC51 0x02000300
150 #define GLM_COMPILER_GCC52 0x02000400
151 #define GLM_COMPILER_GCC53 0x02000500
152
153 // CUDA
154 #define GLM_COMPILER_CUDA 0x10000000
155 #define GLM_COMPILER_CUDA40 0x10000040
156 #define GLM_COMPILER_CUDA41 0x10000050
157 #define GLM_COMPILER_CUDA42 0x10000060
158 #define GLM_COMPILER_CUDA50 0x10000070
159 #define GLM_COMPILER_CUDA60 0x10000080
160 #define GLM_COMPILER_CUDA65 0x10000090
161 #define GLM_COMPILER_CUDA70 0x100000A0
162 #define GLM_COMPILER_CUDA75 0x100000B0
163
164 // LLVM
165 #define GLM_COMPILER_LLVM 0x20000000
166 #define GLM_COMPILER_LLVM32 0x20000030
167 #define GLM_COMPILER_LLVM33 0x20000040
168 #define GLM_COMPILER_LLVM34 0x20000050
169 #define GLM_COMPILER_LLVM35 0x20000060
170 #define GLM_COMPILER_LLVM36 0x20000070
171 #define GLM_COMPILER_LLVM37 0x20000080
172 #define GLM_COMPILER_LLVM38 0x20000090
173 #define GLM_COMPILER_LLVM39 0x200000A0
174
175 // Apple Clang
176 #define GLM_COMPILER_APPLE_CLANG 0x40000000
177 #define GLM_COMPILER_APPLE_CLANG40 0x40000010
178 #define GLM_COMPILER_APPLE_CLANG41 0x40000020
179 #define GLM_COMPILER_APPLE_CLANG42 0x40000030
180 #define GLM_COMPILER_APPLE_CLANG50 0x40000040
181 #define GLM_COMPILER_APPLE_CLANG51 0x40000050
182 #define GLM_COMPILER_APPLE_CLANG60 0x40000060
183 #define GLM_COMPILER_APPLE_CLANG61 0x40000070
184
185 // Build model
186 #define GLM_MODEL_32 0x00000010
187 #define GLM_MODEL_64 0x00000020
188
189 // Force generic C++ compiler
190 #ifdef GLM_FORCE_COMPILER_UNKNOWN
191 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
192
193 #elif defined(__INTEL_COMPILER)
194 # if __INTEL_COMPILER == 1200
195 # define GLM_COMPILER GLM_COMPILER_INTEL12
196 # elif __INTEL_COMPILER == 1210
197 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
198 # elif __INTEL_COMPILER == 1300
199 # define GLM_COMPILER GLM_COMPILER_INTEL13
200 # elif __INTEL_COMPILER == 1400
201 # define GLM_COMPILER GLM_COMPILER_INTEL14
202 # elif __INTEL_COMPILER >= 1500
203 # define GLM_COMPILER GLM_COMPILER_INTEL15
204 # elif __INTEL_COMPILER >= 1600
205 # define GLM_COMPILER GLM_COMPILER_INTEL16
206 # else
207 # define GLM_COMPILER GLM_COMPILER_INTEL
208 # endif
209
210 // CUDA
211 #elif defined(__CUDACC__)
212 # if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
213 # include <cuda.h> // make sure version is defined since nvcc does not define it itself!
214 # endif
215 # if CUDA_VERSION < 3000
216 # error "GLM requires CUDA 3.0 or higher"
217 # else
218 # define GLM_COMPILER GLM_COMPILER_CUDA
219 # endif
220
221 // Visual C++
222 #elif defined(_MSC_VER)
223 # if _MSC_VER < 1600
224 # error "GLM requires Visual C++ 2010 or higher"
225 # elif _MSC_VER == 1600
226 # define GLM_COMPILER GLM_COMPILER_VC2010
227 # elif _MSC_VER == 1700
228 # define GLM_COMPILER GLM_COMPILER_VC2012
229 # elif _MSC_VER == 1800
230 # define GLM_COMPILER GLM_COMPILER_VC2013
231 # elif _MSC_VER >= 1900
232 # define GLM_COMPILER GLM_COMPILER_VC2015
233 # else//_MSC_VER
234 # define GLM_COMPILER GLM_COMPILER_VC
235 # endif//_MSC_VER
236
237 // Clang
238 #elif defined(__clang__)
239 # if GLM_PLATFORM & GLM_PLATFORM_APPLE
240 # if __clang_major__ == 4 && __clang_minor__ == 0
241 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG40
242 # elif __clang_major__ == 4 && __clang_minor__ == 1
243 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG41
244 # elif __clang_major__ == 4 && __clang_minor__ == 2
245 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG42
246 # elif __clang_major__ == 5 && __clang_minor__ == 0
247 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG50
248 # elif __clang_major__ == 5 && __clang_minor__ == 1
249 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG51
250 # elif __clang_major__ == 6 && __clang_minor__ == 0
251 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG60
252 # elif __clang_major__ == 6 && __clang_minor__ >= 1
253 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG61
254 # elif __clang_major__ >= 7
255 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG61
256 # else
257 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG
258 # endif
259 # else
260 # if __clang_major__ == 3 && __clang_minor__ == 0
261 # define GLM_COMPILER GLM_COMPILER_LLVM30
262 # elif __clang_major__ == 3 && __clang_minor__ == 1
263 # define GLM_COMPILER GLM_COMPILER_LLVM31
264 # elif __clang_major__ == 3 && __clang_minor__ == 2
265 # define GLM_COMPILER GLM_COMPILER_LLVM32
266 # elif __clang_major__ == 3 && __clang_minor__ == 3
267 # define GLM_COMPILER GLM_COMPILER_LLVM33
268 # elif __clang_major__ == 3 && __clang_minor__ == 4
269 # define GLM_COMPILER GLM_COMPILER_LLVM34
270 # elif __clang_major__ == 3 && __clang_minor__ == 5
271 # define GLM_COMPILER GLM_COMPILER_LLVM35
272 # elif __clang_major__ == 3 && __clang_minor__ == 6
273 # define GLM_COMPILER GLM_COMPILER_LLVM36
274 # elif __clang_major__ == 3 && __clang_minor__ == 7
275 # define GLM_COMPILER GLM_COMPILER_LLVM37
276 # elif __clang_major__ == 3 && __clang_minor__ == 8
277 # define GLM_COMPILER GLM_COMPILER_LLVM38
278 # elif __clang_major__ == 3 && __clang_minor__ >= 9
279 # define GLM_COMPILER GLM_COMPILER_LLVM39
280 # elif __clang_major__ >= 4
281 # define GLM_COMPILER GLM_COMPILER_LLVM39
282 # else
283 # define GLM_COMPILER GLM_COMPILER_LLVM
284 # endif
285 # endif
286
287 // G++
288 #elif defined(__GNUC__) || defined(__MINGW32__)
289 # if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
290 # define GLM_COMPILER (GLM_COMPILER_GCC42)
291 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
292 # define GLM_COMPILER (GLM_COMPILER_GCC43)
293 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
294 # define GLM_COMPILER (GLM_COMPILER_GCC44)
295 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
296 # define GLM_COMPILER (GLM_COMPILER_GCC45)
297 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
298 # define GLM_COMPILER (GLM_COMPILER_GCC46)
299 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
300 # define GLM_COMPILER (GLM_COMPILER_GCC47)
301 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
302 # define GLM_COMPILER (GLM_COMPILER_GCC48)
303 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
304 # define GLM_COMPILER (GLM_COMPILER_GCC49)
305 # elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
306 # define GLM_COMPILER (GLM_COMPILER_GCC50)
307 # elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 1)
308 # define GLM_COMPILER (GLM_COMPILER_GCC51)
309 # elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 2)
310 # define GLM_COMPILER (GLM_COMPILER_GCC52)
311 # elif (__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)
312 # define GLM_COMPILER (GLM_COMPILER_GCC53)
313 # else
314 # define GLM_COMPILER (GLM_COMPILER_GCC)
315 # endif
316
317 #else
318 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
319 #endif
320
321 #ifndef GLM_COMPILER
322 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
323 #endif//GLM_COMPILER
324
325 // Report compiler detection
326 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
327 # define GLM_MESSAGE_COMPILER_DISPLAYED
328 # if GLM_COMPILER & GLM_COMPILER_CUDA
329 # pragma message("GLM: CUDA compiler detected")
330 # elif GLM_COMPILER & GLM_COMPILER_VC
331 # pragma message("GLM: Visual C++ compiler detected")
332 # elif GLM_COMPILER & GLM_COMPILER_APPLE_CLANG
333 # pragma message("GLM: Clang compiler detected")
334 # elif GLM_COMPILER & GLM_COMPILER_LLVM
335 # pragma message("GLM: LLVM compiler detected")
336 # elif GLM_COMPILER & GLM_COMPILER_INTEL
337 # pragma message("GLM: Intel Compiler detected")
338 # elif GLM_COMPILER & GLM_COMPILER_GCC
339 # pragma message("GLM: GCC compiler detected")
340 # else
341 # pragma message("GLM: Compiler not detected")
342 # endif
343 #endif//GLM_MESSAGE
344
346 // Build model
347
348 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
349 # define GLM_MODEL GLM_MODEL_64
350 #elif defined(__i386__) || defined(__ppc__)
351 # define GLM_MODEL GLM_MODEL_32
352 #else
353 # define GLM_MODEL GLM_MODEL_32
354 #endif//
355
356 #if !defined(GLM_MODEL) && GLM_COMPILER != 0
357 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
358 #endif//GLM_MODEL
359
360 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
361 # define GLM_MESSAGE_MODEL_DISPLAYED
362 # if(GLM_MODEL == GLM_MODEL_64)
363 # pragma message("GLM: 64 bits model")
364 # elif(GLM_MODEL == GLM_MODEL_32)
365 # pragma message("GLM: 32 bits model")
366 # endif//GLM_MODEL
367 #endif//GLM_MESSAGE
368
370 // C++ Version
371
372 // User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14
373
374 #define GLM_LANG_CXX98_FLAG (1 << 1)
375 #define GLM_LANG_CXX03_FLAG (1 << 2)
376 #define GLM_LANG_CXX0X_FLAG (1 << 3)
377 #define GLM_LANG_CXX11_FLAG (1 << 4)
378 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
379 #define GLM_LANG_CXX14_FLAG (1 << 6)
380 #define GLM_LANG_CXX1Z_FLAG (1 << 7)
381 #define GLM_LANG_CXXMS_FLAG (1 << 8)
382 #define GLM_LANG_CXXGNU_FLAG (1 << 9)
383
384 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
385 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
386 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
387 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
388 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
389 #define GLM_LANG_CXX14 (GLM_LANG_CXX1Y | GLM_LANG_CXX14_FLAG)
390 #define GLM_LANG_CXX1Z (GLM_LANG_CXX14 | GLM_LANG_CXX1Z_FLAG)
391 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
392 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
393
394 #if defined(GLM_FORCE_CXX14)
395 # undef GLM_FORCE_CXX11
396 # undef GLM_FORCE_CXX03
397 # undef GLM_FORCE_CXX98
398 # define GLM_LANG GLM_LANG_CXX14
399 #elif defined(GLM_FORCE_CXX11)
400 # undef GLM_FORCE_CXX03
401 # undef GLM_FORCE_CXX98
402 # define GLM_LANG GLM_LANG_CXX11
403 #elif defined(GLM_FORCE_CXX03)
404 # undef GLM_FORCE_CXX98
405 # define GLM_LANG GLM_LANG_CXX03
406 #elif defined(GLM_FORCE_CXX98)
407 # define GLM_LANG GLM_LANG_CXX98
408 #else
409 # if GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)
410 # if __cplusplus >= 201402L // GLM_COMPILER_LLVM34 + -std=c++14
411 # define GLM_LANG GLM_LANG_CXX14
412 # elif __has_feature(cxx_decltype_auto) && __has_feature(cxx_aggregate_nsdmi) // GLM_COMPILER_LLVM33 + -std=c++1y
413 # define GLM_LANG GLM_LANG_CXX1Y
414 # elif __cplusplus >= 201103L // GLM_COMPILER_LLVM33 + -std=c++11
415 # define GLM_LANG GLM_LANG_CXX11
416 # elif __has_feature(cxx_static_assert) // GLM_COMPILER_LLVM29 + -std=c++11
417 # define GLM_LANG GLM_LANG_CXX0X
418 # elif __cplusplus >= 199711L
419 # define GLM_LANG GLM_LANG_CXX98
420 # else
421 # define GLM_LANG GLM_LANG_CXX
422 # endif
423 # elif GLM_COMPILER & GLM_COMPILER_GCC
424 # if __cplusplus >= 201402L
425 # define GLM_LANG GLM_LANG_CXX14
426 # elif __cplusplus >= 201103L
427 # define GLM_LANG GLM_LANG_CXX11
428 # elif defined(__GXX_EXPERIMENTAL_CXX0X__)
429 # define GLM_LANG GLM_LANG_CXX0X
430 # else
431 # define GLM_LANG GLM_LANG_CXX98
432 # endif
433 # elif GLM_COMPILER & GLM_COMPILER_VC
434 # ifdef _MSC_EXTENSIONS
435 # if __cplusplus >= 201402L
436 # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
437 //# elif GLM_COMPILER >= GLM_COMPILER_VC2015
438 //# define GLM_LANG (GLM_LANG_CXX1Y | GLM_LANG_CXXMS_FLAG)
439 # elif __cplusplus >= 201103L
440 # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
441 # elif GLM_COMPILER >= GLM_COMPILER_VC2010
442 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
443 # elif __cplusplus >= 199711L
444 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
445 # else
446 # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG)
447 # endif
448 # else
449 # if __cplusplus >= 201402L
450 # define GLM_LANG GLM_LANG_CXX14
451 //# elif GLM_COMPILER >= GLM_COMPILER_VC2015
452 //# define GLM_LANG GLM_LANG_CXX1Y
453 # elif __cplusplus >= 201103L
454 # define GLM_LANG GLM_LANG_CXX11
455 # elif GLM_COMPILER >= GLM_COMPILER_VC2010
456 # define GLM_LANG GLM_LANG_CXX0X
457 # elif __cplusplus >= 199711L
458 # define GLM_LANG GLM_LANG_CXX98
459 # else
460 # define GLM_LANG GLM_LANG_CXX
461 # endif
462 # endif
463 # elif GLM_COMPILER & GLM_COMPILER_INTEL
464 # ifdef _MSC_EXTENSIONS
465 # if __cplusplus >= 201402L
466 # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
467 # elif __cplusplus >= 201103L
468 # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
469 # elif GLM_COMPILER >= GLM_COMPILER_INTEL13
470 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
471 # elif __cplusplus >= 199711L
472 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
473 # else
474 # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG)
475 # endif
476 # else
477 # if __cplusplus >= 201402L
478 # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
479 # elif __cplusplus >= 201103L
480 # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
481 # elif GLM_COMPILER >= GLM_COMPILER_INTEL13
482 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
483 # elif __cplusplus >= 199711L
484 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
485 # else
486 # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG)
487 # endif
488 # endif
489 # else // Unkown compiler
490 # if __cplusplus >= 201402L
491 # define GLM_LANG GLM_LANG_CXX14
492 # elif __cplusplus >= 201103L
493 # define GLM_LANG GLM_LANG_CXX11
494 # elif __cplusplus >= 199711L
495 # define GLM_LANG GLM_LANG_CXX98
496 # else
497 # define GLM_LANG GLM_LANG_CXX // Good luck with that!
498 # endif
499 # ifndef GLM_FORCE_PURE
500 # define GLM_FORCE_PURE
501 # endif
502 # endif
503 #endif
504
505 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED)
506 # define GLM_MESSAGE_LANG_DISPLAYED
507
508 # if GLM_LANG & GLM_LANG_CXX1Z_FLAG
509 # pragma message("GLM: C++1z")
510 # elif GLM_LANG & GLM_LANG_CXX14_FLAG
511 # pragma message("GLM: C++14")
512 # elif GLM_LANG & GLM_LANG_CXX1Y_FLAG
513 # pragma message("GLM: C++1y")
514 # elif GLM_LANG & GLM_LANG_CXX11_FLAG
515 # pragma message("GLM: C++11")
516 # elif GLM_LANG & GLM_LANG_CXX0X_FLAG
517 # pragma message("GLM: C++0x")
518 # elif GLM_LANG & GLM_LANG_CXX03_FLAG
519 # pragma message("GLM: C++03")
520 # elif GLM_LANG & GLM_LANG_CXX98_FLAG
521 # pragma message("GLM: C++98")
522 # else
523 # pragma message("GLM: C++ language undetected")
524 # endif//GLM_LANG
525
526 # if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
527 # pragma message("GLM: Language extensions enabled")
528 # endif//GLM_LANG
529 #endif//GLM_MESSAGE
530
532 // Has of C++ features
533
534 // http://clang.llvm.org/cxx_status.html
535 // http://gcc.gnu.org/projects/cxx0x.html
536 // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
537
538 #if GLM_PLATFORM == GLM_PLATFORM_ANDROID
539 # define GLM_HAS_CXX11_STL 0
540 #elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
541 # if __has_include(<__config>) // libc++
542 # include <__config>
543 //# else // libstdc++
544 //# include <bits/c++config.h>
545 # endif
546 # if defined(_LIBCPP_VERSION)// || defined(__GLIBCXX__)
547 # define GLM_HAS_CXX11_STL 1
548 # else
549 # define GLM_HAS_CXX11_STL 0
550 # endif
551 #else
552 # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && \
553 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
554 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
555 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)))
556 #endif
557
558 // N1720
559 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
560 # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)
561 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
562 # define GLM_HAS_STATIC_ASSERT 1
563 #else
564 # define GLM_HAS_STATIC_ASSERT (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
565 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
566 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)))
567 #endif
568
569 // N1988
570 #if GLM_LANG & GLM_LANG_CXX11_FLAG
571 # define GLM_HAS_EXTENDED_INTEGER_TYPE 1
572 #else
573 # define GLM_HAS_EXTENDED_INTEGER_TYPE (\
574 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
575 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
576 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \
577 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40)))
578 #endif
579
580 // N2235
581 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
582 # define GLM_HAS_CONSTEXPR __has_feature(cxx_constexpr)
583 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
584 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
585 # define GLM_HAS_CONSTEXPR 1
586 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
587 #else
588 # define GLM_HAS_CONSTEXPR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
589 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
590 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015))
591 #endif
592
593 // N2672
594 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
595 # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
596 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
597 # define GLM_HAS_INITIALIZER_LISTS 1
598 #else
599 # define GLM_HAS_INITIALIZER_LISTS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
600 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
601 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
602 #endif
603
604 // N2544 Unrestricted unions
605 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
606 # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
607 #elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG)
608 # define GLM_HAS_UNRESTRICTED_UNIONS 1
609 #else
610 # define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
611 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
612 #endif
613
614 // N2346
615 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
616 # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)
617 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
618 # define GLM_HAS_DEFAULTED_FUNCTIONS 1
619 #else
620 # define GLM_HAS_DEFAULTED_FUNCTIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
621 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
622 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
623 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)))
624 #endif
625
626 // N2118
627 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
628 # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
629 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
630 # define GLM_HAS_RVALUE_REFERENCES 1
631 #else
632 # define GLM_HAS_RVALUE_REFERENCES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
633 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
634 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
635 #endif
636
637 // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
638 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
639 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
640 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
641 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
642 #else
643 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
644 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
645 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
646 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
647 #endif
648
649 // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
650 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
651 # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
652 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
653 # define GLM_HAS_TEMPLATE_ALIASES 1
654 #else
655 # define GLM_HAS_TEMPLATE_ALIASES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
656 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \
657 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \
658 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
659 #endif
660
661 // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
662 #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
663 # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
664 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
665 # define GLM_HAS_RANGE_FOR 1
666 #else
667 # define GLM_HAS_RANGE_FOR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
668 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
669 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \
670 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
671 #endif
672
673 //
674 #if GLM_LANG & GLM_LANG_CXX11_FLAG
675 # define GLM_HAS_ASSIGNABLE 1
676 #else
677 # define GLM_HAS_ASSIGNABLE (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
678 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
679 #endif
680
681 //
682 #define GLM_HAS_TRIVIAL_QUERIES 0
683
684 //
685 #if GLM_LANG & GLM_LANG_CXX11_FLAG
686 # define GLM_HAS_MAKE_SIGNED 1
687 #else
688 # define GLM_HAS_MAKE_SIGNED (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
689 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
690 #endif
691
692 //
693 #if GLM_ARCH == GLM_ARCH_PURE
694 # define GLM_HAS_BITSCAN_WINDOWS 0
695 #else
696 # define GLM_HAS_BITSCAN_WINDOWS (GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
697 (GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))
698 #endif
699
700 // OpenMP
701 #ifdef _OPENMP
702 # if GLM_COMPILER & GLM_COMPILER_GCC
703 # if GLM_COMPILER >= GLM_COMPILER_GCC47
704 # define GLM_HAS_OPENMP 31
705 # elif GLM_COMPILER >= GLM_COMPILER_GCC44
706 # define GLM_HAS_OPENMP 30
707 # elif GLM_COMPILER >= GLM_COMPILER_GCC42
708 # define GLM_HAS_OPENMP 25
709 # endif
710 # endif// GLM_COMPILER & GLM_COMPILER_GCC
711
712 # if GLM_COMPILER & GLM_COMPILER_VC
713 # if GLM_COMPILER >= GLM_COMPILER_VC2010
714 # define GLM_HAS_OPENMP 20
715 # endif
716 # endif// GLM_COMPILER & GLM_COMPILER_VC
717 #endif
718
719 // Not standard
720 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
721
723 // Platform
724
725 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
726
727 #define GLM_ARCH_PURE 0x0000
728 #define GLM_ARCH_ARM 0x0001
729 #define GLM_ARCH_X86 0x0002
730 #define GLM_ARCH_SSE2 0x0004
731 #define GLM_ARCH_SSE3 0x0008
732 #define GLM_ARCH_SSE4 0x0010
733 #define GLM_ARCH_AVX 0x0020
734 #define GLM_ARCH_AVX2 0x0040
735
736 #if defined(GLM_FORCE_PURE)
737 # define GLM_ARCH GLM_ARCH_PURE
738 #elif defined(GLM_FORCE_AVX2)
739 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
740 #elif defined(GLM_FORCE_AVX)
741 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
742 #elif defined(GLM_FORCE_SSE4)
743 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
744 #elif defined(GLM_FORCE_SSE3)
745 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
746 #elif defined(GLM_FORCE_SSE2)
747 # define GLM_ARCH (GLM_ARCH_SSE2)
748 #elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX))
749 # if(__AVX2__)
750 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
751 # elif(__AVX__)
752 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
753 # elif(__SSE3__)
754 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
755 # elif(__SSE2__)
756 # define GLM_ARCH (GLM_ARCH_SSE2)
757 # else
758 # define GLM_ARCH GLM_ARCH_PURE
759 # endif
760 #elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
761 # if defined(_M_ARM_FP)
762 # define GLM_ARCH (GLM_ARCH_ARM)
763 # elif defined(__AVX2__)
764 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
765 # elif defined(__AVX__)
766 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
767 # elif _M_IX86_FP == 2
768 # define GLM_ARCH (GLM_ARCH_SSE2)
769 # else
770 # define GLM_ARCH (GLM_ARCH_PURE)
771 # endif
772 #elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
773 # if defined(__AVX2__)
774 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
775 # elif defined(__AVX__)
776 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
777 # elif defined(__SSE4_1__ )
778 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
779 # elif defined(__SSE3__)
780 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
781 # elif defined(__SSE2__)
782 # define GLM_ARCH (GLM_ARCH_SSE2)
783 # else
784 # define GLM_ARCH (GLM_ARCH_PURE)
785 # endif
786 #else
787 # define GLM_ARCH GLM_ARCH_PURE
788 #endif
789
790 // With MinGW-W64, including intrinsic headers before intrin.h will produce some errors. The problem is
791 // that windows.h (and maybe other headers) will silently include intrin.h, which of course causes problems.
792 // To fix, we just explicitly include intrin.h here.
793 #if defined(__MINGW64__) && (GLM_ARCH != GLM_ARCH_PURE)
794 # include <intrin.h>
795 #endif
796
797 #if GLM_ARCH & GLM_ARCH_AVX2
798 # include <immintrin.h>
799 #endif//GLM_ARCH
800 #if GLM_ARCH & GLM_ARCH_AVX
801 # include <immintrin.h>
802 #endif//GLM_ARCH
803 #if GLM_ARCH & GLM_ARCH_SSE4
804 # include <smmintrin.h>
805 #endif//GLM_ARCH
806 #if GLM_ARCH & GLM_ARCH_SSE3
807 # include <pmmintrin.h>
808 #endif//GLM_ARCH
809 #if GLM_ARCH & GLM_ARCH_SSE2
810 # include <emmintrin.h>
811 # if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
812 inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
813 inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
814 inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
815 inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
816 inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
817 # endif
818 #endif//GLM_ARCH
819
820 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
821 # define GLM_MESSAGE_ARCH_DISPLAYED
822 # if(GLM_ARCH == GLM_ARCH_PURE)
823 # pragma message("GLM: Platform independent code")
824 # elif(GLM_ARCH & GLM_ARCH_ARM)
825 # pragma message("GLM: ARM instruction set")
826 # elif(GLM_ARCH & GLM_ARCH_AVX2)
827 # pragma message("GLM: AVX2 instruction set")
828 # elif(GLM_ARCH & GLM_ARCH_AVX)
829 # pragma message("GLM: AVX instruction set")
830 # elif(GLM_ARCH & GLM_ARCH_SSE3)
831 # pragma message("GLM: SSE3 instruction set")
832 # elif(GLM_ARCH & GLM_ARCH_SSE2)
833 # pragma message("GLM: SSE2 instruction set")
834 # endif//GLM_ARCH
835 #endif//GLM_MESSAGE
836
838 // Static assert
839
840 #if GLM_HAS_STATIC_ASSERT
841 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
842 #elif defined(BOOST_STATIC_ASSERT)
843 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
844 #elif GLM_COMPILER & GLM_COMPILER_VC
845 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
846 #else
847 # define GLM_STATIC_ASSERT(x, message)
848 # define GLM_STATIC_ASSERT_NULL
849 #endif//GLM_LANG
850
852 // Qualifiers
853
854 #if GLM_COMPILER & GLM_COMPILER_CUDA
855 # define GLM_CUDA_FUNC_DEF __device__ __host__
856 # define GLM_CUDA_FUNC_DECL __device__ __host__
857 #else
858 # define GLM_CUDA_FUNC_DEF
859 # define GLM_CUDA_FUNC_DECL
860 #endif
861
862 #if GLM_COMPILER & GLM_COMPILER_GCC
863 # define GLM_VAR_USED __attribute__ ((unused))
864 #else
865 # define GLM_VAR_USED
866 #endif
867
868 #if defined(GLM_FORCE_INLINE)
869 # if GLM_COMPILER & GLM_COMPILER_VC
870 # define GLM_INLINE __forceinline
871 # define GLM_NEVER_INLINE __declspec((noinline))
872 # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)
873 # define GLM_INLINE inline __attribute__((__always_inline__))
874 # define GLM_NEVER_INLINE __attribute__((__noinline__))
875 # else
876 # define GLM_INLINE inline
877 # define GLM_NEVER_INLINE
878 # endif//GLM_COMPILER
879 #else
880 # define GLM_INLINE inline
881 # define GLM_NEVER_INLINE
882 #endif//defined(GLM_FORCE_INLINE)
883
884 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
885 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
886
888 // Swizzle operators
889
890 // User defines: GLM_SWIZZLE
891
892 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
893 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
894 # if defined(GLM_SWIZZLE)
895 # pragma message("GLM: Swizzling operators enabled")
896 # else
897 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
898 # endif
899 #endif//GLM_MESSAGE
900
902 // Qualifiers
903
904 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
905 # define GLM_DEPRECATED __declspec(deprecated)
906 # define GLM_ALIGN(x) __declspec(align(x))
907 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x))
908 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
909 # define GLM_RESTRICT __declspec(restrict)
910 # define GLM_RESTRICT_VAR __restrict
911 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL)
912 # define GLM_DEPRECATED __attribute__((__deprecated__))
913 # define GLM_ALIGN(x) __attribute__((aligned(x)))
914 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
915 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
916 # define GLM_RESTRICT __restrict__
917 # define GLM_RESTRICT_VAR __restrict__
918 #else
919 # define GLM_DEPRECATED
920 # define GLM_ALIGN
921 # define GLM_ALIGNED_STRUCT(x) struct
922 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
923 # define GLM_RESTRICT
924 # define GLM_RESTRICT_VAR
925 #endif//GLM_COMPILER
926
927 #if GLM_HAS_DEFAULTED_FUNCTIONS
928 # define GLM_DEFAULT = default
929 # ifdef GLM_FORCE_NO_CTOR_INIT
930 # define GLM_DEFAULT_CTOR = default
931 # else
932 # define GLM_DEFAULT_CTOR
933 # endif
934 #else
935 # define GLM_DEFAULT
936 # define GLM_DEFAULT_CTOR
937 #endif
938
939 #if GLM_HAS_CONSTEXPR
940 # define GLM_CONSTEXPR constexpr
941 # define GLM_RELAXED_CONSTEXPR constexpr
942 #else
943 # define GLM_CONSTEXPR
944 # define GLM_RELAXED_CONSTEXPR const
945 #endif
946
947 #ifdef GLM_FORCE_EXPLICIT_CTOR
948 # define GLM_EXPLICIT explicit
949 #else
950 # define GLM_EXPLICIT
951 #endif
952
954 // Length type
955
956 // User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC
957
958 namespace glm
959 {
960 using std::size_t;
961 # if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
962 typedef size_t length_t;
963 # else
964 typedef int length_t;
965 # endif
966
967 namespace detail
968 {
969 # ifdef GLM_FORCE_SIZE_FUNC
970 typedef size_t component_count_t;
971 # else
972 typedef length_t component_count_t;
973 # endif
974
975 template <typename genType>
976 GLM_FUNC_QUALIFIER GLM_CONSTEXPR component_count_t component_count(genType const & m)
977 {
978 # ifdef GLM_FORCE_SIZE_FUNC
979 return m.size();
980 # else
981 return m.length();
982 # endif
983 }
984 }//namespace detail
985 }//namespace glm
986
987 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
988 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
989 # if defined GLM_FORCE_SIZE_FUNC
990 # pragma message("GLM: .length() is replaced by .size() and returns a std::size_t")
991 # elif defined GLM_FORCE_SIZE_T_LENGTH
992 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
993 # else
994 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
995 # endif
996 #endif//GLM_MESSAGE
997
999 // countof
1000
1001 #ifndef __has_feature
1002 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
1003 #endif
1004
1005 #if GLM_HAS_CONSTEXPR_PARTIAL
1006 namespace glm
1007 {
1008 template <typename T, std::size_t N>
1009 constexpr std::size_t countof(T const (&)[N])
1010 {
1011 return N;
1012 }
1013 }//namespace glm
1014 # define GLM_COUNTOF(arr) glm::countof(arr)
1015 #elif _MSC_VER
1016 # define GLM_COUNTOF(arr) _countof(arr)
1017 #else
1018 # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])
1019 #endif
1020
1022 // Uninitialize constructors
1023
1024 namespace glm
1025 {
1026 enum ctor{uninitialize};
1027 }//namespace glm
glm
Definition: _noise.hpp:40
glm::pi
GLM_FUNC_DECL genType pi()
Return the pi constant.