浏览代码

Fixed GLM test '/fp:fast' and '/Za' command-line options are incompatible

Christophe Riccio 9 年之前
父节点
当前提交
21a9d4ce18
共有 2 个文件被更改,包括 18 次插入16 次删除
  1. 17 16
      CMakeLists.txt
  2. 1 0
      readme.md

+ 17 - 16
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)

+ 1 - 0
readme.md

@@ -88,6 +88,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