From 94ed70607b6c105489eccb15b495eedba382a314 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 17 Dec 2016 10:51:01 +0100 Subject: [PATCH] MSVC 2013+ for 64-bit automatically sets /arch:SSE2 and doesn't recognise te option --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ada9241cb..9242733f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,6 +357,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() + if(ENABLE_SIMD) + if (X86 OR X86_64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3 -mfpmath=sse") + endif() + endif() + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(WARNING_FLAGS_C "-Wall") @@ -365,10 +371,10 @@ endif() if(WIN32) if(MSVC) - set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP") + set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP /Ox") if(ENABLE_SIMD) - if (X86 OR X86_64) - set(MSVC_FLAGS "${MSVC_FLAGS} /arch:SSE /arch:SSE2 /Ox") + if (X86) + set(MSVC_FLAGS "${MSVC_FLAGS} /arch:SSE /arch:SSE2") endif() endif()