Added platform detection

This commit is contained in:
Christophe Riccio 2011-10-25 14:15:17 +01:00
parent bfa79b2a67
commit a11aa14e86
2 changed files with 26 additions and 2 deletions

View File

@ -800,7 +800,7 @@ namespace detail
#if(GLM_COMPILER & GLM_COMPILER_VC)
return typename genType::bool_type(_isnan(x));
#elif(defined(ANDROID))
#elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return typename genType::bool_type(isnan(x));
#else
return typename genType::bool_type(std::isnan(x));
@ -853,7 +853,7 @@ namespace detail
#if(GLM_COMPILER & GLM_COMPILER_VC)
return typename genType::bool_type(_fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF);
#elif(defined(ANDROID))
#elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return typename genType::bool_type(isinf(x));
#else
return typename genType::bool_type(std::isinf(x));

View File

@ -38,6 +38,30 @@
#define GLM_VERSION_PATCH 3
#define GLM_VERSION_REVISION 0
///////////////////////////////////////////////////////////////////////////////////////////////////
// Platform
#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_ANDROID 0x00100000
#ifdef GLM_FORCE_PLATFORM_UNKNOWN
# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
#elif defined(_WIN32)
# define GLM_PLATFORM GLM_PLATFORM_WINDOWS
#elif defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
# define GLM_PLATFORM GLM_PLATFORM_IOS
#elif defined(__APPLE__)
# define GLM_PLATFORM GLM_PLATFORM_MACOSX
#elif defined(ANDROID)
# define GLM_PLATFORM GLM_PLATFORM_ANDROID
#else
# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
#endif//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Compiler