mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
cmake: skip simd compiler option test for MSVC
This commit is contained in:
parent
699c1538fb
commit
9996de02b3
@ -157,7 +157,34 @@ message("CMAKE_SYSTEM_PROCESSOR=<${CMAKE_SYSTEM_PROCESSOR}>")
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
|
||||
|
||||
set(HAVE_NEON FALSE)
|
||||
if(MSVC)
|
||||
set(HAVE_AVX ON)
|
||||
set(AVX_COMPILE_FLAGS "/arch:AVX")
|
||||
add_definitions("-DHAVE_AVX")
|
||||
|
||||
set(HAVE_AVX2 ON)
|
||||
set(AVX2_COMPILE_FLAGS "/arch:AVX2")
|
||||
add_definitions("-DHAVE_AVX2")
|
||||
|
||||
set(HAVE_FMA ON)
|
||||
set(FMA_COMPILE_FLAGS "-D__FMA__")
|
||||
add_definitions("-DHAVE_FMA")
|
||||
|
||||
set(HAVE_SSE4_1 ON)
|
||||
set(SSE4_1_COMPILE_FLAGS "-D__SSE4_1__")
|
||||
add_definitions("-DHAVE_SSE4_1")
|
||||
# clang with MSVC compatibility
|
||||
if(CLANG)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -Wno-microsoft-unqualified-friend")
|
||||
if(HAVE_FMA)
|
||||
set(FMA_COMPILE_FLAGS "-mfma ${FMA_COMPILE_FLAGS}")
|
||||
endif(HAVE_FMA)
|
||||
if(HAVE_SSE4_1)
|
||||
set(SSE4_1_COMPILE_FLAGS "-msse4.1 ${SSE4_1_COMPILE_FLAGS}")
|
||||
endif(HAVE_SSE4_1)
|
||||
endif(CLANG)
|
||||
else() # if not MSVC
|
||||
check_cxx_compiler_flag("-mavx" HAVE_AVX)
|
||||
if(HAVE_AVX)
|
||||
set(AVX_COMPILE_FLAGS "-mavx")
|
||||
@ -181,39 +208,6 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
|
||||
set(SSE4_1_COMPILE_FLAGS "-msse4.1")
|
||||
add_definitions("-DHAVE_SSE4_1")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(NOT HAVE_AVX)
|
||||
set(AVX_COMPILE_FLAGS "/arch:AVX")
|
||||
set(HAVE_AVX ON)
|
||||
add_definitions("-DHAVE_AVX")
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_AVX2)
|
||||
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)
|
||||
set(SSE4_1_COMPILE_FLAGS "-D__SSE4_1__")
|
||||
set(HAVE_SSE4_1 ON)
|
||||
add_definitions("-DHAVE_SSE4_1")
|
||||
endif()
|
||||
# clang with MSVC compatibility
|
||||
if(CLANG)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -Wno-microsoft-unqualified-friend")
|
||||
if(HAVE_FMA)
|
||||
set(FMA_COMPILE_FLAGS "-mfma ${FMA_COMPILE_FLAGS}")
|
||||
endif(HAVE_FMA)
|
||||
if(HAVE_SSE4_1)
|
||||
set(SSE4_1_COMPILE_FLAGS "-msse4.1 ${SSE4_1_COMPILE_FLAGS}")
|
||||
endif(HAVE_SSE4_1)
|
||||
endif(CLANG)
|
||||
endif(MSVC)
|
||||
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64.*|AARCH64.*")
|
||||
|
Loading…
Reference in New Issue
Block a user