mirror of https://github.com/alibaba/MNN.git
51 lines
2.1 KiB
CMake
51 lines
2.1 KiB
CMake
IF(NOT DEFINED ARCHS)
|
|
set(ARCHS ${CMAKE_SYSTEM_PROCESSOR})
|
|
ENDIF()
|
|
FILE(GLOB MNN_AArch32_SRC ${CMAKE_CURRENT_LIST_DIR}/arm32/*.[sS])
|
|
FILE(GLOB MNN_AArch64_SRC ${CMAKE_CURRENT_LIST_DIR}/arm64/*.[sS])
|
|
|
|
FILE(GLOB MNN_NEON_SRC ${CMAKE_CURRENT_LIST_DIR}/CommonOptFunctionNeon.cpp)
|
|
if (MNN_SUPPORT_BF16)
|
|
FILE(GLOB MNN_NEON_SRC ${MNN_NEON_SRC} ${CMAKE_CURRENT_LIST_DIR}/CommonNeonBF16.cpp)
|
|
else()
|
|
LIST(FILTER MNN_AArch32_SRC EXCLUDE REGEX ".*BF16.*")
|
|
LIST(FILTER MNN_AArch64_SRC EXCLUDE REGEX ".*BF16.*")
|
|
endif()
|
|
|
|
# remove the armv82 extension assemblies file
|
|
if(NOT MNN_ARM82)
|
|
list(REMOVE_ITEM MNN_AArch64_SRC ${CMAKE_CURRENT_LIST_DIR}/arm64/MNNGemmInt8AddBiasScale_ARMV82_Unit.S)
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^armv7" OR ARCHS MATCHES "^armv7(;armv7s)?")
|
|
message(STATUS "Enabling AArch32 Assemblies")
|
|
add_library(MNNARM32 OBJECT ${MNN_AArch32_SRC} ${MNN_NEON_SRC})
|
|
target_include_directories(MNNARM32 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/)
|
|
list(APPEND MNN_OBJECTS_TO_LINK $<TARGET_OBJECTS:MNNARM32>)
|
|
list(APPEND MNN_TARGETS MNNARM32)
|
|
add_definitions(-DMNN_USE_NEON)
|
|
target_compile_options(MNNARM32 PRIVATE -D__arm__)
|
|
if (MNN_SUPPORT_BF16)
|
|
target_compile_options(MNNARM32 PRIVATE -DMNN_SUPPORT_BF16)
|
|
endif()
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64" OR ARCHS STREQUAL "arm64")
|
|
message(STATUS "Enabling AArch64 Assemblies")
|
|
add_library(MNNARM64 OBJECT ${MNN_AArch64_SRC} ${MNN_NEON_SRC})
|
|
target_include_directories(MNNARM64 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/)
|
|
list(APPEND MNN_OBJECTS_TO_LINK $<TARGET_OBJECTS:MNNARM64>)
|
|
list(APPEND MNN_TARGETS MNNARM64)
|
|
add_definitions(-DMNN_USE_NEON)
|
|
target_compile_options(MNNARM64 PRIVATE -D__aarch64__)
|
|
if (MNN_SUPPORT_BF16)
|
|
target_compile_options(MNNARM64 PRIVATE -DMNN_SUPPORT_BF16)
|
|
endif()
|
|
|
|
if(MNN_ARM82)
|
|
message(STATUS "Enable INT8 SDOT")
|
|
target_compile_options(MNNARM64 PRIVATE -march=armv8.2-a+dotprod -DENABLE_ARMV82)
|
|
endif()
|
|
|
|
else()
|
|
# Building fat binary requires multiple seperate builds and lipo-by-hand under CMake's design
|
|
endif()
|