Enable WebRTC demo application on x86 Android

Steps to build the demo application for x86 Android:
source build/android/envsetup.sh --target-arch=x86
gclient runhooks
ninja -C out/Debug
cd webrtc/video_engine/test/android
ndk-build APP_ABI=x86
ant debug

R=fischman@webrtc.org, leozwang@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1478004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4053 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org 2013-05-17 05:41:07 +00:00
parent 8630cfe016
commit e874a8f24b
4 changed files with 111 additions and 38 deletions

View File

@ -24,7 +24,8 @@
'inputs' : [],
'outputs': ['<(webrtc_root)'],
'action': ['python',
'<(webrtc_root)/video_engine/test/android/build_demo.py'],
'<(webrtc_root)/video_engine/test/android/build_demo.py',
'--arch', '<(target_arch)'],
},
],
},

View File

@ -37,21 +37,34 @@ _ROOT_DIR = os.path.abspath(os.path.join(_CURRENT_DIR, '..', '..', '..', '..'))
_ANDROID_ENV_SCRIPT = os.path.join(_ROOT_DIR, 'build', 'android', 'envsetup.sh')
def main():
parser = optparse.OptionParser('usage: %prog -t <target>')
parser = optparse.OptionParser('usage: %prog -t <target> -a <arch>')
parser.add_option('-t', '--target', default='debug',
help='Compile target (debug/release). Default: %default')
parser.add_option('-a', '--arch', type='choice', choices=['arm', 'ia32'],
help='Compile arch (arm/ia32).')
# Build and factory properties are currently unused but are required to avoid
# errors when the script is executed by the buildbots.
parser.add_option('--build-properties', help='Build properties (unused)')
parser.add_option('--factory-properties', help='Factory properties (unused)')
options, _args = parser.parse_args()
if options.arch.lower() == 'ia32':
target_arch = 'x86'
app_abi = 'x86'
elif options.arch.lower() == 'arm':
target_arch = 'arm'
app_abi = 'armeabi-v7a'
else:
print 'Unsupported target platform'
raise
def RunInAndroidEnv(cmd):
return 'source %s && %s' % (_ANDROID_ENV_SCRIPT, cmd)
return 'source %s --target-arch=%s && %s' % (_ANDROID_ENV_SCRIPT,
target_arch, cmd)
print '@@@BUILD_STEP ndk-build@@@'
cmd = RunInAndroidEnv('ndk-build')
cmd = RunInAndroidEnv('ndk-build APP_ABI=%s' % app_abi)
print cmd
try:
subprocess.check_call(cmd, cwd=_CURRENT_DIR, executable='/bin/bash',

View File

@ -63,12 +63,6 @@ LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libaudio_processing.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_processing_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libaudio_processing_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libPCM16B
LOCAL_SRC_FILES := \
@ -117,12 +111,6 @@ LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libiSACFix.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libisac_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libisac_neon.a
include $(PREBUILT_STATIC_LIBRARY)
# Remove the following file existense check when opus is always enabled.
ifneq ($(wildcard jni/$(MY_LIBS_PATH)/libopus.a),)
include $(CLEAR_VARS)
@ -146,12 +134,6 @@ LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libcommon_audio.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcommon_audio_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libcommon_audio_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libbitrate_controller
LOCAL_SRC_FILES := \
@ -266,6 +248,82 @@ LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libvpx.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpaced_sender
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libpaced_sender.a
include $(PREBUILT_STATIC_LIBRARY)
ifeq ($(APP_ABI), x86) # x86 Android specific
include $(CLEAR_VARS)
LOCAL_MODULE := libvideo_processing_sse2
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libvideo_processing_sse2.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_processing_sse2
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libaudio_processing_sse2.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcommon_audio_sse2
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libcommon_audio_sse2.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx_intrinsics_mmx
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libvpx_intrinsics_mmx.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx_intrinsics_sse2
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libvpx_intrinsics_sse2.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx_intrinsics_ssse3
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libvpx_intrinsics_ssse3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx_intrinsics_sse4_1
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libvpx_intrinsics_sse4_1.a
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PLATFORM_SPECIFIC_STATIC_LIBRARIES := \
libvideo_processing_sse2 \
libaudio_processing_sse2 \
libcommon_audio_sse2 \
libvpx_intrinsics_mmx \
libvpx_intrinsics_sse2 \
libvpx_intrinsics_ssse3 \
libvpx_intrinsics_sse4_1
else # arm Android specific
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_processing_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libaudio_processing_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libisac_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libisac_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcommon_audio_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libcommon_audio_neon.a
include $(PREBUILT_STATIC_LIBRARY)
# TODO(leozwang): Upstream required Android changes to libvpx.gyp to enable
# this optimization.
#include $(CLEAR_VARS)
@ -274,11 +332,12 @@ include $(PREBUILT_STATIC_LIBRARY)
# $(MY_LIBS_PATH)/libvpx_arm_neon.a
#include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpaced_sender
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libpaced_sender.a
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PLATFORM_SPECIFIC_STATIC_LIBRARIES := \
libaudio_processing_neon \
libisac_neon \
libcommon_audio_neon \
libvpx_arm_neon
endif
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
@ -304,7 +363,10 @@ LOCAL_LDLIBS := \
-lGLESv2 \
-lOpenSLES \
LOCAL_STATIC_LIBRARIES := \
# TODO(yujie.mao): Replace LOCAL_WHOLE_STATIC_LIBRARIES to
# LOCAL_STATIC_LIBRARIES after removing the circular dependencies between
# libvpx.a and libvpx_intrinsics_[mmx,sse2,ssse3,sse4_1].a
LOCAL_WHOLE_STATIC_LIBRARIES := \
libvoice_engine_core \
libvideo_engine_core \
libvideo_processing \
@ -313,7 +375,6 @@ LOCAL_STATIC_LIBRARIES := \
libvideo_capture_module \
libaudio_coding_module \
libaudio_processing \
libaudio_processing_neon \
libPCM16B \
libCNG \
libNetEq \
@ -322,11 +383,9 @@ LOCAL_STATIC_LIBRARIES := \
libG711 \
libiLBC \
libiSACFix \
libisac_neon \
libwebrtc_opus \
libopus \
libcommon_audio \
libcommon_audio_neon \
libbitrate_controller \
libcommon_video \
libcpu_features_android \
@ -346,9 +405,9 @@ LOCAL_STATIC_LIBRARIES := \
libjpeg_turbo \
libaudioproc_debug_proto \
libprotobuf_lite \
libvpx \
libvpx_arm_neon \
libpaced_sender \
libvpx \
$(LOCAL_PLATFORM_SPECIFIC_STATIC_LIBRARIES) \
$(MY_SUPPLEMENTAL_LIBS)
include $(BUILD_SHARED_LIBRARY)

View File

@ -6,6 +6,6 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# Build both ARMv5TE and ARMv7-A machine code.
APP_ABI := armeabi-v7a #armeabi armeabi-v7a x86
# Build both ARMv7-A and x86 machine code.
APP_ABI := armeabi-v7a x86
APP_STL := stlport_static