Merge pull request #321 from licaiguo/add-android-target-option

Add android target option
This commit is contained in:
volvet 2014-02-20 14:40:27 +08:00
commit ab2e5fe207
4 changed files with 15 additions and 35 deletions

View File

@ -59,11 +59,12 @@ To build for android platform, You need to install android sdk and ndk. You also
The codec and demo can be built by
'make OS=android NDKROOT=**ANDROID_NDK**'
'make OS=android NDKROOT=**ANDROID_NDK** TARGET= **ANDROID_TARGET**'
You can also set ARCH, APILEVEL, GCCVERSION according to your device and NDK version.
Valid **ANDROID_TARGET** can be found in **ANDROID_SDK**/platforms, such as android-12.
You can also set ARCH, NDKLEVEL, GCCVERSION according to your device and NDK version.
ARCH specifies the architecture of android device. Currently only arm and x86 are supported, the default is arm.
APILEVEL specifies android api level, the api level can be 12-19, the default is 19.
NDKLEVEL specifies android api level, the api level can be 12-19, the default is 12.
GCCVERSION specifies which gcc in NDK is used, the default is 4.8.
For Windows Builds

View File

@ -2,7 +2,7 @@ USE_ASM = No
ARCH = arm
SHAREDLIBSUFFIX = so
GCCVERSION = 4.8
APILEVEL = 19
NDKLEVEL = 12
HOSTOS = $(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
HOSTARCH = $(shell uname -m)
ifeq ($(ARCH), arm)
@ -25,7 +25,14 @@ ifeq (Yes, $(USE_ASM))
endif
endif
SYSROOT = $(NDKROOT)/platforms/android-$(APILEVEL)/arch-$(ARCH)
ifndef NDKROOT
$(error NDKROOT is not set)
endif
ifndef TARGET
$(error TARGET is not set)
endif
SYSROOT = $(NDKROOT)/platforms/android-$(NDKLEVEL)/arch-$(ARCH)
CXX = $(NDKROOT)/toolchains/$(GCCPATHPREFIX)-$(GCCVERSION)/prebuilt/$(HOSTOS)-$(HOSTARCH)/bin/$(GCCPREFIX)-g++
CFLAGS += -DLINUX -fpic --sysroot=$(SYSROOT) -fno-rtti -fno-exceptions
LDFLAGS += --sysroot=$(SYSROOT) -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,libwels.so
@ -34,7 +41,7 @@ LDFLAGS += --sysroot=$(SYSROOT) -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,rel
binaries : decdemo encdemo
decdemo: libraries
sh -c 'cd ./codec/build/android/dec/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -p . ; ant debug; cd ../../../..'
sh -c 'cd ./codec/build/android/dec/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -t $(TARGET) -p . ; ant debug; cd ../../../..'
encdemo: libraries
sh -c 'cd ./codec/build/android/enc/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -p . ; ant debug; cd ../../../..'
sh -c 'cd ./codec/build/android/enc/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -t $(TARGET) -p . ; ant debug; cd ../../../..'

View File

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-12

View File

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-12