Merge pull request #3052 from stweil/msvc

Fix cmake build for MSVC
This commit is contained in:
zdenop 2020-07-03 21:09:52 +02:00 committed by GitHub
commit 36985fcc03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,43 +198,24 @@ endif(NOT APPLE)
if(MSVC)
if(NOT HAVE_AVX)
CHECK_CXX_COMPILER_FLAG("/arch:AVX" HAVE_AVX_MSVC)
if(HAVE_AVX_MSVC)
set(AVX_COMPILE_FLAGS "/arch:AVX")
set(HAVE_AVX ON)
add_definitions("-DHAVE_AVX")
endif()
set(AVX_COMPILE_FLAGS "/arch:AVX")
set(HAVE_AVX ON)
add_definitions("-DHAVE_AVX")
endif()
if(NOT HAVE_AVX2)
CHECK_CXX_COMPILER_FLAG("/arch:AVX2" HAVE_AVX2_MSVC)
if(HAVE_AVX2_MSVC)
set(AVX2_COMPILE_FLAGS "/arch:AVX2")
set(HAVE_AVX2 ON)
add_definitions("-DHAVE_AVX2")
endif()
endif()
if(NOT HAVE_FMA)
CHECK_CXX_COMPILER_FLAG("/arch:FMA" HAVE_FMA_MSVC)
if(HAVE_FMA_MSVC)
set(FMA_COMPILE_FLAGS "/arch:FMA -D__FMA__")
set(HAVE_FMA ON)
add_definitions("-DHAVE_FMA")
endif()
else() # clanc-cl / MSVC does not define __FMA__
set(FMA_COMPILE_FLAGS "${FMA_COMPILE_FLAGS} -D__FMA__")
set(AVX2_COMPILE_FLAGS "/arch:AVX2")
set(HAVE_AVX2 ON)
add_definitions("-DHAVE_AVX2")
set(FMA_COMPILE_FLAGS "-D__FMA__")
set(HAVE_FMA ON)
add_definitions("-DHAVE_FMA")
endif()
if(NOT HAVE_SSE4_1)
CHECK_CXX_COMPILER_FLAG("/arch:SSE4.1" HAVE_SSE4_1_MSVC)
if(HAVE_SSE4_1_MSVC)
set(SSE4_1_COMPILE_FLAGS "/arch:SSE4.1 -D__SSE4_1__")
set(HAVE_SSE4_1 ON)
add_definitions("-DHAVE_SSE4_1")
endif()
else() # clanc-cl / MSVC does not define __SSE4_1__
set(SSE4_1_COMPILE_FLAGS "${SSE4_1_COMPILE_FLAGS} -D__SSE4_1__")
set(SSE4_1_COMPILE_FLAGS "-D__SSE4_1__")
set(HAVE_SSE4_1 ON)
add_definitions("-DHAVE_SSE4_1")
endif()
endif(MSVC)