diff --git a/CMakeLists.txt b/CMakeLists.txt index ef490505..549b183f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,18 +6,78 @@ enable_testing() add_definitions(-D_CRT_SECURE_NO_WARNINGS) +option(GLM_TEST_ENABLE "GLM test" OFF) +if(NOT GLM_TEST_ENABLE) + message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench") +endif() + +option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF) +if(GLM_TEST_ENABLE_CXX_11) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-std=c++11) + endif() +elseif(NOT GLM_TEST_ENABLE_CXX_11) + add_definitions(-DGLM_FORCE_CXX98) + + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-std=c++98) + endif() +endif() + +option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF) +if(GLM_TEST_ENABLE_MS_EXTENSIONS) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-fms-extensions) + add_definitions(-D_MSC_EXTENSIONS) + endif() +elseif(NOT GLM_TEST_ENABLE_MS_EXTENSIONS) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-std=c++98) + add_definitions(-pedantic) + endif() + + if(MSVC) + add_definitions(/Za) + endif() +endif() + +option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF) +if(GLM_TEST_ENABLE_SIMD) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-msse2) + endif() + + if(MSVC) + add_definitions(/arch:SSE2) + endif() +elseif(NOT GLM_TEST_ENABLE_SIMD) + + add_definitions(-DGLM_FORCE_PURE) + + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-mfpmath=387) + endif() +endif() + +option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF) +if(GLM_TEST_ENABLE_FAST_MATH) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-ffast-math) + endif() + + if(MSVC) + add_definitions(/fp:fast) + endif() +elseif(NOT GLM_TEST_ENABLE_FAST_MATH) + if(MSVC) + add_definitions(/fp:precise) + endif() +endif() + if(CMAKE_COMPILER_IS_GNUCXX) - #add_definitions(/Za) - #add_definitions(-pedantic) #add_definitions(-S) #add_definitions(-s) - #add_definitions(-msse2) - #add_definitions(-std=c++0x) - #add_definitions(-fms-extensions) - #add_definitions(-D_MSC_EXTENSIONS) #add_definitions(-m32) - #add_definitions(-mfpmath=387) - #add_definitions(-ffast-math) #add_definitions(-O3) #add_definitions(-fprofile-arcs -ftest-coverage) gcov @@ -32,9 +92,4 @@ add_subdirectory(test) add_subdirectory(bench) add_subdirectory(doc) -option(GLM_TEST_MODE "GLM test" OFF) -if(NOT GLM_TEST_MODE) - message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_MODE with ON to build and run the test bench") -endif() - install(DIRECTORY glm DESTINATION include) diff --git a/glm/gtx/compatibility.hpp b/glm/gtx/compatibility.hpp index 9cc0d281..94223860 100644 --- a/glm/gtx/compatibility.hpp +++ b/glm/gtx/compatibility.hpp @@ -42,6 +42,7 @@ // Dependency: #include "../glm.hpp" #include "../gtc/half_float.hpp" +#include "../gtc/quaternion.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTX_compatibility extension included") @@ -51,6 +52,9 @@ #include #elif(GLM_COMPILER & GLM_COMPILER_GCC) #include +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) +# undef isfinite +# endif #endif//GLM_COMPILER namespace glm @@ -66,6 +70,8 @@ namespace glm template GLM_FUNC_QUALIFIER detail::tvec3 lerp(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template GLM_FUNC_QUALIFIER detail::tvec4 lerp(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER T slerp(detail::tquat const & x, detail::tquat const & y, T const & a){return mix(x, y, a);} //!< \brief Returns the slurp interpolation between two quaternions. + template GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) template GLM_FUNC_QUALIFIER detail::tvec2 saturate(const detail::tvec2& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) template GLM_FUNC_QUALIFIER detail::tvec3 saturate(const detail::tvec3& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) diff --git a/glm/gtx/compatibility.inl b/glm/gtx/compatibility.inl index 5ad69af3..beb8615d 100644 --- a/glm/gtx/compatibility.inl +++ b/glm/gtx/compatibility.inl @@ -14,11 +14,18 @@ namespace glm GLM_FUNC_QUALIFIER bool isfinite( genType const & x) { - #if(GLM_COMPILER & GLM_COMPILER_VC) - return _finite(x); - #else//(GLM_COMPILER & GLM_COMPILER_GCC) - return std::isfinite(x) != 0; - #endif +# if(GLM_COMPILER & GLM_COMPILER_VC) + return _finite(x); +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isfinite(x) != 0; +# else + return std::isfinite(x) != 0; +# endif +# else + return std::isfinite(x) != 0; +# endif + } template @@ -56,11 +63,17 @@ namespace glm GLM_FUNC_QUALIFIER bool isinf( genType const & x) { - #if(GLM_COMPILER & GLM_COMPILER_VC) - return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; - #else - return std::isinf(x) != 0; - #endif +# if(GLM_COMPILER & GLM_COMPILER_VC) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isinf(x) != 0; +# else + return std::isinf(x) != 0; +# endif +# else + return std::isinf(x) != 0; +# endif } template @@ -97,11 +110,17 @@ namespace glm template GLM_FUNC_QUALIFIER bool isnan(genType const & x) { - #if(GLM_COMPILER & GLM_COMPILER_VC) - return _isnan(x); - #else - return std::isnan(x) != 0; - #endif +# if(GLM_COMPILER & GLM_COMPILER_VC) + return _isnan(x); +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isnan(x) != 0; +# else + return std::isnan(x) != 0; +# endif +# else + return std::isnan(x) != 0; +# endif } template diff --git a/readme.txt b/readme.txt index f13ad9b3..5d59bb44 100644 --- a/readme.txt +++ b/readme.txt @@ -36,6 +36,14 @@ GLM is a header only library, there is nothing to build, just include it. More informations in GLM manual: http://glm.g-truc.net/glm-0.9.3.pdf +================================================================================ +GLM 0.9.3.3: 2012-05-XX +-------------------------------------------------------------------------------- +- Fixed isinf and isnan +- Improved compatibility with Intel compiler +- Added CMake test build options: SIMD, C++11, fast math and MS land ext +- Fixed SIMD mat4 test on GCC + ================================================================================ GLM 0.9.3.2: 2012-03-15 -------------------------------------------------------------------------------- diff --git a/test/external/gli/gtx/loader_tga.inl b/test/external/gli/gtx/loader_tga.inl index f113ab33..c116bf25 100644 --- a/test/external/gli/gtx/loader_tga.inl +++ b/test/external/gli/gtx/loader_tga.inl @@ -156,4 +156,4 @@ namespace loader_tga } }//namespace loader_tga }//namespace gtx -}//namespace gli \ No newline at end of file +}//namespace gli diff --git a/test/gtx/gtx_string_cast.cpp b/test/gtx/gtx_string_cast.cpp index 5c405246..fc9dbc9e 100644 --- a/test/gtx/gtx_string_cast.cpp +++ b/test/gtx/gtx_string_cast.cpp @@ -7,7 +7,6 @@ // File : test/gtx/string_cast.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include #include