Browse Source

Improved compiler detection

Christophe Riccio 14 years ago
parent
commit
c99e2f523f
4 changed files with 36 additions and 3 deletions
  1. 1 1
      doc/pages.doxy
  2. 5 1
      doc/src/data.xml
  3. 29 1
      glm/core/setup.hpp
  4. 1 0
      readme.txt

+ 1 - 1
doc/pages.doxy

@@ -10,7 +10,7 @@
 	This library works perfectly with OpenGL but it also ensures interoperability with other third party libraries and SDK. It is a good candidate for software rendering (Raytracing / Rasterisation), image processing, physic simulations and any context that requires a simple and convenient mathematics library.
 	
 	GLM is written as a platform independent library with no dependence and officially supports the following compilers:
-	1. Clang 2.0  and higher
+	1. Clang 2.0 and higher
 	2. CUDA 3.0 and higher
 	3. GCC 3.4 and higher
 	4. LLVM 2.3 through GCC 4.2 front-end and higher

+ 5 - 1
doc/src/data.xml

@@ -1535,7 +1535,11 @@
 			This library works perfectly with OpenGL but it also ensures interoperability with other third party libraries and SDKs. It is a good candidate for software rendering (Raytracing / Rasterisation), image processing, physic simulations and any context that requires a simple and convenient mathematics library.
 		</paragraph>
 		<list name="GLM is written as a platform independent library with no dependence and officially supports the following compilers:">
-			<list-element><link href="http://http://gcc.gnu.org/">GCC</link> 3.4 and higher</list-element>
+			<list-element><link href="http://clang.llvm.org">Clang</link> 2.0 and higher</list-element>
+			<list-element>
+				<link href="http://developer.nvidia.com/category/zone/cuda-zone">CUDA</link> 3.0 and higher
+			</list-element>
+			<list-element><link href="http://gcc.gnu.org/">GCC</link> 3.4 and higher</list-element>
 			<list-element><link href="http://llvm.org/">LLVM</link> 2.3 through GCC 4.2 front-end and higher</list-element>
 			<list-element><link href="http://msdn.microsoft.com/en-us/visualc/default">Visual C++</link> 2005 and higher</list-element>
 			<list-element>Any C++ compiler following C++98 norm</list-element>

+ 29 - 1
glm/core/setup.hpp

@@ -24,7 +24,7 @@
 // Compiler
 
 // User defines: GLM_FORCE_COMPILER_UNKNOWN
-// TODO ? __llvm__ __clang__
+// TODO ? __llvm__ 
 
 #define GLM_COMPILER_UNKNOWN		0x00000000
 
@@ -82,6 +82,16 @@
 #define GLM_COMPILER_CUDA32			0x10000030
 #define GLM_COMPILER_CUDA40			0x10000040
 
+// Clang
+#define GLM_COMPILER_CLANG          0x20000000
+#define GLM_COMPILER_CLANG26		0x20000010
+#define GLM_COMPILER_CLANG27		0x20000020
+#define GLM_COMPILER_CLANG28		0x20000030
+#define GLM_COMPILER_CLANG29		0x20000040
+
+// LLVM GCC
+#define GLM_COMPILER_LLVM_GCC		0x40000000
+
 // Build model
 #define GLM_MODEL_32				0x00000010
 #define GLM_MODEL_64				0x00000020
@@ -120,6 +130,20 @@
 #		define GLM_COMPILER GLM_COMPILER_VC
 #	endif//_MSC_VER
 
+#elif defined(__clang__)
+#	if   (__clang_major__ == 2) && (__clang_minor__ == 6)
+#		define GLM_COMPILER GLM_COMPILER_CLANG26
+#	elif (__clang_major__ == 2) && (__clang_minor__ == 7)
+#		define GLM_COMPILER GLM_COMPILER_CLANG27
+#	elif (__clang_major__ == 2) && (__clang_minor__ == 8)
+#		define GLM_COMPILER GLM_COMPILER_CLANG28
+#	elif (__clang_major__ == 2) && (__clang_minor__ == 9)
+#		define GLM_COMPILER GLM_COMPILER_CLANG29
+#	endif
+
+#elif defined(__llvm__)
+#	define GLM_COMPILER GLM_COMPILER_LLVM_GCC
+
 // G++
 #elif defined(__GNUC__)
 #	if   (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
@@ -189,6 +213,10 @@
 #		pragma message("GLM: CUDA compiler detected")
 #	elif(GLM_COMPILER & GLM_COMPILER_VC)
 #		pragma message("GLM: Visual C++ compiler detected")
+#	elif(GLM_COMPILER & GLM_COMPILER_CLANG)
+#		pragma message("GLM: Clang compiler detected")
+#	elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
+#		pragma message("GLM: LLVM GCC compiler detected")
 #	elif(GLM_COMPILER & GLM_COMPILER_GCC)
 #		pragma message("GLM: GCC compiler detected")
 #	elif(GLM_COMPILER & GLM_COMPILER_BC)

+ 1 - 0
readme.txt

@@ -17,6 +17,7 @@ http://glm.g-truc.net/glm-0.9.2.pdf
 GLM 0.9.2.1: 2010-05-20
 --------------------------------------------------------------------------------
 - Automatically detect CUDA support
+- Improved Clang detection
 - Fixed errors and warnings in VC with C++ extensions disabled
 - Fixed and tested GLM_GTX_vector_angle
 - Fixed and tested GLM_GTX_rotate_vector