core_setup_message.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2011-05-31
  5. // Updated : 2011-05-31
  6. // Licence : This source is under MIT License
  7. // File : test/core/setup_message.cpp
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. #define GLM_MESSAGES
  10. #include <glm/glm.hpp>
  11. #include <iostream>
  12. /*
  13. #define GLM_COMPILER_UNKNOWN 0x00000000
  14. // Visual C++ defines
  15. #define GLM_COMPILER_VC 0x01000000
  16. #define GLM_COMPILER_VC2 0x01000010
  17. #define GLM_COMPILER_VC4 0x01000020
  18. #define GLM_COMPILER_VC5 0x01000030
  19. #define GLM_COMPILER_VC6 0x01000040
  20. #define GLM_COMPILER_VC2002 0x01000050
  21. #define GLM_COMPILER_VC2003 0x01000060
  22. #define GLM_COMPILER_VC2005 0x01000070
  23. #define GLM_COMPILER_VC2008 0x01000080
  24. #define GLM_COMPILER_VC2010 0x01000090
  25. #define GLM_COMPILER_VC2011 0x010000A0
  26. // GCC defines
  27. #define GLM_COMPILER_GCC 0x02000000
  28. #define GLM_COMPILER_GCC_LLVM 0x02000001
  29. #define GLM_COMPILER_GCC_CLANG 0x02000002
  30. #define GLM_COMPILER_GCC30 0x02000010
  31. #define GLM_COMPILER_GCC31 0x02000020
  32. #define GLM_COMPILER_GCC32 0x02000030
  33. #define GLM_COMPILER_GCC33 0x02000040
  34. #define GLM_COMPILER_GCC34 0x02000050
  35. #define GLM_COMPILER_GCC35 0x02000060
  36. #define GLM_COMPILER_GCC40 0x02000070
  37. #define GLM_COMPILER_GCC41 0x02000080
  38. #define GLM_COMPILER_GCC42 0x02000090
  39. #define GLM_COMPILER_GCC43 0x020000A0
  40. #define GLM_COMPILER_GCC44 0x020000B0
  41. #define GLM_COMPILER_GCC45 0x020000C0
  42. #define GLM_COMPILER_GCC46 0x020000D0
  43. #define GLM_COMPILER_GCC47 0x020000E0
  44. #define GLM_COMPILER_GCC48 0x020000F0
  45. #define GLM_COMPILER_GCC49 0x02000100
  46. #define GLM_COMPILER_GCC50 0x02000200
  47. // G++ command line to display defined
  48. // echo "" | g++ -E -dM -x c++ - | sort
  49. // Borland C++ defines. How to identify BC?
  50. #define GLM_COMPILER_BC 0x04000000
  51. #define GLM_COMPILER_BCB4 0x04000100
  52. #define GLM_COMPILER_BCB5 0x04000200
  53. #define GLM_COMPILER_BCB6 0x04000300
  54. //#define GLM_COMPILER_BCBX 0x04000400 // What's the version value?
  55. #define GLM_COMPILER_BCB2009 0x04000500
  56. // CodeWarrior
  57. #define GLM_COMPILER_CODEWARRIOR 0x08000000
  58. // CUDA
  59. #define GLM_COMPILER_CUDA 0x10000000
  60. #define GLM_COMPILER_CUDA30 0x10000010
  61. #define GLM_COMPILER_CUDA31 0x10000020
  62. #define GLM_COMPILER_CUDA32 0x10000030
  63. #define GLM_COMPILER_CUDA40 0x10000040
  64. // Clang
  65. #define GLM_COMPILER_CLANG 0x20000000
  66. #define GLM_COMPILER_CLANG26 0x20000010
  67. #define GLM_COMPILER_CLANG27 0x20000020
  68. #define GLM_COMPILER_CLANG28 0x20000030
  69. #define GLM_COMPILER_CLANG29 0x20000040
  70. // LLVM GCC
  71. #define GLM_COMPILER_LLVM_GCC 0x40000000
  72. */
  73. int test_compiler()
  74. {
  75. int Error = 0;
  76. switch(GLM_COMPILER)
  77. {
  78. case GLM_COMPILER_VC:
  79. std::cout << "GLM_COMPILER_VC" << std::endl;
  80. break;
  81. case GLM_COMPILER_GCC:
  82. std::cout << "GLM_COMPILER_GCC" << std::endl;
  83. break;
  84. case GLM_COMPILER_BC:
  85. std::cout << "GLM_COMPILER_BC" << std::endl;
  86. break;
  87. case GLM_COMPILER_CODEWARRIOR:
  88. std::cout << "GLM_COMPILER_CODEWARRIOR" << std::endl;
  89. break;
  90. case GLM_COMPILER_CUDA:
  91. std::cout << "GLM_COMPILER_CUDA" << std::endl;
  92. break;
  93. case GLM_COMPILER_CLANG:
  94. std::cout << "GLM_COMPILER_CLANG" << std::endl;
  95. break;
  96. case GLM_COMPILER_LLVM_GCC:
  97. std::cout << "GLM_COMPILER_LLVM_GCC" << std::endl;
  98. break;
  99. default:
  100. std::cout << "Undetected compiler" << std::endl;
  101. break;
  102. }
  103. return Error;
  104. }
  105. int test_model()
  106. {
  107. int Error = 0;
  108. Error += ((sizeof(void*) == 4) && (GLM_MODEL == GLM_MODEL_32)) || ((sizeof(void*) == 8) && (GLM_MODEL == GLM_MODEL_64)) ? 0 : 1;
  109. return Error;
  110. }
  111. int test_operators()
  112. {
  113. glm::vec3 A(1.0f);
  114. glm::vec3 B(1.0f);
  115. bool R = A != B;
  116. bool S = A == B;
  117. return (S && !R) ? 0 : 1;
  118. }
  119. int main()
  120. {
  121. int Error = 0;
  122. Error += test_compiler();
  123. Error += test_model();
  124. Error += test_operators();
  125. return Error;
  126. }