How to build libvpx for android arm as well as x86?

928 views Asked by At

I have been building our Android app for armeabi-v7a. Now, to add support for x86 as well, I extended Application.mk:

APP_ABI := armeabi-v7a x86

The first problem I am running into is that libvpx can be configured either for arm or for x86:

$ ./libvpx/configure --target=armv7-android-gcc ...
OR
$ ./libvpx/configure --target=x86-android-gcc

Wondering how to deal with multiple platforms. Does one create two different libvpx directories for two platforms and use if-then-else logic in Android.mk to pick the right directory? Is there a better way?

1

There are 1 answers

0
mstorsjo On

Yes, pretty much. If you store the build product (as produced by make install) in parallel directories named according to the android ABIs, you can simplify using it from an Android.mk file like this:

include $(CLEAR_VARS)
LOCAL_MODULE    := libvpx
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libvpx/$(TARGET_ARCH_ABI)/include
LOCAL_SRC_FILES := libvpx/$(TARGET_ARCH_ABI)/lib/libvpx.a
include $(PREBUILT_STATIC_LIBRARY)

Since the public headers probably are (should be) free of anything arch specific, you should also be able to share one copy of them instead of having one copy per arch.