0.9.6
setup.hpp
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include <cassert>
32 #include <cstddef>
33 
35 // Version
36 
37 #define GLM_VERSION 96
38 #define GLM_VERSION_MAJOR 0
39 #define GLM_VERSION_MINOR 9
40 #define GLM_VERSION_PATCH 6
41 #define GLM_VERSION_REVISION 0
42 
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 
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_INTEL12 0x00100010
118 #define GLM_COMPILER_INTEL12_1 0x00100020
119 #define GLM_COMPILER_INTEL13 0x00100030
120 #define GLM_COMPILER_INTEL14 0x00100040
121 #define GLM_COMPILER_INTEL15 0x00100050
122 
123 // Visual C++ defines
124 #define GLM_COMPILER_VC 0x01000000
125 #define GLM_COMPILER_VC2010 0x01000090
126 #define GLM_COMPILER_VC2012 0x010000A0
127 #define GLM_COMPILER_VC2013 0x010000B0
128 #define GLM_COMPILER_VC2015 0x010000C0
129 
130 // GCC defines
131 #define GLM_COMPILER_GCC 0x02000000
132 #define GLM_COMPILER_GCC42 0x02000090
133 #define GLM_COMPILER_GCC43 0x020000A0
134 #define GLM_COMPILER_GCC44 0x020000B0
135 #define GLM_COMPILER_GCC45 0x020000C0
136 #define GLM_COMPILER_GCC46 0x020000D0
137 #define GLM_COMPILER_GCC47 0x020000E0
138 #define GLM_COMPILER_GCC48 0x020000F0
139 #define GLM_COMPILER_GCC49 0x02000100
140 #define GLM_COMPILER_GCC50 0x02000200
141 
142 // CUDA
143 #define GLM_COMPILER_CUDA 0x10000000
144 #define GLM_COMPILER_CUDA30 0x10000010
145 #define GLM_COMPILER_CUDA31 0x10000020
146 #define GLM_COMPILER_CUDA32 0x10000030
147 #define GLM_COMPILER_CUDA40 0x10000040
148 #define GLM_COMPILER_CUDA41 0x10000050
149 #define GLM_COMPILER_CUDA42 0x10000060
150 #define GLM_COMPILER_CUDA50 0x10000070
151 #define GLM_COMPILER_CUDA60 0x10000080
152 #define GLM_COMPILER_CUDA65 0x10000090
153 
154 // LLVM
155 #define GLM_COMPILER_LLVM 0x20000000
156 #define GLM_COMPILER_LLVM30 0x20000010
157 #define GLM_COMPILER_LLVM31 0x20000020
158 #define GLM_COMPILER_LLVM32 0x20000030
159 #define GLM_COMPILER_LLVM33 0x20000040
160 #define GLM_COMPILER_LLVM34 0x20000050
161 #define GLM_COMPILER_LLVM35 0x20000060
162 
163 // Apple Clang
164 #define GLM_COMPILER_APPLE_CLANG 0x40000000
165 #define GLM_COMPILER_APPLE_CLANG40 0x40000010
166 #define GLM_COMPILER_APPLE_CLANG41 0x40000020
167 #define GLM_COMPILER_APPLE_CLANG42 0x40000030
168 #define GLM_COMPILER_APPLE_CLANG50 0x40000040
169 #define GLM_COMPILER_APPLE_CLANG51 0x40000050
170 #define GLM_COMPILER_APPLE_CLANG60 0x40000060
171 
172 // Build model
173 #define GLM_MODEL_32 0x00000010
174 #define GLM_MODEL_64 0x00000020
175 
176 // Force generic C++ compiler
177 #ifdef GLM_FORCE_COMPILER_UNKNOWN
178 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
179 
180 #elif defined(__INTEL_COMPILER)
181 # if __INTEL_COMPILER == 1200
182 # define GLM_COMPILER GLM_COMPILER_INTEL12
183 # elif __INTEL_COMPILER == 1210
184 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
185 # elif __INTEL_COMPILER == 1300
186 # define GLM_COMPILER GLM_COMPILER_INTEL13
187 # elif __INTEL_COMPILER == 1400
188 # define GLM_COMPILER GLM_COMPILER_INTEL14
189 # elif __INTEL_COMPILER >= 1500
190 # define GLM_COMPILER GLM_COMPILER_INTEL15
191 # else
192 # define GLM_COMPILER GLM_COMPILER_INTEL
193 # endif
194 
195 // CUDA
196 #elif defined(__CUDACC__)
197 # if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
198 # include <cuda.h> // make sure version is defined since nvcc does not define it itself!
199 # endif
200 # if CUDA_VERSION < 3000
201 # error "GLM requires CUDA 3.0 or higher"
202 # else
203 # define GLM_COMPILER GLM_COMPILER_CUDA
204 # endif
205 
206 // Visual C++
207 #elif defined(_MSC_VER)
208 # if _MSC_VER < 1600
209 # error "GLM requires Visual C++ 2010 or higher"
210 # elif _MSC_VER == 1600
211 # define GLM_COMPILER GLM_COMPILER_VC2010
212 # elif _MSC_VER == 1700
213 # define GLM_COMPILER GLM_COMPILER_VC2012
214 # elif _MSC_VER == 1800
215 # define GLM_COMPILER GLM_COMPILER_VC2013
216 # elif _MSC_VER >= 1900
217 # define GLM_COMPILER GLM_COMPILER_VC2015
218 # else//_MSC_VER
219 # define GLM_COMPILER GLM_COMPILER_VC
220 # endif//_MSC_VER
221 
222 // Clang
223 #elif defined(__clang__)
224 # if GLM_PLATFORM & GLM_PLATFORM_APPLE
225 # if __clang_major__ == 4 && __clang_minor__ == 0
226 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG40
227 # elif __clang_major__ == 4 && __clang_minor__ == 1
228 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG41
229 # elif __clang_major__ == 4 && __clang_minor__ == 2
230 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG42
231 # elif __clang_major__ == 5 && __clang_minor__ == 0
232 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG50
233 # elif __clang_major__ == 5 && __clang_minor__ == 1
234 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG51
235 # elif __clang_major__ >= 6
236 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG60
237 # endif
238 # else
239 # if __clang_major__ == 3 && __clang_minor__ == 0
240 # define GLM_COMPILER GLM_COMPILER_LLVM30
241 # elif __clang_major__ == 3 && __clang_minor__ == 1
242 # define GLM_COMPILER GLM_COMPILER_LLVM31
243 # elif __clang_major__ == 3 && __clang_minor__ == 2
244 # define GLM_COMPILER GLM_COMPILER_LLVM32
245 # elif __clang_major__ == 3 && __clang_minor__ == 3
246 # define GLM_COMPILER GLM_COMPILER_LLVM33
247 # elif __clang_major__ == 3 && __clang_minor__ == 4
248 # define GLM_COMPILER GLM_COMPILER_LLVM34
249 # elif __clang_major__ == 3 && __clang_minor__ == 5
250 # define GLM_COMPILER GLM_COMPILER_LLVM35
251 # else
252 # define GLM_COMPILER GLM_COMPILER_LLVM35
253 # endif
254 # endif
255 
256 // G++
257 #elif defined(__GNUC__) || defined(__MINGW32__)
258 # if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
259 # define GLM_COMPILER (GLM_COMPILER_GCC42)
260 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
261 # define GLM_COMPILER (GLM_COMPILER_GCC43)
262 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
263 # define GLM_COMPILER (GLM_COMPILER_GCC44)
264 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
265 # define GLM_COMPILER (GLM_COMPILER_GCC45)
266 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
267 # define GLM_COMPILER (GLM_COMPILER_GCC46)
268 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
269 # define GLM_COMPILER (GLM_COMPILER_GCC47)
270 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
271 # define GLM_COMPILER (GLM_COMPILER_GCC48)
272 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
273 # define GLM_COMPILER (GLM_COMPILER_GCC49)
274 # elif (__GNUC__ > 4 )
275 # define GLM_COMPILER (GLM_COMPILER_GCC50)
276 # else
277 # define GLM_COMPILER (GLM_COMPILER_GCC)
278 # endif
279 
280 #else
281 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
282 #endif
283 
284 #ifndef GLM_COMPILER
285 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
286 #endif//GLM_COMPILER
287 
288 // Report compiler detection
289 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
290 # define GLM_MESSAGE_COMPILER_DISPLAYED
291 # if GLM_COMPILER & GLM_COMPILER_CUDA
292 # pragma message("GLM: CUDA compiler detected")
293 # elif GLM_COMPILER & GLM_COMPILER_VC
294 # pragma message("GLM: Visual C++ compiler detected")
295 # elif GLM_COMPILER & GLM_COMPILER_APPLE_CLANG
296 # pragma message("GLM: Clang compiler detected")
297 # elif GLM_COMPILER & GLM_COMPILER_LLVM
298 # pragma message("GLM: LLVM compiler detected")
299 # elif GLM_COMPILER & GLM_COMPILER_INTEL
300 # pragma message("GLM: Intel Compiler detected")
301 # elif GLM_COMPILER & GLM_COMPILER_GCC
302 # pragma message("GLM: GCC compiler detected")
303 # else
304 # pragma message("GLM: Compiler not detected")
305 # endif
306 #endif//GLM_MESSAGE
307 
309 // Build model
310 
311 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
312 # define GLM_MODEL GLM_MODEL_64
313 #elif defined(__i386__) || defined(__ppc__)
314 # define GLM_MODEL GLM_MODEL_32
315 #else
316 # define GLM_MODEL GLM_MODEL_32
317 #endif//
318 
319 #if !defined(GLM_MODEL) && GLM_COMPILER != 0
320 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
321 #endif//GLM_MODEL
322 
323 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
324 # define GLM_MESSAGE_MODEL_DISPLAYED
325 # if(GLM_MODEL == GLM_MODEL_64)
326 # pragma message("GLM: 64 bits model")
327 # elif(GLM_MODEL == GLM_MODEL_32)
328 # pragma message("GLM: 32 bits model")
329 # endif//GLM_MODEL
330 #endif//GLM_MESSAGE
331 
333 // C++ Version
334 
335 // User defines: GLM_FORCE_CXX98
336 
337 #define GLM_LANG_CXX98_FLAG (1 << 1)
338 #define GLM_LANG_CXX03_FLAG (1 << 2)
339 #define GLM_LANG_CXX0X_FLAG (1 << 3)
340 #define GLM_LANG_CXX11_FLAG (1 << 4)
341 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
342 #define GLM_LANG_CXXMS_FLAG (1 << 6)
343 #define GLM_LANG_CXXGNU_FLAG (1 << 7)
344 
345 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
346 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
347 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
348 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
349 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
350 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
351 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
352 
353 #if defined(GLM_FORCE_CXX1Y)
354 # define GLM_LANG GLM_LANG_CXX1Y
355 #elif defined(GLM_FORCE_CXX11)
356 # define GLM_LANG GLM_LANG_CXX11
357 #elif defined(GLM_FORCE_CXX03)
358 # define GLM_LANG GLM_LANG_CXX03
359 #elif defined(GLM_FORCE_CXX98)
360 # define GLM_LANG GLM_LANG_CXX98
361 #else
362 # if __cplusplus >= 201103L
363 # define GLM_LANG GLM_LANG_CXX11
364 # elif GLM_COMPILER & GLM_COMPILER_CLANG
365 # if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
366 # define GLM_DETAIL_MAJOR 1
367 # else
368 # define GLM_DETAIL_MAJOR 0
369 # endif
370 # if __clang_major__ < (2 + GLM_DETAIL_MAJOR)
371 # define GLM_LANG GLM_LANG_CXX
372 # elif __has_feature(cxx_auto_type)
373 # define GLM_LANG GLM_LANG_CXX0X
374 # else
375 # define GLM_LANG GLM_LANG_CXX98
376 # endif
377 # elif GLM_COMPILER & GLM_COMPILER_GCC
378 # ifdef __GXX_EXPERIMENTAL_CXX0X__
379 # define GLM_LANG GLM_LANG_CXX0X
380 # else
381 # define GLM_LANG GLM_LANG_CXX98
382 # endif
383 # elif GLM_COMPILER & GLM_COMPILER_VC
384 # ifdef _MSC_EXTENSIONS
385 # if GLM_COMPILER >= GLM_COMPILER_VC2010
386 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
387 # else
388 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
389 # endif
390 # else
391 # if GLM_COMPILER >= GLM_COMPILER_VC2010
392 # define GLM_LANG GLM_LANG_CXX0X
393 # else
394 # define GLM_LANG GLM_LANG_CXX98
395 # endif
396 # endif
397 # elif GLM_COMPILER & GLM_COMPILER_INTEL
398 # ifdef _MSC_EXTENSIONS
399 # if GLM_COMPILER >= GLM_COMPILER_INTEL13
400 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
401 # else
402 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
403 # endif
404 # else
405 # if GLM_COMPILER >= GLM_COMPILER_INTEL13
406 # define GLM_LANG (GLM_LANG_CXX0X)
407 # else
408 # define GLM_LANG (GLM_LANG_CXX98)
409 # endif
410 # endif
411 # else
412 # if __cplusplus >= 199711L
413 # define GLM_LANG GLM_LANG_CXX98
414 # endif
415 # ifndef GLM_FORCE_CXX98
416 # define GLM_FORCE_CXX98
417 # endif
418 # ifndef GLM_FORCE_PURE
419 # define GLM_FORCE_PURE
420 # endif
421 # endif
422 #endif
423 
424 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED)
425 # define GLM_MESSAGE_LANG_DISPLAYED
426 # if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
427 # pragma message("GLM: C++ with language extensions")
428 # elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
429 # pragma message("GLM: C++ with language extensions")
430 # elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
431 # pragma message("GLM: C++11")
432 # elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
433 # pragma message("GLM: C++0x")
434 # elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
435 # pragma message("GLM: C++03")
436 # elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
437 # pragma message("GLM: C++98")
438 # else
439 # pragma message("GLM: C++ language undetected")
440 # endif//GLM_MODEL
441 # 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")
442 #endif//GLM_MESSAGE
443 
445 // Has of C++ features
446 
447 #ifndef __has_feature
448 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
449 #endif
450 #ifndef __has_extension
451 # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
452 #endif
453 
454 // http://clang.llvm.org/cxx_status.html
455 // http://gcc.gnu.org/projects/cxx0x.html
456 // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
457 
458 // N1720
459 #define GLM_HAS_CXX11_STL ( \
460  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
461  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)))
462 
463 // N1720
464 #define GLM_HAS_STATIC_ASSERT ( \
465  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
466  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \
467  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
468  __has_feature(cxx_static_assert))
469 
470 // N1988
471 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
472  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
473  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
474  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
475  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \
476  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40)))
477 
478 // N2235
479 #define GLM_HAS_CONSTEXPR ( \
480  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
481  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
482  __has_feature(cxx_constexpr))
483 
484 // N2672
485 #define GLM_HAS_INITIALIZER_LISTS ( \
486  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
487  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
488  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
489  __has_feature(cxx_generalized_initializers))
490 
491 // N2544 Unrestricted unions
492 #define GLM_HAS_UNRESTRICTED_UNIONS ( \
493  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
494  (GLM_LANG & GLM_LANG_CXXMS_FLAG) || \
495  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
496  __has_feature(cxx_unrestricted_unions))
497 
498 // N2346
499 #define GLM_HAS_DEFAULTED_FUNCTIONS ( \
500  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
501  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
502  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
503  __has_feature(cxx_defaulted_functions))
504 
505 // N2118
506 #define GLM_HAS_RVALUE_REFERENCES ( \
507  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
508  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))) || \
509  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
510  __has_feature(cxx_rvalue_references))
511 
512 #define GLM_HAS_STL_ARRAY ( \
513  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
514  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))) || \
515  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)))
516 
517 #define GLM_HAS_TEMPLATE_ALIASES ( \
518  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
519  __has_feature(cxx_alias_templates))
520 
521 #define GLM_HAS_RANGE_FOR ( \
522  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
523  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))) || \
524  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
525  __has_feature(cxx_range_for))
526 
527 #define GLM_HAS_ASSIGNABLE ( \
528  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
529  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
530 
531 #define GLM_HAS_TRIVIAL_QUERIES (\
532  ((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_COMPILER & GLM_COMPILER_GCC)) || \
533  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
534 
535 #define GLM_HAS_MAKE_SIGNED (\
536  (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
537  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
538 
539 // OpenMP
540 #ifdef _OPENMP
541 # if GLM_COMPILER & GLM_COMPILER_GCC
542 # if GLM_COMPILER >= GLM_COMPILER_GCC47
543 # define GLM_HAS_OPENMP 31
544 # elif GLM_COMPILER >= GLM_COMPILER_GCC44
545 # define GLM_HAS_OPENMP 30
546 # elif GLM_COMPILER >= GLM_COMPILER_GCC42
547 # define GLM_HAS_OPENMP 25
548 # endif
549 # endif// GLM_COMPILER & GLM_COMPILER_GCC
550 
551 # if GLM_COMPILER & GLM_COMPILER_VC
552 # if GLM_COMPILER >= GLM_COMPILER_VC2010
553 # define GLM_HAS_OPENMP 20
554 # endif
555 # endif// GLM_COMPILER & GLM_COMPILER_VC
556 #endif
557 
558 // Not standard
559 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
560 
562 // Platform
563 
564 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
565 
566 #define GLM_ARCH_PURE 0x0000
567 #define GLM_ARCH_X86 0x0001
568 #define GLM_ARCH_SSE2 0x0002
569 #define GLM_ARCH_SSE3 0x0004
570 #define GLM_ARCH_SSE4 0x0008
571 #define GLM_ARCH_AVX 0x0010
572 #define GLM_ARCH_AVX2 0x0020
573 
574 #if defined(GLM_FORCE_PURE)
575 # define GLM_ARCH GLM_ARCH_PURE
576 #elif defined(GLM_FORCE_AVX2)
577 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
578 #elif defined(GLM_FORCE_AVX)
579 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
580 #elif defined(GLM_FORCE_SSE4)
581 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
582 #elif defined(GLM_FORCE_SSE3)
583 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
584 #elif defined(GLM_FORCE_SSE2)
585 # define GLM_ARCH (GLM_ARCH_SSE2)
586 #elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)
587 # if(__AVX2__)
588 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
589 # elif(__AVX__)
590 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
591 # elif(__SSE3__)
592 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
593 # elif(__SSE2__)
594 # define GLM_ARCH (GLM_ARCH_SSE2)
595 # else
596 # define GLM_ARCH GLM_ARCH_PURE
597 # endif
598 #elif GLM_COMPILER & GLM_COMPILER_VC
599 # if defined(__AVX2__)
600 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
601 # elif defined(__AVX__)
602 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
603 # elif _M_IX86_FP == 2
604 # define GLM_ARCH (GLM_ARCH_SSE2)
605 # else
606 # define GLM_ARCH (GLM_ARCH_PURE)
607 # endif
608 #elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
609 # if defined(__AVX2__)
610 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
611 # elif defined(__AVX__)
612 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
613 # elif defined(__SSE4_1__ )
614 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
615 # elif defined(__SSE3__)
616 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
617 # elif defined(__SSE2__)
618 # define GLM_ARCH (GLM_ARCH_SSE2)
619 # else
620 # define GLM_ARCH (GLM_ARCH_PURE)
621 # endif
622 #else
623 # define GLM_ARCH GLM_ARCH_PURE
624 #endif
625 
626 // With MinGW-W64, including intrinsic headers before intrin.h will produce some errors. The problem is
627 // that windows.h (and maybe other headers) will silently include intrin.h, which of course causes problems.
628 // To fix, we just explicitly include intrin.h here.
629 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
630 # include <intrin.h>
631 #endif
632 
633 #if GLM_ARCH & GLM_ARCH_AVX2
634 # include <immintrin.h>
635 #endif//GLM_ARCH
636 #if GLM_ARCH & GLM_ARCH_AVX
637 # include <immintrin.h>
638 #endif//GLM_ARCH
639 #if GLM_ARCH & GLM_ARCH_SSE4
640 # include <smmintrin.h>
641 #endif//GLM_ARCH
642 #if GLM_ARCH & GLM_ARCH_SSE3
643 # include <pmmintrin.h>
644 #endif//GLM_ARCH
645 #if GLM_ARCH & GLM_ARCH_SSE2
646 # include <emmintrin.h>
647 # if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
648  inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
649  inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
650  inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
651  inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
652  inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
653 # endif
654 #endif//GLM_ARCH
655 
656 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
657 # define GLM_MESSAGE_ARCH_DISPLAYED
658 # if(GLM_ARCH == GLM_ARCH_PURE)
659 # pragma message("GLM: Platform independent code")
660 # elif(GLM_ARCH & GLM_ARCH_AVX2)
661 # pragma message("GLM: AVX2 instruction set")
662 # elif(GLM_ARCH & GLM_ARCH_AVX)
663 # pragma message("GLM: AVX instruction set")
664 # elif(GLM_ARCH & GLM_ARCH_SSE3)
665 # pragma message("GLM: SSE3 instruction set")
666 # elif(GLM_ARCH & GLM_ARCH_SSE2)
667 # pragma message("GLM: SSE2 instruction set")
668 # endif//GLM_ARCH
669 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
670 #endif//GLM_MESSAGE
671 
673 // Static assert
674 
675 #if GLM_HAS_STATIC_ASSERT
676 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
677 #elif defined(BOOST_STATIC_ASSERT)
678 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
679 #elif GLM_COMPILER & GLM_COMPILER_VC
680 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
681 #else
682 # define GLM_STATIC_ASSERT(x, message)
683 # define GLM_STATIC_ASSERT_NULL
684 #endif//GLM_LANG
685 
687 // Qualifiers
688 
689 #if GLM_COMPILER & GLM_COMPILER_CUDA
690 # define GLM_CUDA_FUNC_DEF __device__ __host__
691 # define GLM_CUDA_FUNC_DECL __device__ __host__
692 #else
693 # define GLM_CUDA_FUNC_DEF
694 # define GLM_CUDA_FUNC_DECL
695 #endif
696 
697 #if GLM_COMPILER & GLM_COMPILER_GCC
698 # define GLM_VAR_USED __attribute__ ((unused))
699 #else
700 # define GLM_VAR_USED
701 #endif
702 
703 #if defined(GLM_FORCE_INLINE)
704 # if GLM_COMPILER & GLM_COMPILER_VC
705 # define GLM_INLINE __forceinline
706 # define GLM_NEVER_INLINE __declspec((noinline))
707 # elif GLM_COMPILER & GLM_COMPILER_GCC
708 # define GLM_INLINE inline __attribute__((__always_inline__))
709 # define GLM_NEVER_INLINE __attribute__((__noinline__))
710 # elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)
711 # define GLM_INLINE __attribute__((__always_inline__))
712 # define GLM_NEVER_INLINE __attribute__((__noinline__))
713 # else
714 # define GLM_INLINE inline
715 # define GLM_NEVER_INLINE
716 # endif//GLM_COMPILER
717 #else
718 # define GLM_INLINE inline
719 # define GLM_NEVER_INLINE
720 #endif//defined(GLM_FORCE_INLINE)
721 
722 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
723 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
724 
726 // Swizzle operators
727 
728 // User defines: GLM_SWIZZLE
729 
730 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
731 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
732 # if defined(GLM_SWIZZLE)
733 # pragma message("GLM: Swizzling operators enabled")
734 # else
735 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
736 # endif
737 #endif//GLM_MESSAGE
738 
740 // Qualifiers
741 
742 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
743 # define GLM_DEPRECATED __declspec(deprecated)
744 # define GLM_ALIGN(x) __declspec(align(x))
745 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x))
746 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
747 # define GLM_RESTRICT __declspec(restrict)
748 # define GLM_RESTRICT_VAR __restrict
749 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL)
750 # define GLM_DEPRECATED __attribute__((__deprecated__))
751 # define GLM_ALIGN(x) __attribute__((aligned(x)))
752 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
753 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
754 # define GLM_RESTRICT __restrict__
755 # define GLM_RESTRICT_VAR __restrict__
756 #else
757 # define GLM_DEPRECATED
758 # define GLM_ALIGN
759 # define GLM_ALIGNED_STRUCT(x) struct
760 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
761 # define GLM_RESTRICT
762 # define GLM_RESTRICT_VAR
763 #endif//GLM_COMPILER
764 
765 #if GLM_HAS_CONSTEXPR
766 # define GLM_CONSTEXPR constexpr
767 #else
768 # define GLM_CONSTEXPR
769 #endif
770 
772 // Length type
773 
774 // User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC
775 
776 namespace glm
777 {
778  using std::size_t;
779 #if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
780  typedef size_t length_t;
781 #else
782  typedef int length_t;
783 #endif
784 
785 namespace detail
786 {
787 # ifdef GLM_FORCE_SIZE_FUNC
788  typedef size_t component_count_t;
789 # else
790  typedef length_t component_count_t;
791 # endif
792 
793  template <typename genType>
794  GLM_FUNC_QUALIFIER GLM_CONSTEXPR component_count_t component_count(genType const & m)
795  {
796 # ifdef GLM_FORCE_SIZE_FUNC
797  return m.size();
798 # else
799  return m.length();
800 # endif
801  }
802 }//namespace detail
803 }//namespace glm
804 
805 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
806 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
807 # if defined(GLM_FORCE_SIZE_T_LENGTH)
808 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
809 # else
810 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
811 # pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a size_t")
812 # endif
813 #endif//GLM_MESSAGE
814 
816 // Uninitialize constructors
817 
818 namespace glm
819 {
820  enum ctor{uninitialize};
821 }//namespace glm
Definition: _noise.hpp:31
GLM_FUNC_DECL genType pi()
Return the pi constant.