From: Johann Date: Fri, 2 May 2014 14:18:00 +0000 (-0700) Subject: Android NDK support for x86 and mips X-Git-Tag: v1.4.0~1650^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d54e0f0935f9130de457ea74c7bad30bc0d4a78;p=libvpx Android NDK support for x86 and mips This does not do the full toolchain setup like the arm builds. It only allows for ndk-builds. See the instructions in tests/android/README or the webm jnin bindings project: https://chromium.googlesource.com/webm/bindings/+/master/JNI/README.Android Because this support is not quite polished, the build targets must be forced. Please use --force-target=x86-android-gcc --disable-ssse3 --disable-sse4_1 --disable-avx2 --force-target-mips-android-gcc Change-Id: Ie2b6623f71ac816e3965c39bf97097e9d30b6e94 --- diff --git a/build/make/Android.mk b/build/make/Android.mk index 48a0dd79c..369c2a568 100644 --- a/build/make/Android.mk +++ b/build/make/Android.mk @@ -53,12 +53,20 @@ LIBVPX_PATH := $(LOCAL_PATH)/libvpx ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL) -# Makefiles created by the libvpx configure process -# This will need to be fixed to handle x86. +# Use the makefiles generated by upstream configure to determine which files to +# build. Also set any architecture-specific flags. ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) include $(CONFIG_DIR)libs-armv7-android-gcc.mk -else + LOCAL_ARM_MODE := arm +else ifeq ($(TARGET_ARCH_ABI),armeabi) include $(CONFIG_DIR)libs-armv5te-android-gcc.mk + LOCAL_ARM_MODE := arm +else ifeq ($(TARGET_ARCH_ABI),x86) + include $(CONFIG_DIR)libs-x86-android-gcc.mk +else ifeq ($(TARGET_ARCH_ABI),mips) + include $(CONFIG_DIR)libs-mips-android-gcc.mk +else + $(error Not a supported TARGET_ARCH_ABI: $(TARGET_ARCH_ABI)) endif # Rule that is normally in Makefile created by libvpx @@ -72,10 +80,13 @@ SRC_PATH_BARE := $(LIBVPX_PATH) # Include the list of files to be built include $(LIBVPX_PATH)/libs.mk -# Want arm, not thumb, optimized -LOCAL_ARM_MODE := arm +# Optimise the code. May want to revisit this setting in the future. LOCAL_CFLAGS := -O3 +# For x86, include the source code in the search path so it will find files +# like x86inc.asm and x86_abi_support.asm +LOCAL_ASMFLAGS := -I$(LIBVPX_PATH) + # ----------------------------------------------------------------------------- # Template : asm_offsets_template # Arguments : 1: assembly offsets file to be created @@ -109,7 +120,7 @@ $(1) : $$(_OBJ) $(2) @grep $(OFFSET_PATTERN) $$< | tr -d '\#' | $(CONFIG_DIR)$(ASM_CONVERSION) > $$@ endef -# Use ads2gas script to convert from RVCT format to GAS format. This passes +# Use ads2gas script to convert from RVCT format to GAS format. This # puts the processed file under $(ASM_CNV_PATH). Local clean rule # to handle removing these ifeq ($(CONFIG_VP8_ENCODER), yes) @@ -146,18 +157,26 @@ LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file).neon) # Pull out assembly files, splitting NEON from the rest. This is # done to specify that the NEON assembly files use NEON assembler flags. -CODEC_SRCS_ASM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE)) -CODEC_SRCS_ASM = $(foreach v, \ - $(CODEC_SRCS_ASM_ALL), \ - $(if $(findstring neon,$(v)),,$(v))) +# x86 assembly matches %.asm, arm matches %.asm.s + +# x86: + +CODEC_SRCS_ASM_X86 = $(filter %.asm, $(CODEC_SRCS_UNIQUE)) +LOCAL_SRC_FILES += $(foreach file, $(CODEC_SRCS_ASM_X86), libvpx/$(file)) + +# arm: +CODEC_SRCS_ASM_ARM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE)) +CODEC_SRCS_ASM_ARM = $(foreach v, \ + $(CODEC_SRCS_ASM_ARM_ALL), \ + $(if $(findstring neon,$(v)),,$(v))) CODEC_SRCS_ASM_ADS2GAS = $(patsubst %.s, \ $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \ - $(CODEC_SRCS_ASM)) + $(CODEC_SRCS_ASM_ARM)) LOCAL_SRC_FILES += $(CODEC_SRCS_ASM_ADS2GAS) ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) CODEC_SRCS_ASM_NEON = $(foreach v, \ - $(CODEC_SRCS_ASM_ALL),\ + $(CODEC_SRCS_ASM_ARM_ALL),\ $(if $(findstring neon,$(v)),$(v),)) CODEC_SRCS_ASM_NEON_ADS2GAS = $(patsubst %.s, \ $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \ @@ -189,6 +208,10 @@ $(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vp9_rtcd.h endif $(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_scale_rtcd.h +ifeq ($(TARGET_ARCH_ABI),x86) +$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_config.asm +endif + .PHONY: clean clean: @echo "Clean: ads2gas files [$(TARGET_ARCH_ABI)]" diff --git a/test/android/README b/test/android/README index 6840d911c..4a1adcf7f 100644 --- a/test/android/README +++ b/test/android/README @@ -3,7 +3,7 @@ Android.mk will build vpx unittests on android. ./libvpx/configure --target=armv7-android-gcc --enable-external-build \ --enable-postproc --disable-install-srcs --enable-multi-res-encoding \ --enable-temporal-denoising --disable-unit-tests --disable-install-docs \ - --disable-examples --disable-runtime-cpu-detect --sdk=$NDK + --disable-examples --disable-runtime-cpu-detect --sdk-path=$NDK 2) From the parent directory, invoke ndk-build: NDK_PROJECT_PATH=. ndk-build APP_BUILD_SCRIPT=./libvpx/test/android/Android.mk \