From 87ffd572b2959103e398f548076904df53a43532 Mon Sep 17 00:00:00 2001 From: natureh 510 Date: Sat, 16 Mar 2013 20:14:25 +0100 Subject: [PATCH] Fixing SSE instability for Mingw32 systems (see issue 1736) --- CMakeLists.txt | 11 ++++++++++- rtengine/CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0624fdff..0916ea74b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,16 @@ set (PROC_TARGET_NUMBER 0 CACHE STRING "Selected target processor from the list # It were moved away from rtengine/CMakefiles.txt, because some users may want to remove -ffast_math : # this flag speeds up the floating-point operations, but with a little bite less precisions. This default value # gives the same result/behaviour as before. -set (RTENGINE_CXX_FLAGS "-ffast-math -funroll-loops" CACHE STRING "Special compilation flags for RTEngine") +# Due to a bug in GCC when using OpenMP+SSE, -mstackrealign will be added to your flags +set (RTENGINE_CXX_FLAGS "-ffast-math -funroll-loops" CACHE STRING "Special compilation flags for RTEngine; -mstackrealign will be added to your flags") + +if (WIN32) + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set (RTENGINE_CXX_FLAGS_MANDATORY "-mstackrealign") + elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) + set (RTENGINE_CXX_FLAGS_MANDATORY "") + endif (CMAKE_SIZEOF_VOID_P EQUAL 4) +endif (WIN32) #loading the processor targets list include (ProcessorTargets.cmake) diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index dfac79d92..2e22f2144 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -29,7 +29,7 @@ IF (BUILD_SHARED_LIBS) install (TARGETS rtengine DESTINATION ${LIBDIR}) ENDIF (BUILD_SHARED_LIBS) -set_target_properties (rtengine PROPERTIES COMPILE_FLAGS "${RTENGINE_CXX_FLAGS}") +set_target_properties (rtengine PROPERTIES COMPILE_FLAGS "${RTENGINE_CXX_FLAGS} ${RTENGINE_CXX_FLAGS_MANDATORY}") target_link_libraries (rtengine rtexif ${EXTRA_LIB} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES} ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${LCMS_LIBRARIES} ${EXPAT_LIBRARIES} ${FFTW3F_LIBRARIES} ${IPTCDATA_LIBRARIES}