Added /arch:SSE2 flag
authorVitaly Kirsanov <krokoziabla@gmail.com>
Fri, 12 Apr 2019 20:11:06 +0000 (23:11 +0300)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 4 May 2019 01:41:48 +0000 (11:41 +1000)
CMakeLists.txt
src/libFLAC/CMakeLists.txt

index 21fd9b7..b7dd296 100644 (file)
@@ -81,8 +81,8 @@ add_compile_options(
     $<$<AND:$<BOOL:${HAVE_SSP_FLAG}>,$<BOOL:${ENABLE_SSP}>>:-fstack-protector>
     $<$<AND:$<BOOL:${HAVE_SSP_FLAG}>,$<BOOL:${ENABLE_SSP}>>:--param>
     $<$<AND:$<BOOL:${HAVE_SSP_FLAG}>,$<BOOL:${ENABLE_SSP}>>:ssp-buffer-size=4>
-    $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:HAVE_WEFFCXX_FLAG>>:-Weffc++>
-    $<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:HAVE_DECL_AFTER_STMT_FLAG>>:-Wdeclaration-after-statement>)
+    $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:${HAVE_WEFFCXX_FLAG}>>:-Weffc++>
+    $<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${HAVE_DECL_AFTER_STMT_FLAG}>>:-Wdeclaration-after-statement>)
 
 if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG)
     add_compile_options(-mstackrealign)
index 8fe2acd..594b672 100644 (file)
@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.12)
 
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86(_64)?|(AMD|amd)64|i[346]86")
     option(WITH_AVX "Enable AVX, AVX2 optimizations" ON)
-    option(WITH_SSE "Enable AVX, AVX2 optimizations" ON)
-endif()
-
-check_c_compiler_flag(-msse2 HAVE_MSSE2_FLAG)
-if(HAVE_MSSE2_FLAG AND WITH_SSE)
-    add_compile_options(-msse2)
 endif()
 
 option(WITH_ASM "Use any assembly optimization routines" ON)
@@ -50,10 +44,21 @@ if(NOT WITH_ASM)
     add_compile_definitions(FLAC__NO_ASM)
 endif()
 
-if(WITH_ASM AND IA32 AND CMAKE_ASM_NASM_COMPILER)
-    add_subdirectory(ia32)
+if(IA32)
+    if(WITH_ASM AND CMAKE_ASM_NASM_COMPILER)
+        add_subdirectory(ia32)
+    endif()
+
+    option(WITH_SSE "Enable SSE2 optimizations" ON)
+    check_c_compiler_flag(-msse2 HAVE_MSSE2_FLAG)
+    if(WITH_SSE)
+        add_compile_options(
+            $<$<BOOL:${HAVE_MSSE2_FLAG}>:-msse2>
+            $<$<BOOL:${MSVC}>:/arch:SSE2>)
+    endif()
 endif()
 
+
 set(prefix "${CMAKE_INSTALL_PREFIX}")
 set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
 set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")