CMakeLists.txt 2.3 KB
Newer Older
1 2 3
if(NOT (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM))
    return()
endif()
T
tensor-tang 已提交
4 5 6 7 8

if(NOT (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM))
  return()
endif()

T
tensor-tang 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
set(HAS_ARM_MATH_LIB_DIR OFF)
# will search name as "libmath_arm.${os}.${abi}.${lang}.a"
if(ARM_MATH_LIB_DIR AND EXISTS "${ARM_MATH_LIB_DIR}")
  set(arm_math_name "")
  if(ARM_TARGET_OS STREQUAL "android")
    if(ARM_TARGET_ARCH_ABI STREQUAL "armv8")
      set(arm_math_name "math_arm.android.armv8")
    elseif(ARM_TARGET_ARCH_ABI STREQUAL "armv7")
      set(arm_math_name "math_arm.android.armv7")
    endif()
  endif()

  if(ARM_TARGET_OS STREQUAL "armlinux" )
    if(ARM_TARGET_ARCH_ABI STREQUAL "armv8")
      set(arm_math_name "math_arm.armlinux.armv8")
    elseif(ARM_TARGET_ARCH_ABI STREQUAL "armv7")
      set(arm_math_name "math_arm.armlinux.armv7")
    endif()
  endif()

  if(ARM_TARGET_LANG STREQUAL "clang")
    set(arm_math_name "${arm_math_name}.clang")
  else()
    set(arm_math_name "${arm_math_name}.gcc")
  endif()

  find_library(math_arm_file ${arm_math_name} ${ARM_MATH_LIB_DIR} NO_DEFAULT_PATH)
  if(math_arm_file)
    add_library(math_arm STATIC IMPORTED GLOBAL)
    set_property(TARGET math_arm PROPERTY IMPORTED_LOCATION ${math_arm_file})
    message(STATUS "ARM math library imported: ${math_arm_file}")
    set(HAS_ARM_MATH_LIB_DIR ON)
  else()
    message(WARNING "Can not find arm math library ${arm_math_name} in ${ARM_MATH_LIB_DIR")
  endif()
endif()


if (NOT HAS_ARM_MATH_LIB_DIR)
  # TODO(xxx): seperate them and do not deps proto, eigen3
  cc_library(math_arm SRCS  
      funcs.cc 
      packed_sgemm.cc 
      softmax.cc 
      scale.cc
      pooling.cc
      elementwise.cc
      concat.cc
      sgemv.cc
      type_trans.cc
      conv_impl.cc
      conv_direct_3x3s1.cc
      conv_direct_3x3s2.cc
      conv_direct.cc
      conv_depthwise_3x3_int7.cc
      conv_depthwise_3x3_int8.cc
      conv_depthwise_5x5s1_int8.cc
      conv_depthwise_3x3p0.cc
      conv_depthwise_3x3p1.cc
      conv_depthwise_5x5s1.cc
      conv_depthwise_5x5s2.cc
      conv_depthwise.cc
      conv_gemmlike.cc
      conv_winograd_3x3.cc
      conv_winograd.cc
      split.cc
      activation.cc
      dropout.cc
      gemm_prepacked_int8.cc
      gemv_arm_int8.cc
      conv3x3s1_direct_int8.cc
      conv3x3s2_direct_int8.cc
81
      DEPS ${lite_kernel_deps} framework_proto_lite)
T
tensor-tang 已提交
82
endif()