added SSE compiler flags under Windows+MSVC (ticket #371)

This commit is contained in:
Alexander Shishkov 2011-05-31 15:50:16 +00:00
parent 3a4e06e289
commit 6f6da53c64

View File

@ -277,6 +277,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()
if(MSVC)
set(ENABLE_SSE ON CACHE BOOL "Enable SSE instructions for MSVC")
set(ENABLE_SSE2 ON CACHE BOOL "Enable SSE2 instructions for MSVC")
if(CMAKE_C_COMPILER MATCHES "icc")
set(ENABLE_SSE3 OFF CACHE BOOL "Enable SSE3 instructions for ICC")
set(ENABLE_SSE4_1 OFF CACHE BOOL "Enable SSE4.1 instructions for ICC")
endif()
endif()
# allow fine grained control over which libraries not to link, even if
# they are available on the system
# ====================================================================
@ -1023,6 +1032,24 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
if(MSVC)
if(ENABLE_SSE)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE")
endif()
if(ENABLE_SSE2)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE2")
endif()
if(ENABLE_SSE3)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE3")
endif()
if(ENABLE_SSE4_1)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE4.1")
endif()
if (ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Oi")
endif()
endif()
# Extra link libs if the user selects building static libs:
IF(NOT BUILD_SHARED_LIBS)
if(CMAKE_COMPILER_IS_GNUCXX)