cmake: add NEON compile support

This commit is contained in:
zdenop 2020-06-30 20:57:50 +02:00
parent 30fcec3081
commit 7e8ddfcb63

View File

@ -166,10 +166,18 @@ if (AUTO_OPTIMIZE)
remove_definitions("-D${_flag}")
endforeach(_flag)
endif()
# Compiler specific environments
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CLANG 1)
endif()
CHECK_CXX_COMPILER_FLAG("-mfpu=neon" HAVE_NEON)
if(HAVE_NEON)
set(NEON_COMPILE_FLAGS "-mfpu=neon")
add_definitions("-DHAVE_NEON")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -Og")
elseif(MSVC)
@ -367,6 +375,7 @@ message( STATUS "Vector unit list: ${_enable_vector_unit_list}")
message( STATUS "HAVE_AVX: ${HAVE_AVX}")
message( STATUS "HAVE_AVX2: ${HAVE_AVX2}")
message( STATUS "HAVE_FMA: ${HAVE_FMA}")
message( STATUS "HAVE_NEON: ${HAVE_NEON}")
message( STATUS "HAVE_SSE4_1: ${HAVE_SSE4_1}")
message( STATUS "MARCH_NATIVE_OPT: ${MARCH_NATIVE_OPT}")
message( STATUS "arch_compiler_definition: ${arch_compiler_definition}")
@ -537,6 +546,10 @@ if(HAVE_SSE4_1)
list(APPEND arch_files_opt src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp)
set_source_files_properties(src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp PROPERTIES COMPILE_FLAGS "-msse4.1")
endif(HAVE_SSE4_1)
if(HAVE_NEON)
list(APPEND arch_files_opt src/arch/intsimdmatrixneon.cpp)
set_source_files_properties(src/arch/intsimdmatrixneon.cpp PROPERTIES COMPILE_FLAGS ${NEON_COMPILE_FLAGS})
endif(HAVE_NEON)
set_source_files_properties(${arch_files_opt} PROPERTIES COMPILE_FLAGS "${arch_compiler_definition} ${Vc_CXX_FLAGS}")
file(GLOB tesseract_hdr