From a1b4bdbf039e21cf74e6b41166420857694623ee Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 16 Jul 2016 23:54:11 +0200 Subject: [PATCH] Fixed GLM test '/fp:fast' and '/Za' command-line options are incompatible --- CMakeLists.txt | 33 +++++++++++++++++---------------- readme.md | 1 + 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75fc5211..e77c9b97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,8 @@ if(NOT GLM_TEST_ENABLE) message(STATUS "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_FAST_MATH "Enable fast math optimizations" OFF) + if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX)) option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF) option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF) @@ -68,7 +70,21 @@ endif() option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF) -if(NOT GLM_TEST_ENABLE_LANG_EXTENSIONS) +if(GLM_TEST_ENABLE_LANG_EXTENSIONS) + 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() +else() if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32)) add_definitions(/Za) elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) @@ -122,21 +138,6 @@ elseif(GLM_TEST_ENABLE_SIMD_SSE2) 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(-S) #add_definitions(-s) diff --git a/readme.md b/readme.md index e6e98493..bfbf5343 100644 --- a/readme.md +++ b/readme.md @@ -100,6 +100,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed sign with signed integer function on non-x86 architecture - Fixed strict aliasing warnings #473 - Fixed missing vec1 overload to length2 and distance2 functions #431 +- Fixed GLM test '/fp:fast' and '/Za' command-line options are incompatible ##### Deprecation: - Removed GLM_FORCE_SIZE_FUNC define