Android NDK: How to get compiler architecture in Android.mk dynamically

前端 未结 2 910
一生所求
一生所求 2020-12-13 12:50

I\'m trying to configure Android.mk to cross compile native code to support different chipset namely armeabi, mips, and x86. I know I can configure Application.mk in the fol

相关标签:
2条回答
  • 2020-12-13 13:46

    There is TARGET_ARCH variable that holds the value of the current ABI being built. You can use it the following way:

    ifeq ($(TARGET_ARCH),x86)
        LOCAL_CFLAGS   := $(COMMON_FLAGS_LIST)
    else
        LOCAL_CFLAGS   := -mfpu=vfp -mfloat-abi=softfp $(COMMON_FLAGS_LIST)
    endif
    

    If you specify APP_ABI := armeabi-v7a armeabi mips x86 or APP_ABI := all in your Application.mk you will get each and every separate ABI value.

    0 讨论(0)
  • 2020-12-13 13:54

    Check TARGET_ARCH_ABI:

    ifeq($(TARGET_ARCH_ABI), armeabi-v7a)
      # v7a-specific stuff
    endif
    
    0 讨论(0)
提交回复
热议问题