Force SSE2 floats for i686 targets
Both GCC and Clang use x87 instructions by default on 32-bit x86 targets, but the loss of precision resulting from that has yielded crashing tests (see referenced issue), and it can be safely assumed there are very few CPUs that both don't support SSE2 and are expected to run SolveSpace This commit also removes a now-redundant check for 32-bit Windows against TARGET, which doesn't seem to be actually set by CMake at all Ref: #565pull/572/head
parent
aeaece53e1
commit
645353cbdc
|
@ -80,11 +80,20 @@ endif()
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(TRIPLE STREQUAL "i686-w64-mingw32")
|
# Ensure that all platforms use 64-bit IEEE floating point operations for consistency;
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
|
# this is most important for the testsuite, which compares savefiles directly
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
|
# and depends on consistent rounding of intermediate results.
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86")
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
set(FLOAT_FLAGS "-mfpmath=sse -msse2")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
set(FLOAT_FLAGS "-msse2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLOAT_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLOAT_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
|
Loading…
Reference in New Issue