mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
cmake: skip simd compiler option test for MSVC
This commit is contained in:
parent
699c1538fb
commit
9996de02b3
@ -157,52 +157,22 @@ message("CMAKE_SYSTEM_PROCESSOR=<${CMAKE_SYSTEM_PROCESSOR}>")
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
|
||||
|
||||
set(HAVE_NEON FALSE)
|
||||
|
||||
check_cxx_compiler_flag("-mavx" HAVE_AVX)
|
||||
if(HAVE_AVX)
|
||||
set(AVX_COMPILE_FLAGS "-mavx")
|
||||
add_definitions("-DHAVE_AVX")
|
||||
endif(HAVE_AVX)
|
||||
|
||||
check_cxx_compiler_flag("-mavx2" HAVE_AVX2)
|
||||
if(HAVE_AVX2)
|
||||
set(AVX2_COMPILE_FLAGS "-mavx2")
|
||||
add_definitions("-DHAVE_AVX2")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("-mfma" HAVE_FMA)
|
||||
if(HAVE_FMA)
|
||||
set(FMA_COMPILE_FLAGS "-mfma")
|
||||
add_definitions("-DHAVE_FMA")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("-msse4.1" HAVE_SSE4_1)
|
||||
if(HAVE_SSE4_1)
|
||||
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()
|
||||
set(HAVE_AVX ON)
|
||||
set(AVX_COMPILE_FLAGS "/arch:AVX")
|
||||
add_definitions("-DHAVE_AVX")
|
||||
|
||||
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()
|
||||
set(HAVE_AVX2 ON)
|
||||
set(AVX2_COMPILE_FLAGS "/arch:AVX2")
|
||||
add_definitions("-DHAVE_AVX2")
|
||||
|
||||
if(NOT HAVE_SSE4_1)
|
||||
set(SSE4_1_COMPILE_FLAGS "-D__SSE4_1__")
|
||||
set(HAVE_SSE4_1 ON)
|
||||
add_definitions("-DHAVE_SSE4_1")
|
||||
endif()
|
||||
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
|
||||
@ -214,6 +184,30 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
|
||||
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")
|
||||
add_definitions("-DHAVE_AVX")
|
||||
endif(HAVE_AVX)
|
||||
|
||||
check_cxx_compiler_flag("-mavx2" HAVE_AVX2)
|
||||
if(HAVE_AVX2)
|
||||
set(AVX2_COMPILE_FLAGS "-mavx2")
|
||||
add_definitions("-DHAVE_AVX2")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("-mfma" HAVE_FMA)
|
||||
if(HAVE_FMA)
|
||||
set(FMA_COMPILE_FLAGS "-mfma")
|
||||
add_definitions("-DHAVE_FMA")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("-msse4.1" HAVE_SSE4_1)
|
||||
if(HAVE_SSE4_1)
|
||||
set(SSE4_1_COMPILE_FLAGS "-msse4.1")
|
||||
add_definitions("-DHAVE_SSE4_1")
|
||||
endif()
|
||||
endif(MSVC)
|
||||
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64.*|AARCH64.*")
|
||||
|
Loading…
Reference in New Issue
Block a user