shithub: openh264

Download patch

ref: 30c7810cdf880bb4827689f3445b40174c39b26a
parent: 0fc93cd98e8aed9dab06afbe38b2ba9465ad0ac0
author: Martin Storsjö <martin@martin.st>
date: Sat Mar 1 17:20:39 EST 2014

Enable the android runtime CPU feature detection

Build and include the android cpufeatures library in libcommon.

--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -42,7 +42,7 @@
 CXX = $(NDKROOT)/toolchains/$(GCCPATHPREFIX)-$(GCCVERSION)/prebuilt/$(HOSTOS)-$(HOSTARCH)/bin/$(GCCPREFIX)-g++
 CC = $(NDKROOT)/toolchains/$(GCCPATHPREFIX)-$(GCCVERSION)/prebuilt/$(HOSTOS)-$(HOSTARCH)/bin/$(GCCPREFIX)-gcc
 AR = $(NDKROOT)/toolchains/$(GCCPATHPREFIX)-$(GCCVERSION)/prebuilt/$(HOSTOS)-$(HOSTARCH)/bin/$(GCCPREFIX)-ar
-CFLAGS += -DLINUX -fpic --sysroot=$(SYSROOT)
+CFLAGS += -DLINUX -DANDROID_NDK -fpic --sysroot=$(SYSROOT)
 CXXFLAGS += -fno-rtti -fno-exceptions
 LDFLAGS += --sysroot=$(SYSROOT)
 SHLDFLAGS = -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,libwels.so
@@ -63,3 +63,9 @@
 
 encdemo: libraries
 	cd ./codec/build/android/enc && $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI) && android update project -t $(TARGET) -p . && ant debug
+
+COMMON_INCLUDES += -I$(NDKROOT)/sources/android/cpufeatures
+COMMON_OBJS += $(COMMON_SRCDIR)/cpu-features.o
+
+codec/common/cpu-features.o: $(NDKROOT)/sources/android/cpufeatures/cpu-features.c
+	$(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c $(CXX_O) $<