mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
fix clang cmake build on windows
This commit is contained in:
parent
91b2b4f4a0
commit
53b8cd04ab
@ -132,7 +132,11 @@ endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -march=native -mtune=native")
|
||||
set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -march=native")
|
||||
if(NOT CLANG AND MSVC)
|
||||
# clang-cl does not know this argument
|
||||
set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -mtune=native")
|
||||
endif()
|
||||
set(MARCH_NATIVE_OPT ON)
|
||||
endif()
|
||||
|
||||
@ -208,6 +212,16 @@ if(MSVC)
|
||||
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)
|
||||
|
||||
endif(AARCH64)
|
||||
@ -230,6 +244,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -Og")
|
||||
elseif(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) # strdup
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
|
||||
if (NOT CLANG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
|
Loading…
Reference in New Issue
Block a user