add sse flags for cmake/msvc
authorCampbell Barton <ideasman42@gmail.com>
Mon, 1 Aug 2011 06:11:41 +0000 (06:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 1 Aug 2011 06:11:41 +0000 (06:11 +0000)
CMakeLists.txt

index d4489a8..455c307 100644 (file)
@@ -1054,20 +1054,34 @@ if(APPLE OR WIN32)
        endif()
 endif()
 
+# See TEST_SSE_SUPPORT() for how this is defined.
+
 if(WITH_RAYOPTIMIZATION)
        if(CMAKE_COMPILER_IS_GNUCC)
-               if(SUPPORT_SSE_BUILD)
-                       set(PLATFORM_CFLAGS " -msse ${PLATFORM_CFLAGS}")
-                       add_definitions(-D__SSE__ -D__MMX__)
-               endif()
-               if(SUPPORT_SSE2_BUILD)
-                       set(PLATFORM_CFLAGS " -msse2 ${PLATFORM_CFLAGS}")
-                       add_definitions(-D__SSE2__)
-                       if(NOT SUPPORT_SSE_BUILD) # dont double up
-                               add_definitions(-D__MMX__)
-                       endif()
+               set(_sse "-msse")
+               set(_sse2 "-msse2")
+       elseif(MSVC)
+               set(_sse "/arch:SSE")
+               set(_sse2 "/arch:SSE2")
+       else()
+               message(WARNING "SSE flags for this compiler not known")
+               set(_sse)
+               set(_sse2)
+       endif()
+
+       if(SUPPORT_SSE_BUILD)
+               set(PLATFORM_CFLAGS " ${_sse} ${PLATFORM_CFLAGS}")
+               add_definitions(-D__SSE__ -D__MMX__)
+       endif()
+       if(SUPPORT_SSE2_BUILD)
+               set(PLATFORM_CFLAGS " ${_sse2} ${PLATFORM_CFLAGS}")
+               add_definitions(-D__SSE2__)
+               if(NOT SUPPORT_SSE_BUILD) # dont double up
+                       add_definitions(-D__MMX__)
                endif()
        endif()
+       unset(_sse)
+       unset(_sse2)
 endif()
 
 if(WITH_IMAGE_OPENJPEG)