0.9.8: setup.hpp Source File

| 0.9.8

- Main Page
- Modules
- Files

- File List

setup.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 #if (defined(GLM_FORCE_SWIZZLE) || defined(GLM_SWIZZLE)) && defined(GLM_FORCE_UNRESTRICTED_GENTYPE)
7 # error "Both GLM_FORCE_SWIZZLE and GLM_FORCE_UNRESTRICTED_GENTYPE can't be defined at the same time"
8 #endif
9
11 // Messages
12
13 #ifdef GLM_MESSAGES
14 # pragma message("GLM: GLM_MESSAGES is deprecated, use GLM_FORCE_MESSAGES instead")
15 #endif
16
17 #define GLM_MESSAGES_ENABLED 1
18 #define GLM_MESSAGES_DISABLE 0
19
20 #if defined(GLM_FORCE_MESSAGES) || defined(GLM_MESSAGES)
21 # undef GLM_MESSAGES
22 # define GLM_MESSAGES GLM_MESSAGES_ENABLED
23 #else
24 # undef GLM_MESSAGES
25 # define GLM_MESSAGES GLM_MESSAGES_DISABLE
26 #endif
27
28 #include <cassert>
29 #include <cstddef>
30 #include "../simd/platform.h"
31
33 // Version
34
35 #define GLM_VERSION 98
36 #define GLM_VERSION_MAJOR 0
37 #define GLM_VERSION_MINOR 9
38 #define GLM_VERSION_PATCH 8
39 #define GLM_VERSION_REVISION 0
40
41 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_VERSION_DISPLAYED)
42 # define GLM_MESSAGE_VERSION_DISPLAYED
43 # pragma message ("GLM: version 0.9.8.0")
44 #endif//GLM_MESSAGES
45
46 // Report compiler detection
47 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
48 # define GLM_MESSAGE_COMPILER_DISPLAYED
49 # if GLM_COMPILER & GLM_COMPILER_CUDA
50 # pragma message("GLM: CUDA compiler detected")
51 # elif GLM_COMPILER & GLM_COMPILER_VC
52 # pragma message("GLM: Visual C++ compiler detected")
53 # elif GLM_COMPILER & GLM_COMPILER_CLANG
54 # pragma message("GLM: Clang compiler detected")
55 # elif GLM_COMPILER & GLM_COMPILER_INTEL
56 # pragma message("GLM: Intel Compiler detected")
57 # elif GLM_COMPILER & GLM_COMPILER_GCC
58 # pragma message("GLM: GCC compiler detected")
59 # else
60 # pragma message("GLM: Compiler not detected")
61 # endif
62 #endif//GLM_MESSAGES
63
65 // Build model
66
67 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
68 # define GLM_MODEL GLM_MODEL_64
69 #elif defined(__i386__) || defined(__ppc__)
70 # define GLM_MODEL GLM_MODEL_32
71 #else
72 # define GLM_MODEL GLM_MODEL_32
73 #endif//
74
75 #if !defined(GLM_MODEL) && GLM_COMPILER != 0
76 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
77 #endif//GLM_MODEL
78
79 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
80 # define GLM_MESSAGE_MODEL_DISPLAYED
81 # if(GLM_MODEL == GLM_MODEL_64)
82 # pragma message("GLM: 64 bits model")
83 # elif(GLM_MODEL == GLM_MODEL_32)
84 # pragma message("GLM: 32 bits model")
85 # endif//GLM_MODEL
86 #endif//GLM_MESSAGES
87
88 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
89 # define GLM_MESSAGE_ARCH_DISPLAYED
90 # if(GLM_ARCH == GLM_ARCH_PURE)
91 # pragma message("GLM: Platform independent code")
92 # elif(GLM_ARCH == GLM_ARCH_AVX2)
93 # pragma message("GLM: AVX2 instruction set")
94 # elif(GLM_ARCH == GLM_ARCH_AVX)
95 # pragma message("GLM: AVX instruction set")
96 # elif(GLM_ARCH == GLM_ARCH_SSE42)
97 # pragma message("GLM: SSE4.2 instruction set")
98 # elif(GLM_ARCH == GLM_ARCH_SSE41)
99 # pragma message("GLM: SSE4.1 instruction set")
100 # elif(GLM_ARCH == GLM_ARCH_SSSE3)
101 # pragma message("GLM: SSSE3 instruction set")
102 # elif(GLM_ARCH == GLM_ARCH_SSE3)
103 # pragma message("GLM: SSE3 instruction set")
104 # elif(GLM_ARCH == GLM_ARCH_SSE2)
105 # pragma message("GLM: SSE2 instruction set")
106 # elif(GLM_ARCH == GLM_ARCH_X86)
107 # pragma message("GLM: x86 instruction set")
108 # elif(GLM_ARCH == GLM_ARCH_NEON)
109 # pragma message("GLM: NEON instruction set")
110 # elif(GLM_ARCH == GLM_ARCH_ARM)
111 # pragma message("GLM: ARM instruction set")
112 # elif(GLM_ARCH == GLM_ARCH_MIPS)
113 # pragma message("GLM: MIPS instruction set")
114 # elif(GLM_ARCH == GLM_ARCH_PPC)
115 # pragma message("GLM: PowerPC architechture")
116 # endif//GLM_ARCH
117 #endif//GLM_MESSAGES
118
120 // C++ Version
121
122 // User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14
123
124 #define GLM_LANG_CXX98_FLAG (1 << 1)
125 #define GLM_LANG_CXX03_FLAG (1 << 2)
126 #define GLM_LANG_CXX0X_FLAG (1 << 3)
127 #define GLM_LANG_CXX11_FLAG (1 << 4)
128 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
129 #define GLM_LANG_CXX14_FLAG (1 << 6)
130 #define GLM_LANG_CXX1Z_FLAG (1 << 7)
131 #define GLM_LANG_CXXMS_FLAG (1 << 8)
132 #define GLM_LANG_CXXGNU_FLAG (1 << 9)
133
134 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
135 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
136 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
137 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
138 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
139 #define GLM_LANG_CXX14 (GLM_LANG_CXX1Y | GLM_LANG_CXX14_FLAG)
140 #define GLM_LANG_CXX1Z (GLM_LANG_CXX14 | GLM_LANG_CXX1Z_FLAG)
141 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
142 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
143
144 #if defined(GLM_FORCE_CXX14)
145 # undef GLM_FORCE_CXX11
146 # undef GLM_FORCE_CXX03
147 # undef GLM_FORCE_CXX98
148 # define GLM_LANG GLM_LANG_CXX14
149 #elif defined(GLM_FORCE_CXX11)
150 # undef GLM_FORCE_CXX03
151 # undef GLM_FORCE_CXX98
152 # define GLM_LANG GLM_LANG_CXX11
153 #elif defined(GLM_FORCE_CXX03)
154 # undef GLM_FORCE_CXX98
155 # define GLM_LANG GLM_LANG_CXX03
156 #elif defined(GLM_FORCE_CXX98)
157 # define GLM_LANG GLM_LANG_CXX98
158 #else
159 # if GLM_COMPILER & GLM_COMPILER_CLANG
160 # if __cplusplus >= 201402L // GLM_COMPILER_CLANG34 + -std=c++14
161 # define GLM_LANG GLM_LANG_CXX14
162 # elif __has_feature(cxx_decltype_auto) && __has_feature(cxx_aggregate_nsdmi) // GLM_COMPILER_CLANG33 + -std=c++1y
163 # define GLM_LANG GLM_LANG_CXX1Y
164 # elif __cplusplus >= 201103L // GLM_COMPILER_CLANG33 + -std=c++11
165 # define GLM_LANG GLM_LANG_CXX11
166 # elif __has_feature(cxx_static_assert) // GLM_COMPILER_CLANG29 + -std=c++11
167 # define GLM_LANG GLM_LANG_CXX0X
168 # elif __cplusplus >= 199711L
169 # define GLM_LANG GLM_LANG_CXX98
170 # else
171 # define GLM_LANG GLM_LANG_CXX
172 # endif
173 # elif GLM_COMPILER & GLM_COMPILER_GCC
174 # if __cplusplus >= 201402L
175 # define GLM_LANG GLM_LANG_CXX14
176 # elif __cplusplus >= 201103L
177 # define GLM_LANG GLM_LANG_CXX11
178 # elif defined(__GXX_EXPERIMENTAL_CXX0X__)
179 # define GLM_LANG GLM_LANG_CXX0X
180 # else
181 # define GLM_LANG GLM_LANG_CXX98
182 # endif
183 # elif GLM_COMPILER & GLM_COMPILER_VC
184 # ifdef _MSC_EXTENSIONS
185 # if __cplusplus >= 201402L
186 # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
187 //# elif GLM_COMPILER >= GLM_COMPILER_VC2015
188 //# define GLM_LANG (GLM_LANG_CXX1Y | GLM_LANG_CXXMS_FLAG)
189 # elif __cplusplus >= 201103L
190 # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
191 # elif GLM_COMPILER >= GLM_COMPILER_VC2010
192 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
193 # elif __cplusplus >= 199711L
194 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
195 # else
196 # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG)
197 # endif
198 # else
199 # if __cplusplus >= 201402L
200 # define GLM_LANG GLM_LANG_CXX14
201 # elif __cplusplus >= 201103L
202 # define GLM_LANG GLM_LANG_CXX11
203 # elif GLM_COMPILER >= GLM_COMPILER_VC2010
204 # define GLM_LANG GLM_LANG_CXX0X
205 # elif __cplusplus >= 199711L
206 # define GLM_LANG GLM_LANG_CXX98
207 # else
208 # define GLM_LANG GLM_LANG_CXX
209 # endif
210 # endif
211 # elif GLM_COMPILER & GLM_COMPILER_INTEL
212 # ifdef _MSC_EXTENSIONS
213 # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
214 # else
215 # define GLM_MSC_EXT 0
216 # endif
217 # if __cplusplus >= 201402L
218 # define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT)
219 # elif __cplusplus >= 201103L
220 # define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT)
221 # elif __INTEL_CXX11_MODE__
222 # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
223 # elif __cplusplus >= 199711L
224 # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
225 # else
226 # define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT)
227 # endif
228 # elif GLM_COMPILER & GLM_COMPILER_CUDA
229 # ifdef _MSC_EXTENSIONS
230 # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
231 # else
232 # define GLM_MSC_EXT 0
233 # endif
234 # if GLM_COMPILER >= GLM_COMPILER_CUDA75
235 # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
236 # else
237 # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
238 # endif
239 # else // Unknown compiler
240 # if __cplusplus >= 201402L
241 # define GLM_LANG GLM_LANG_CXX14
242 # elif __cplusplus >= 201103L
243 # define GLM_LANG GLM_LANG_CXX11
244 # elif __cplusplus >= 199711L
245 # define GLM_LANG GLM_LANG_CXX98
246 # else
247 # define GLM_LANG GLM_LANG_CXX // Good luck with that!
248 # endif
249 # ifndef GLM_FORCE_PURE
250 # define GLM_FORCE_PURE
251 # endif
252 # endif
253 #endif
254
255 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_LANG_DISPLAYED)
256 # define GLM_MESSAGE_LANG_DISPLAYED
257
258 # if GLM_LANG & GLM_LANG_CXX1Z_FLAG
259 # pragma message("GLM: C++1z")
260 # elif GLM_LANG & GLM_LANG_CXX14_FLAG
261 # pragma message("GLM: C++14")
262 # elif GLM_LANG & GLM_LANG_CXX1Y_FLAG
263 # pragma message("GLM: C++1y")
264 # elif GLM_LANG & GLM_LANG_CXX11_FLAG
265 # pragma message("GLM: C++11")
266 # elif GLM_LANG & GLM_LANG_CXX0X_FLAG
267 # pragma message("GLM: C++0x")
268 # elif GLM_LANG & GLM_LANG_CXX03_FLAG
269 # pragma message("GLM: C++03")
270 # elif GLM_LANG & GLM_LANG_CXX98_FLAG
271 # pragma message("GLM: C++98")
272 # else
273 # pragma message("GLM: C++ language undetected")
274 # endif//GLM_LANG
275
276 # if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
277 # pragma message("GLM: Language extensions enabled")
278 # endif//GLM_LANG
279 #endif//GLM_MESSAGES
280
282 // Has of C++ features
283
284 // http://clang.llvm.org/cxx_status.html
285 // http://gcc.gnu.org/projects/cxx0x.html
286 // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
287
288 #if GLM_COMPILER & GLM_COMPILER_CLANG
289 # if defined(_LIBCPP_VERSION) && GLM_LANG & GLM_LANG_CXX11_FLAG
290 # define GLM_HAS_CXX11_STL 1
291 # else
292 # define GLM_HAS_CXX11_STL 0
293 # endif
294 #else
295 # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
296 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
297 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
298 ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))))
299 #endif
300
301 // N1720
302 #if GLM_COMPILER & GLM_COMPILER_CLANG
303 # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)
304 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
305 # define GLM_HAS_STATIC_ASSERT 1
306 #else
307 # define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
308 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
309 ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
310 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))))
311 #endif
312
313 // N1988
314 #if GLM_LANG & GLM_LANG_CXX11_FLAG
315 # define GLM_HAS_EXTENDED_INTEGER_TYPE 1
316 #else
317 # define GLM_HAS_EXTENDED_INTEGER_TYPE (\
318 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
319 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \
320 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
321 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG30)))
322 #endif
323
324 // N2235
325 #if GLM_COMPILER & GLM_COMPILER_CLANG
326 # define GLM_HAS_CONSTEXPR __has_feature(cxx_constexpr)
327 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
328 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
329 # define GLM_HAS_CONSTEXPR 1
330 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
331 #else
332 # define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
333 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)))) // GCC 4.6 support constexpr but there is a compiler bug causing a crash
334 # define GLM_HAS_CONSTEXPR_PARTIAL (GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)))
335 #endif
336
337 // N2672
338 #if GLM_COMPILER & GLM_COMPILER_CLANG
339 # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
340 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
341 # define GLM_HAS_INITIALIZER_LISTS 1
342 #else
343 # define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
344 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
345 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
346 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75))))
347 #endif
348
349 // N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
350 #if GLM_COMPILER & GLM_COMPILER_CLANG
351 # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
352 #elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG)
353 # define GLM_HAS_UNRESTRICTED_UNIONS 1
354 #else
355 # define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
356 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)) || \
357 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)) || \
358 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
359 #endif
360
361 // N2346
362 #if defined(GLM_FORCE_UNRESTRICTED_GENTYPE)
363 # define GLM_HAS_DEFAULTED_FUNCTIONS 0
364 #elif GLM_COMPILER & GLM_COMPILER_CLANG
365 # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)
366 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
367 # define GLM_HAS_DEFAULTED_FUNCTIONS 1
368 #else
369 # define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
370 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
371 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
372 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)) || \
373 (GLM_COMPILER & GLM_COMPILER_CUDA)))
374 #endif
375
376 // N2118
377 #if GLM_COMPILER & GLM_COMPILER_CLANG
378 # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
379 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
380 # define GLM_HAS_RVALUE_REFERENCES 1
381 #else
382 # define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
383 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
384 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
385 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
386 #endif
387
388 // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
389 #if GLM_COMPILER & GLM_COMPILER_CLANG
390 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
391 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
392 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
393 #else
394 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
395 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
396 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
397 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
398 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
399 #endif
400
401 // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
402 #if GLM_COMPILER & GLM_COMPILER_CLANG
403 # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
404 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
405 # define GLM_HAS_TEMPLATE_ALIASES 1
406 #else
407 # define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
408 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \
409 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \
410 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
411 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
412 #endif
413
414 // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
415 #if GLM_COMPILER & GLM_COMPILER_CLANG
416 # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
417 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
418 # define GLM_HAS_RANGE_FOR 1
419 #else
420 # define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
421 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
422 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \
423 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
424 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
425 #endif
426
427 //
428 #if GLM_LANG & GLM_LANG_CXX11_FLAG
429 # define GLM_HAS_ASSIGNABLE 1
430 #else
431 # define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
432 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))
433 #endif
434
435 //
436 #define GLM_HAS_TRIVIAL_QUERIES 0
437
438 //
439 #if GLM_LANG & GLM_LANG_CXX11_FLAG
440 # define GLM_HAS_MAKE_SIGNED 1
441 #else
442 # define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
443 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
444 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
445 #endif
446
447 #if GLM_ARCH == GLM_ARCH_PURE
448 # define GLM_HAS_BITSCAN_WINDOWS 0
449 #else
450 # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
451 (GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))))
452 #endif
453
454 // OpenMP
455 #ifdef _OPENMP
456 # if GLM_COMPILER & GLM_COMPILER_GCC
457 # if GLM_COMPILER >= GLM_COMPILER_GCC61
458 # define GLM_HAS_OPENMP 45
459 # elif GLM_COMPILER >= GLM_COMPILER_GCC49
460 # define GLM_HAS_OPENMP 40
461 # elif GLM_COMPILER >= GLM_COMPILER_GCC47
462 # define GLM_HAS_OPENMP 31
463 # elif GLM_COMPILER >= GLM_COMPILER_GCC44
464 # define GLM_HAS_OPENMP 30
465 # elif GLM_COMPILER >= GLM_COMPILER_GCC42
466 # define GLM_HAS_OPENMP 25
467 # else
468 # define GLM_HAS_OPENMP 0
469 # endif
470 # elif GLM_COMPILER & GLM_COMPILER_CLANG
471 # if GLM_COMPILER >= GLM_COMPILER_CLANG38
472 # define GLM_HAS_OPENMP 31
473 # else
474 # define GLM_HAS_OPENMP 0
475 # endif
476 # elif GLM_COMPILER & GLM_COMPILER_VC
477 # if GLM_COMPILER >= GLM_COMPILER_VC2010
478 # define GLM_HAS_OPENMP 20
479 # else
480 # define GLM_HAS_OPENMP 0
481 # endif
482 # elif GLM_COMPILER & GLM_COMPILER_INTEL
483 # if GLM_COMPILER >= GLM_COMPILER_INTEL16
484 # define GLM_HAS_OPENMP 40
485 # elif GLM_COMPILER >= GLM_COMPILER_INTEL12
486 # define GLM_HAS_OPENMP 31
487 # else
488 # define GLM_HAS_OPENMP 0
489 # endif
490 # else
491 # define GLM_HAS_OPENMP 0
492 # endif// GLM_COMPILER & GLM_COMPILER_VC
493 #endif
494
496 // Static assert
497
498 #if GLM_HAS_STATIC_ASSERT
499 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
500 #elif defined(BOOST_STATIC_ASSERT)
501 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
502 #elif GLM_COMPILER & GLM_COMPILER_VC
503 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
504 #else
505 # define GLM_STATIC_ASSERT(x, message)
506 # define GLM_STATIC_ASSERT_NULL
507 #endif//GLM_LANG
508
510 // Qualifiers
511
512 #if GLM_COMPILER & GLM_COMPILER_CUDA
513 # define GLM_CUDA_FUNC_DEF __device__ __host__
514 # define GLM_CUDA_FUNC_DECL __device__ __host__
515 #else
516 # define GLM_CUDA_FUNC_DEF
517 # define GLM_CUDA_FUNC_DECL
518 #endif
519
520 #if GLM_COMPILER & GLM_COMPILER_GCC
521 # define GLM_VAR_USED __attribute__ ((unused))
522 #else
523 # define GLM_VAR_USED
524 #endif
525
526 #if defined(GLM_FORCE_INLINE)
527 # if GLM_COMPILER & GLM_COMPILER_VC
528 # define GLM_INLINE __forceinline
529 # define GLM_NEVER_INLINE __declspec((noinline))
530 # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)
531 # define GLM_INLINE inline __attribute__((__always_inline__))
532 # define GLM_NEVER_INLINE __attribute__((__noinline__))
533 # elif GLM_COMPILER & GLM_COMPILER_CUDA
534 # define GLM_INLINE __forceinline__
535 # define GLM_NEVER_INLINE __noinline__
536 # else
537 # define GLM_INLINE inline
538 # define GLM_NEVER_INLINE
539 # endif//GLM_COMPILER
540 #else
541 # define GLM_INLINE inline
542 # define GLM_NEVER_INLINE
543 #endif//defined(GLM_FORCE_INLINE)
544
545 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
546 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
547
549 // Swizzle operators
550
551 // User defines: GLM_FORCE_SWIZZLE
552
553 #ifdef GLM_SWIZZLE
554 # pragma message("GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead")
555 #endif
556
557 #define GLM_SWIZZLE_ENABLED 1
558 #define GLM_SWIZZLE_DISABLE 0
559
560 #if defined(GLM_FORCE_SWIZZLE) || defined(GLM_SWIZZLE)
561 # undef GLM_SWIZZLE
562 # define GLM_SWIZZLE GLM_SWIZZLE_ENABLED
563 #else
564 # undef GLM_SWIZZLE
565 # define GLM_SWIZZLE GLM_SWIZZLE_DISABLE
566 #endif
567
568 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
569 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
570 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
571 # pragma message("GLM: Swizzling operators enabled")
572 # else
573 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
574 # endif
575 #endif//GLM_MESSAGES
576
578 // Allows using not basic types as genType
579
580 // #define GLM_FORCE_UNRESTRICTED_GENTYPE
581
582 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED)
583 # define GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED
584 # ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
585 # pragma message("GLM: Use unrestricted genType")
586 # endif
587 #endif//GLM_MESSAGES
588
590 // Clip control
591
592 #ifdef GLM_DEPTH_ZERO_TO_ONE // Legacy 0.9.8 development
593 # error Define GLM_FORCE_DEPTH_ZERO_TO_ONE instead of GLM_DEPTH_ZERO_TO_ONE to use 0 to 1 clip space.
594 #endif
595
596 #define GLM_DEPTH_ZERO_TO_ONE 0x00000001
597 #define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002
598
599 #ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE
600 # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_ZERO_TO_ONE
601 #else
602 # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE
603 #endif
604
605 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_DEPTH_DISPLAYED)
606 # define GLM_MESSAGE_DEPTH_DISPLAYED
607 # if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
608 # pragma message("GLM: Depth clip space: Zero to one")
609 # else
610 # pragma message("GLM: Depth clip space: negative one to one")
611 # endif
612 #endif//GLM_MESSAGES
613
615 // Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM
616 // to use left handed coordinate system by default.
617
618 #ifdef GLM_LEFT_HANDED // Legacy 0.9.8 development
619 # error Define GLM_FORCE_LEFT_HANDED instead of GLM_LEFT_HANDED left handed coordinate system by default.
620 #endif
621
622 #define GLM_LEFT_HANDED 0x00000001 // For DirectX, Metal, Vulkan
623 #define GLM_RIGHT_HANDED 0x00000002 // For OpenGL, default in GLM
624
625 #ifdef GLM_FORCE_LEFT_HANDED
626 # define GLM_COORDINATE_SYSTEM GLM_LEFT_HANDED
627 #else
628 # define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED
629 #endif
630
631 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_HANDED_DISPLAYED)
632 # define GLM_MESSAGE_HANDED_DISPLAYED
633 # if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
634 # pragma message("GLM: Coordinate system: left handed")
635 # else
636 # pragma message("GLM: Coordinate system: right handed")
637 # endif
638 #endif//GLM_MESSAGES
639
641 // Qualifiers
642
643 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
644 # define GLM_DEPRECATED __declspec(deprecated)
645 # define GLM_ALIGN(x) __declspec(align(x))
646 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x))
647 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
648 # define GLM_RESTRICT_FUNC __declspec(restrict)
649 # define GLM_RESTRICT __restrict
650 # if GLM_COMPILER >= GLM_COMPILER_VC2013
651 # define GLM_VECTOR_CALL __vectorcall
652 # else
653 # define GLM_VECTOR_CALL
654 # endif
655 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL)
656 # define GLM_DEPRECATED __attribute__((__deprecated__))
657 # define GLM_ALIGN(x) __attribute__((aligned(x)))
658 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
659 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
660 # define GLM_RESTRICT_FUNC __restrict__
661 # define GLM_RESTRICT __restrict__
662 # if GLM_COMPILER & GLM_COMPILER_CLANG
663 # if GLM_COMPILER >= GLM_COMPILER_CLANG37
664 # define GLM_VECTOR_CALL __vectorcall
665 # else
666 # define GLM_VECTOR_CALL
667 # endif
668 # else
669 # define GLM_VECTOR_CALL
670 # endif
671 #elif GLM_COMPILER & GLM_COMPILER_CUDA
672 # define GLM_DEPRECATED
673 # define GLM_ALIGN(x) __align__(x)
674 # define GLM_ALIGNED_STRUCT(x) struct __align__(x)
675 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x)
676 # define GLM_RESTRICT_FUNC __restrict__
677 # define GLM_RESTRICT __restrict__
678 # define GLM_VECTOR_CALL
679 #else
680 # define GLM_DEPRECATED
681 # define GLM_ALIGN
682 # define GLM_ALIGNED_STRUCT(x) struct
683 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
684 # define GLM_RESTRICT_FUNC
685 # define GLM_RESTRICT
686 # define GLM_VECTOR_CALL
687 #endif//GLM_COMPILER
688
689 #if GLM_HAS_DEFAULTED_FUNCTIONS
690 # define GLM_DEFAULT = default
691 # ifdef GLM_FORCE_NO_CTOR_INIT
692 # define GLM_DEFAULT_CTOR = default
693 # else
694 # define GLM_DEFAULT_CTOR
695 # endif
696 #else
697 # define GLM_DEFAULT
698 # define GLM_DEFAULT_CTOR
699 #endif
700
701 #if GLM_HAS_CONSTEXPR
702 # define GLM_CONSTEXPR constexpr
703 # define GLM_CONSTEXPR_CTOR constexpr
704 # define GLM_RELAXED_CONSTEXPR constexpr
705 #elif GLM_HAS_CONSTEXPR_PARTIAL
706 # define GLM_CONSTEXPR constexpr
707 # define GLM_CONSTEXPR_CTOR
708 # define GLM_RELAXED_CONSTEXPR const
709 #else
710 # define GLM_CONSTEXPR
711 # define GLM_CONSTEXPR_CTOR
712 # define GLM_RELAXED_CONSTEXPR const
713 #endif
714
715 #if GLM_ARCH == GLM_ARCH_PURE
716 # define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR
717 #else
718 # define GLM_CONSTEXPR_SIMD
719 #endif
720
721 #ifdef GLM_FORCE_EXPLICIT_CTOR
722 # define GLM_EXPLICIT explicit
723 #else
724 # define GLM_EXPLICIT
725 #endif
726
728
729 #define GLM_HAS_ALIGNED_TYPE GLM_HAS_UNRESTRICTED_UNIONS
730
732 // Length type
733
734 // User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC
735
736 namespace glm
737 {
738 using std::size_t;
739 # if defined(GLM_FORCE_SIZE_T_LENGTH)
740 typedef size_t length_t;
741 # else
742 typedef int length_t;
743 # endif
744 }//namespace glm
745
746 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
747 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
748 # if defined GLM_FORCE_SIZE_T_LENGTH
749 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
750 # else
751 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
752 # endif
753 #endif//GLM_MESSAGES
754
756 // countof
757
758 #ifndef __has_feature
759 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
760 #endif
761
762 #if GLM_HAS_CONSTEXPR_PARTIAL
763 namespace glm
764 {
765 template <typename T, std::size_t N>
766 constexpr std::size_t countof(T const (&)[N])
767 {
768 return N;
769 }
770 }//namespace glm
771 # define GLM_COUNTOF(arr) glm::countof(arr)
772 #elif defined(_MSC_VER)
773 # define GLM_COUNTOF(arr) _countof(arr)
774 #else
775 # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])
776 #endif
777
779 // Uninitialize constructors
780
781 namespace glm
782 {
783 enum ctor{uninitialize};
784 }//namespace glm
glm
Definition: _noise.hpp:11