setup.hpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. /// THE SOFTWARE.
  22. ///
  23. /// @ref core
  24. /// @file glm/core/setup.hpp
  25. /// @date 2006-11-13 / 2011-06-15
  26. /// @author Christophe Riccio
  27. ///////////////////////////////////////////////////////////////////////////////////
  28. #ifndef glm_setup
  29. #define glm_setup
  30. ///////////////////////////////////////////////////////////////////////////////////////////////////
  31. // Version
  32. #define GLM_VERSION 93
  33. #define GLM_VERSION_MAJOR 0
  34. #define GLM_VERSION_MINOR 9
  35. #define GLM_VERSION_PATCH 3
  36. #define GLM_VERSION_REVISION 0
  37. ///////////////////////////////////////////////////////////////////////////////////////////////////
  38. // Compiler
  39. // User defines: GLM_FORCE_COMPILER_UNKNOWN
  40. // TODO ? __llvm__
  41. #define GLM_COMPILER_UNKNOWN 0x00000000
  42. // Visual C++ defines
  43. #define GLM_COMPILER_VC 0x01000000
  44. #define GLM_COMPILER_VC2 0x01000010
  45. #define GLM_COMPILER_VC4 0x01000020
  46. #define GLM_COMPILER_VC5 0x01000030
  47. #define GLM_COMPILER_VC6 0x01000040
  48. #define GLM_COMPILER_VC2002 0x01000050
  49. #define GLM_COMPILER_VC2003 0x01000060
  50. #define GLM_COMPILER_VC2005 0x01000070
  51. #define GLM_COMPILER_VC2008 0x01000080
  52. #define GLM_COMPILER_VC2010 0x01000090
  53. #define GLM_COMPILER_VC2011 0x010000A0
  54. // GCC defines
  55. #define GLM_COMPILER_GCC 0x02000000
  56. #define GLM_COMPILER_GCC_LLVM 0x02000001
  57. #define GLM_COMPILER_GCC_CLANG 0x02000002
  58. #define GLM_COMPILER_GCC30 0x02000010
  59. #define GLM_COMPILER_GCC31 0x02000020
  60. #define GLM_COMPILER_GCC32 0x02000030
  61. #define GLM_COMPILER_GCC33 0x02000040
  62. #define GLM_COMPILER_GCC34 0x02000050
  63. #define GLM_COMPILER_GCC35 0x02000060
  64. #define GLM_COMPILER_GCC40 0x02000070
  65. #define GLM_COMPILER_GCC41 0x02000080
  66. #define GLM_COMPILER_GCC42 0x02000090
  67. #define GLM_COMPILER_GCC43 0x020000A0
  68. #define GLM_COMPILER_GCC44 0x020000B0
  69. #define GLM_COMPILER_GCC45 0x020000C0
  70. #define GLM_COMPILER_GCC46 0x020000D0
  71. #define GLM_COMPILER_GCC47 0x020000E0
  72. #define GLM_COMPILER_GCC48 0x020000F0
  73. #define GLM_COMPILER_GCC49 0x02000100
  74. #define GLM_COMPILER_GCC50 0x02000200
  75. // G++ command line to display defined
  76. // echo "" | g++ -E -dM -x c++ - | sort
  77. // Borland C++ defines. How to identify BC?
  78. #define GLM_COMPILER_BC 0x04000000
  79. #define GLM_COMPILER_BCB4 0x04000100
  80. #define GLM_COMPILER_BCB5 0x04000200
  81. #define GLM_COMPILER_BCB6 0x04000300
  82. //#define GLM_COMPILER_BCBX 0x04000400 // What's the version value?
  83. #define GLM_COMPILER_BCB2009 0x04000500
  84. // CodeWarrior
  85. #define GLM_COMPILER_CODEWARRIOR 0x08000000
  86. // CUDA
  87. #define GLM_COMPILER_CUDA 0x10000000
  88. #define GLM_COMPILER_CUDA30 0x10000010
  89. #define GLM_COMPILER_CUDA31 0x10000020
  90. #define GLM_COMPILER_CUDA32 0x10000030
  91. #define GLM_COMPILER_CUDA40 0x10000040
  92. // Clang
  93. #define GLM_COMPILER_CLANG 0x20000000
  94. #define GLM_COMPILER_CLANG26 0x20000010
  95. #define GLM_COMPILER_CLANG27 0x20000020
  96. #define GLM_COMPILER_CLANG28 0x20000030
  97. #define GLM_COMPILER_CLANG29 0x20000040
  98. // LLVM GCC
  99. #define GLM_COMPILER_LLVM_GCC 0x40000000
  100. // Build model
  101. #define GLM_MODEL_32 0x00000010
  102. #define GLM_MODEL_64 0x00000020
  103. // Force generic C++ compiler
  104. #ifdef GLM_FORCE_COMPILER_UNKNOWN
  105. # define GLM_COMPILER GLM_COMPILER_UNKNOWN
  106. // CUDA
  107. #elif defined(__CUDACC__)
  108. # define GLM_COMPILER GLM_COMPILER_CUDA
  109. /*
  110. # if CUDA_VERSION < 3000
  111. # error "GLM requires CUDA 3.0 or higher"
  112. # elif CUDA_VERSION == 3000
  113. # define GLM_COMPILER GLM_COMPILER_CUDA30
  114. # elif CUDA_VERSION == 3010
  115. # define GLM_COMPILER GLM_COMPILER_CUDA31
  116. # elif CUDA_VERSION == 3020
  117. # define GLM_COMPILER GLM_COMPILER_CUDA32
  118. # elif CUDA_VERSION == 4000
  119. # define GLM_COMPILER GLM_COMPILER_CUDA40
  120. # else
  121. # define GLM_COMPILER GLM_COMPILER_CUDA
  122. # endif
  123. */
  124. // Visual C++
  125. #elif defined(_MSC_VER)
  126. # if _MSC_VER == 900
  127. # define GLM_COMPILER GLM_COMPILER_VC2
  128. # elif _MSC_VER == 1000
  129. # define GLM_COMPILER GLM_COMPILER_VC4
  130. # elif _MSC_VER == 1100
  131. # define GLM_COMPILER GLM_COMPILER_VC5
  132. # elif _MSC_VER == 1200
  133. # define GLM_COMPILER GLM_COMPILER_VC6
  134. # elif _MSC_VER == 1300
  135. # define GLM_COMPILER GLM_COMPILER_VC2002
  136. # elif _MSC_VER == 1310
  137. # define GLM_COMPILER GLM_COMPILER_VC2003
  138. # elif _MSC_VER == 1400
  139. # define GLM_COMPILER GLM_COMPILER_VC2005
  140. # elif _MSC_VER == 1500
  141. # define GLM_COMPILER GLM_COMPILER_VC2008
  142. # elif _MSC_VER == 1600
  143. # define GLM_COMPILER GLM_COMPILER_VC2010
  144. # elif _MSC_VER == 1700
  145. # define GLM_COMPILER GLM_COMPILER_VC2011
  146. # else//_MSC_VER
  147. # define GLM_COMPILER GLM_COMPILER_VC
  148. # endif//_MSC_VER
  149. // G++
  150. #elif defined(__GNUC__)// || defined(__llvm__) || defined(__clang__)
  151. # if defined (__llvm__)
  152. # define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_LLVM
  153. # elif defined (__clang__)
  154. # define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_CLANG
  155. # else
  156. # define GLM_COMPILER_GCC_EXTRA 0
  157. # endif
  158. #
  159. # if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
  160. # define GLM_COMPILER GLM_COMPILER_GCC32
  161. # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
  162. # define GLM_COMPILER GLM_COMPILER_GCC33
  163. # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
  164. # define GLM_COMPILER GLM_COMPILER_GCC34
  165. # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
  166. # define GLM_COMPILER GLM_COMPILER_GCC35
  167. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
  168. # define GLM_COMPILER (GLM_COMPILER_GCC40 | GLM_COMPILER_GCC_EXTRA)
  169. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
  170. # define GLM_COMPILER (GLM_COMPILER_GCC41 | GLM_COMPILER_GCC_EXTRA)
  171. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
  172. # define GLM_COMPILER (GLM_COMPILER_GCC42 | GLM_COMPILER_GCC_EXTRA)
  173. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
  174. # define GLM_COMPILER (GLM_COMPILER_GCC43 | GLM_COMPILER_GCC_EXTRA)
  175. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
  176. # define GLM_COMPILER (GLM_COMPILER_GCC44 | GLM_COMPILER_GCC_EXTRA)
  177. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
  178. # define GLM_COMPILER (GLM_COMPILER_GCC45 | GLM_COMPILER_GCC_EXTRA)
  179. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
  180. # define GLM_COMPILER (GLM_COMPILER_GCC46 | GLM_COMPILER_GCC_EXTRA)
  181. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
  182. # define GLM_COMPILER (GLM_COMPILER_GCC47 | GLM_COMPILER_GCC_EXTRA)
  183. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
  184. # define GLM_COMPILER (GLM_COMPILER_GCC48 | GLM_COMPILER_GCC_EXTRA)
  185. # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
  186. # define GLM_COMPILER (GLM_COMPILER_GCC49 | GLM_COMPILER_GCC_EXTRA)
  187. # elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
  188. # define GLM_COMPILER (GLM_COMPILER_GCC50 | GLM_COMPILER_GCC_EXTRA)
  189. # else
  190. # define GLM_COMPILER (GLM_COMPILER_GCC | GLM_COMPILER_GCC_EXTRA)
  191. # endif
  192. // Borland C++
  193. #elif defined(_BORLANDC_)
  194. # if defined(VER125)
  195. # define GLM_COMPILER GLM_COMPILER_BCB4
  196. # elif defined(VER130)
  197. # define GLM_COMPILER GLM_COMPILER_BCB5
  198. # elif defined(VER140)
  199. # define GLM_COMPILER GLM_COMPILER_BCB6
  200. # elif defined(VER200)
  201. # define GLM_COMPILER GLM_COMPILER_BCB2009
  202. # else
  203. # define GLM_COMPILER GLM_COMPILER_BC
  204. # endif
  205. // Codewarrior
  206. #elif defined(__MWERKS__)
  207. # define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
  208. #else
  209. # define GLM_COMPILER GLM_COMPILER_UNKNOWN
  210. #endif
  211. #ifndef GLM_COMPILER
  212. #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
  213. #endif//GLM_COMPILER
  214. // Report compiler detection
  215. #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
  216. # define GLM_MESSAGE_COMPILER_DISPLAYED
  217. # if(GLM_COMPILER & GLM_COMPILER_CUDA)
  218. # pragma message("GLM: CUDA compiler detected")
  219. # elif(GLM_COMPILER & GLM_COMPILER_VC)
  220. # pragma message("GLM: Visual C++ compiler detected")
  221. # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
  222. # pragma message("GLM: Clang compiler detected")
  223. # elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
  224. # pragma message("GLM: LLVM GCC compiler detected")
  225. # elif(GLM_COMPILER & GLM_COMPILER_GCC)
  226. # if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
  227. # pragma message("GLM: LLVM GCC compiler detected")
  228. # elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
  229. # pragma message("GLM: CLANG compiler detected")
  230. # else
  231. # pragma message("GLM: GCC compiler detected")
  232. # endif
  233. # elif(GLM_COMPILER & GLM_COMPILER_BC)
  234. # pragma message("GLM: Borland compiler detected but not supported")
  235. # elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
  236. # pragma message("GLM: Codewarrior compiler detected but not supported")
  237. # else
  238. # pragma message("GLM: Compiler not detected")
  239. # endif
  240. #endif//GLM_MESSAGE
  241. /////////////////
  242. // Build model //
  243. #if(GLM_COMPILER & GLM_COMPILER_VC)
  244. # if defined(_M_X64)
  245. # define GLM_MODEL GLM_MODEL_64
  246. # else
  247. # define GLM_MODEL GLM_MODEL_32
  248. # endif//_M_X64
  249. #elif(GLM_COMPILER & GLM_COMPILER_GCC)
  250. # if(defined(__WORDSIZE) && (__WORDSIZE == 64)) || defined(__arch64__) || defined(__LP64__) || defined(__x86_64__)
  251. # define GLM_MODEL GLM_MODEL_64
  252. # else
  253. # define GLM_MODEL GLM_MODEL_32
  254. # endif//
  255. #else
  256. # define GLM_MODEL GLM_MODEL_32
  257. #endif//
  258. /*
  259. #if(sizeof(void*) == 8)
  260. # define GLM_MODEL GLM_MODEL_64
  261. #else
  262. # define GLM_MODEL GLM_MODEL_32
  263. #endif//_M_X64
  264. */
  265. #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
  266. #error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
  267. #endif//GLM_MODEL
  268. #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
  269. # define GLM_MESSAGE_MODEL_DISPLAYED
  270. # if(GLM_MODEL == GLM_MODEL_64)
  271. # pragma message("GLM: 64 bits model")
  272. # elif(GLM_MODEL == GLM_MODEL_32)
  273. # pragma message("GLM: 32 bits model")
  274. # endif//GLM_MODEL
  275. #endif//GLM_MESSAGE
  276. /////////////////
  277. // C++ Version //
  278. // User defines: GLM_FORCE_CXX98
  279. #define GLM_LANG_CXX 0
  280. #define GLM_LANG_CXX98 1
  281. #define GLM_LANG_CXX03 2
  282. #define GLM_LANG_CXX0X 3
  283. #define GLM_LANG_CXX11 4
  284. #define GLM_LANG_CXXMS 5
  285. #define GLM_LANG_CXXGNU 6
  286. #if(defined(GLM_FORCE_CXX11))
  287. # define GLM_LANG GLM_LANG_CXX11
  288. #elif(defined(GLM_FORCE_CXX03))
  289. # define GLM_LANG GLM_LANG_CXX03
  290. #elif(defined(GLM_FORCE_CXX98))
  291. # define GLM_LANG GLM_LANG_CXX98
  292. #elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) // -std=c++0x or -std=gnu++0x
  293. # define GLM_LANG GLM_LANG_CXX0X
  294. #elif(GLM_COMPILER == GLM_COMPILER_VC2010) //_MSC_EXTENSIONS for MS language extensions
  295. # define GLM_LANG GLM_LANG_CXX0X
  296. #elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__))
  297. # define GLM_LANG GLM_LANG_CXX98
  298. #elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && !defined(_MSC_EXTENSIONS))
  299. # define GLM_LANG GLM_LANG_CXX98
  300. #else
  301. # define GLM_LANG GLM_LANG_CXX
  302. #endif
  303. #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
  304. # define GLM_MESSAGE_LANG_DISPLAYED
  305. # if(GLM_LANG == GLM_LANG_CXX98)
  306. # pragma message("GLM: C++98")
  307. # elif(GLM_LANG == GLM_LANG_CXX03)
  308. # pragma message("GLM: C++03")
  309. # elif(GLM_LANG == GLM_LANG_CXX0X)
  310. # pragma message("GLM: C++0x")
  311. # elif(GLM_LANG == GLM_LANG_CXX11)
  312. # pragma message("GLM: C++11")
  313. # endif//GLM_MODEL
  314. #endif//GLM_MESSAGE
  315. /////////////////
  316. // Platform
  317. // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_AVX
  318. #define GLM_ARCH_PURE 0x0000 //(0x0000)
  319. #define GLM_ARCH_SSE2 0x0001 //(0x0001)
  320. #define GLM_ARCH_SSE3 0x0003 //(0x0002 | GLM_ARCH_SSE2)
  321. #define GLM_ARCH_AVX 0x0007 //(0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
  322. #if(defined(GLM_FORCE_PURE))
  323. # define GLM_ARCH GLM_ARCH_PURE
  324. #elif(defined(GLM_FORCE_AVX))
  325. # define GLM_ARCH GLM_ARCH_AVX
  326. #elif(defined(GLM_FORCE_SSE3))
  327. # define GLM_ARCH GLM_ARCH_SSE3
  328. #elif(defined(GLM_FORCE_SSE2))
  329. # define GLM_ARCH GLM_ARCH_SSE2
  330. #elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
  331. # if(defined(_M_CEE_PURE))
  332. # define GLM_ARCH GLM_ARCH_PURE
  333. # elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
  334. # if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
  335. # define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1)
  336. # else
  337. # define GLM_ARCH GLM_ARCH_SSE3
  338. # endif
  339. # elif(GLM_COMPILER >= GLM_COMPILER_VC2008)
  340. # define GLM_ARCH GLM_ARCH_SSE3
  341. # elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
  342. # define GLM_ARCH GLM_ARCH_SSE2
  343. # else
  344. # define GLM_ARCH GLM_ARCH_PURE
  345. # endif
  346. #elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
  347. # if(defined(__AVX__))
  348. # define GLM_ARCH GLM_ARCH_AVX
  349. # elif(defined(__SSE3__))
  350. # define GLM_ARCH GLM_ARCH_SSE3
  351. # elif(defined(__SSE2__))
  352. # define GLM_ARCH GLM_ARCH_SSE2
  353. # else
  354. # define GLM_ARCH GLM_ARCH_PURE
  355. # endif
  356. #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
  357. # if(defined(__AVX__))
  358. # define GLM_ARCH GLM_ARCH_AVX
  359. # elif(defined(__SSE3__))
  360. # define GLM_ARCH GLM_ARCH_SSE3
  361. # elif(defined(__SSE2__))
  362. # define GLM_ARCH GLM_ARCH_SSE2
  363. # else
  364. # define GLM_ARCH GLM_ARCH_PURE
  365. # endif
  366. #else
  367. # define GLM_ARCH GLM_ARCH_PURE
  368. #endif
  369. #if(GLM_ARCH != GLM_ARCH_PURE)
  370. #if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
  371. # include <immintrin.h>
  372. #endif//GLM_ARCH
  373. #if((GLM_ARCH & GLM_ARCH_SSE3) == GLM_ARCH_SSE3)
  374. # include <pmmintrin.h>
  375. #endif//GLM_ARCH
  376. #if((GLM_ARCH & GLM_ARCH_SSE2) == GLM_ARCH_SSE2)
  377. # include <emmintrin.h>
  378. #endif//GLM_ARCH
  379. #endif//(GLM_ARCH != GLM_ARCH_PURE)
  380. #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
  381. # define GLM_MESSAGE_ARCH_DISPLAYED
  382. # if(GLM_ARCH == GLM_ARCH_PURE)
  383. # pragma message("GLM: Platform independent")
  384. # elif(GLM_ARCH == GLM_ARCH_SSE2)
  385. # pragma message("GLM: SSE2 build platform")
  386. # elif(GLM_ARCH == GLM_ARCH_SSE3)
  387. # pragma message("GLM: SSE3 build platform")
  388. # elif(GLM_ARCH == GLM_ARCH_AVX)
  389. # pragma message("GLM: AVX build platform")
  390. # endif//GLM_ARCH
  391. #endif//GLM_MESSAGE
  392. ///////////////////////////////////////////////////////////////////////////////////////////////////
  393. // Components
  394. //#define GLM_FORCE_ONLY_XYZW
  395. #define GLM_COMPONENT_GLSL_NAMES 0
  396. #define GLM_COMPONENT_ONLY_XYZW 1 // To disable multiple vector component names access.
  397. #define GLM_COMPONENT_MS_EXT 2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
  398. #ifndef GLM_FORCE_ONLY_XYZW
  399. # if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS))
  400. # define GLM_COMPONENT GLM_COMPONENT_MS_EXT
  401. # else
  402. # define GLM_COMPONENT GLM_COMPONENT_GLSL_NAMES
  403. # endif
  404. #else
  405. # define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
  406. #endif
  407. #if((GLM_COMPONENT == GLM_COMPONENT_MS_EXT) && !(GLM_COMPILER & GLM_COMPILER_VC))
  408. # error "GLM_COMPONENT value is GLM_COMPONENT_MS_EXT but this is not allowed with the current compiler."
  409. #endif
  410. #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
  411. # define GLM_MESSAGE_COMPONENT_DISPLAYED
  412. # if(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
  413. # pragma message("GLM: GLSL multiple vector component names")
  414. # elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
  415. # pragma message("GLM: x,y,z,w vector component names only")
  416. # elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
  417. # pragma message("GLM: Multiple vector component names through Visual C++ language extensions")
  418. # else
  419. # error "GLM_COMPONENT value unknown"
  420. # endif//GLM_MESSAGE_COMPONENT_DISPLAYED
  421. #endif//GLM_MESSAGE
  422. ///////////////////////////////////////////////////////////////////////////////////////////////////
  423. // Static assert
  424. #if(GLM_LANG == GLM_LANG_CXX0X)
  425. # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
  426. #elif(defined(BOOST_STATIC_ASSERT))
  427. # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
  428. #elif(GLM_COMPILER & GLM_COMPILER_VC)
  429. # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
  430. #else
  431. # define GLM_STATIC_ASSERT(x, message)
  432. # define GLM_STATIC_ASSERT_NULL
  433. #endif//GLM_LANG
  434. ///////////////////////////////////////////////////////////////////////////////////////////////////
  435. // Qualifiers
  436. // User defines: GLM_FORCE_INLINE GLM_FORCE_CUDA
  437. #if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
  438. # define GLM_CUDA_FUNC_DEF __device__ __host__
  439. # define GLM_CUDA_FUNC_DECL __device__ __host__
  440. #else
  441. # define GLM_CUDA_FUNC_DEF
  442. # define GLM_CUDA_FUNC_DECL
  443. #endif
  444. #if GLM_COMPILER & GLM_COMPILER_GCC
  445. #define GLM_VAR_USED __attribute__ ((unused))
  446. #else
  447. #define GLM_VAR_USED
  448. #endif
  449. #if(defined(GLM_FORCE_INLINE))
  450. # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
  451. # define GLM_INLINE __forceinline
  452. # elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
  453. # define GLM_INLINE __attribute__((always_inline))
  454. # else
  455. # define GLM_INLINE inline
  456. # endif//GLM_COMPILER
  457. #else
  458. # define GLM_INLINE inline
  459. #endif//defined(GLM_FORCE_INLINE)
  460. #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
  461. #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
  462. ///////////////////////////////////////////////////////////////////////////////////////////////////
  463. // Swizzle operators
  464. // User defines: GLM_SWIZZLE_XYZW GLM_SWIZZLE_RGBA GLM_SWIZZLE_STQP GLM_SWIZZLE
  465. #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
  466. # define GLM_MESSAGE_SWIZZLE_DISPLAYED
  467. # if(defined(GLM_SWIZZLE))
  468. # pragma message("GLM: Full swizzling operator enabled")
  469. # elif(!defined(GLM_SWIZZLE_XYZW) && !defined(GLM_SWIZZLE_RGBA) && !defined(GLM_SWIZZLE_STQP) && !defined(GLM_SWIZZLE))
  470. # pragma message("GLM: No swizzling operator enabled")
  471. # else
  472. # pragma message("GLM: Partial swizzling operator enabled")
  473. # endif
  474. #endif//GLM_MESSAGE
  475. #endif//glm_setup