From dd8cecbbbcdd8156027157c8d4b465e8dc3106f2 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 24 Jan 2012 13:56:15 +0000 Subject: [PATCH 1/2] Fixed platform detection --- glm/core/setup.hpp | 46 ++++++++++++++------------------ test/core/core_setup_message.cpp | 6 +++++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 98b9f207..ef052f67 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -36,7 +36,7 @@ #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 #define GLM_VERSION_PATCH 3 -#define GLM_VERSION_REVISION 0 +#define GLM_VERSION_REVISION 1 /////////////////////////////////////////////////////////////////////////////////////////////////// // Platform @@ -44,35 +44,26 @@ #define GLM_PLATFORM_UNKNOWN 0x00000000 #define GLM_PLATFORM_WINDOWS 0x00010000 #define GLM_PLATFORM_LINUX 0x00020000 -#define GLM_PLATFORM_MACOSX 0x00040000 -#define GLM_PLATFORM_IOS 0x00080000 +#define GLM_PLATFORM_APPLE 0x00040000 +//#define GLM_PLATFORM_IOS 0x00080000 #define GLM_PLATFORM_ANDROID 0x00100000 #define GLM_PLATFORM_CHROME_NACL 0x00200000 -#define GLM_PLATFORM_UNIX 0x00040000 +#define GLM_PLATFORM_UNIX 0x00400000 #ifdef GLM_FORCE_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN +#elif defined(__APPLE__) +# define GLM_PLATFORM GLM_PLATFORM_APPLE #elif defined(_WIN32) # define GLM_PLATFORM GLM_PLATFORM_WINDOWS -#elif defined(__unix) -# if defined(__APPLE__) -# include "TargetConditionals.h" -# if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) -# define GLM_PLATFORM GLM_PLATFORM_IOS -# elif defined(TARGET_OS_MAC) -# define GLM_PLATFORM GLM_PLATFORM_MACOSX -# else -# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN -# endif -# elif defined(ANDROID) -# define GLM_PLATFORM GLM_PLATFORM_ANDROID -# elif defined(__linux) -# define GLM_PLATFORM GLM_PLATFORM_LINUX -# else -# define GLM_PLATFORM GLM_PLATFORM_UNIX -# endif #elif defined(__native_client__) # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL +#elif defined(ANDROID) +# define GLM_PLATFORM GLM_PLATFORM_ANDROID +#elif defined(__linux) +# define GLM_PLATFORM GLM_PLATFORM_LINUX +#elif defined(__unix) +# define GLM_PLATFORM GLM_PLATFORM_UNIX #else # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN #endif// @@ -82,10 +73,10 @@ # define GLM_MESSAGE_PLATFORM_DISPLAYED # if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) # pragma message("GLM: Windows platform detected") -# elif(GLM_PLATFORM & GLM_PLATFORM_IOS) -# pragma message("GLM: iOS platform detected") -# elif(GLM_PLATFORM & GLM_PLATFORM_MACOSX) -# pragma message("GLM: MacOSX platform detected") +//# elif(GLM_PLATFORM & GLM_PLATFORM_IOS) +//# pragma message("GLM: iOS platform detected") +# elif(GLM_PLATFORM & GLM_PLATFORM_APPLE) +# pragma message("GLM: Apple platform detected") # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX) # pragma message("GLM: Linux platform detected") # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX) @@ -436,7 +427,10 @@ #else # if(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__)) # define GLM_LANG GLM_LANG_CXX98 -# elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) // -std=c++0x or -std=gnu++0x +# elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG) +# define GLM_LANG GLM_LANG_CXX98 +// -std=c++0x or -std=gnu++0x +# elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) # define GLM_LANG GLM_LANG_CXX0X # elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS)) # define GLM_LANG GLM_LANG_CXXMS diff --git a/test/core/core_setup_message.cpp b/test/core/core_setup_message.cpp index 0a2029a7..208b245e 100644 --- a/test/core/core_setup_message.cpp +++ b/test/core/core_setup_message.cpp @@ -133,6 +133,12 @@ int test_compiler() case GLM_COMPILER_CLANG29: std::cout << "GLM_COMPILER_CLANG29" << std::endl; break; + case GLM_COMPILER_CLANG30: + std::cout << "GLM_COMPILER_CLANG30" << std::endl; + break; + case GLM_COMPILER_CLANG31: + std::cout << "GLM_COMPILER_CLANG31" << std::endl; + break; case GLM_COMPILER_LLVM_GCC: std::cout << "GLM_COMPILER_LLVM_GCC" << std::endl; break; From 80e9c0ed64b3e7ce3238ddb1212a44dfe97774fb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 24 Jan 2012 14:36:47 +0000 Subject: [PATCH 2/2] Fixed language detection --- glm/core/setup.hpp | 18 +++++++++--------- glm/core/type_vec2.hpp | 6 +++--- glm/core/type_vec3.hpp | 6 +++--- glm/core/type_vec4.hpp | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index ef052f67..313ce14b 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -284,7 +284,7 @@ # endif // G++ -#elif defined(__GNUC__)// || defined(__llvm__) || defined(__clang__) +#elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__) # if defined (__llvm__) # define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_LLVM # elif defined (__clang__) @@ -425,12 +425,8 @@ #elif(defined(GLM_FORCE_CXX98)) # define GLM_LANG GLM_LANG_CXX98 #else -# if(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__)) -# define GLM_LANG GLM_LANG_CXX98 -# elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG) -# define GLM_LANG GLM_LANG_CXX98 // -std=c++0x or -std=gnu++0x -# elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) +# if(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) # define GLM_LANG GLM_LANG_CXX0X # elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS)) # define GLM_LANG GLM_LANG_CXXMS @@ -440,6 +436,10 @@ # else # define GLM_LANG GLM_LANG_CXX98 # endif//(GLM_COMPILER == GLM_COMPILER_VC2010) +# elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) //&& defined(__STRICT_ANSI__)) +# define GLM_LANG GLM_LANG_CXX98 +# elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG) +# define GLM_LANG GLM_LANG_CXX98 # else # define GLM_LANG GLM_LANG_CXX # endif @@ -539,11 +539,11 @@ # if(GLM_ARCH == GLM_ARCH_PURE) # pragma message("GLM: Platform independent") # elif(GLM_ARCH == GLM_ARCH_SSE2) -# pragma message("GLM: SSE2 build platform") +# pragma message("GLM: SSE2 instruction set") # elif(GLM_ARCH == GLM_ARCH_SSE3) -# pragma message("GLM: SSE3 build platform") +# pragma message("GLM: SSE3 instruction set") # elif(GLM_ARCH == GLM_ARCH_AVX) -# pragma message("GLM: AVX build platform") +# pragma message("GLM: AVX instruction set") # endif//GLM_ARCH #endif//GLM_MESSAGE diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 0fb128c9..00972536 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -61,7 +61,7 @@ namespace detail ////////////////////////////////////// // Data -# if(GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() && !defined(GLM_FORCE_ONLY_XYZW)) +# if(GLM_COMPONENT == GLM_COMPONENT_CXX11) union { # if(defined(GLM_SWIZZLE)) @@ -80,7 +80,7 @@ namespace detail struct{value_type s, t;}; struct{value_type x, y;}; }; -# elif(GLM_SUPPORT_ANONYMOUS_UNION() && !defined(GLM_FORCE_ONLY_XYZW)) +# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) union {value_type x, r, s;}; union {value_type y, g, t;}; @@ -89,7 +89,7 @@ namespace detail GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, detail::tvec2, detail::tref2) GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4) # endif//(defined(GLM_SWIZZLE)) -# else +# else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW) value_type x, y; # if(defined(GLM_SWIZZLE)) diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 0077cd09..3177b342 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -61,7 +61,7 @@ namespace detail ////////////////////////////////////// // Data -# if(GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() && !defined(GLM_FORCE_ONLY_XYZW)) +# if(GLM_COMPONENT == GLM_COMPONENT_CXX11) union { # if(defined(GLM_SWIZZLE)) @@ -80,7 +80,7 @@ namespace detail struct{value_type s, t, p;}; struct{value_type x, y, z;}; }; -# elif(GLM_SUPPORT_ANONYMOUS_UNION() && !defined(GLM_FORCE_ONLY_XYZW)) +# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) union {value_type x, r, s;}; union {value_type y, g, t;}; union {value_type z, b, p;}; @@ -90,7 +90,7 @@ namespace detail GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, detail::tvec3, detail::tref2, detail::tref3) GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4) # endif//(defined(GLM_SWIZZLE)) -# else +# else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW) value_type x, y, z; # if(defined(GLM_SWIZZLE)) diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index d481a79c..31cd9940 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -61,7 +61,7 @@ namespace detail ////////////////////////////////////// // Data -# if(GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() && !defined(GLM_FORCE_ONLY_XYZW)) +# if(GLM_COMPONENT == GLM_COMPONENT_CXX11) union { # if(defined(GLM_SWIZZLE)) @@ -80,7 +80,7 @@ namespace detail struct{value_type s, t, p, q;}; struct{value_type x, y, z, w;}; }; -# elif(GLM_SUPPORT_ANONYMOUS_UNION() && !defined(GLM_FORCE_ONLY_XYZW)) +# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) union {value_type x, r, s;}; union {value_type y, g, t;}; union {value_type z, b, p;}; @@ -91,7 +91,7 @@ namespace detail GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, detail::tvec4, detail::tref2, detail::tref3, detail::tref4) GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4) # endif//(defined(GLM_SWIZZLE)) -# else +# else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW) value_type x, y, z, w; # if(defined(GLM_SWIZZLE))