1# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2# 3# Use of this source code is governed by a BSD-style license 4# that can be found in the LICENSE file in the root of the source 5# tree. An additional intellectual property rights grant can be found 6# in the file PATENTS. All contributing project authors may 7# be found in the AUTHORS file in the root of the source tree. 8{ 9 'includes': ['build/common.gypi'], 10 'conditions': [ 11 ['OS=="android"', { 12 'targets': [ 13 { 14 'target_name': 'libwebrtcdemo-jni', 15 'type': 'loadable_module', 16 'dependencies': [ 17 '<(DEPTH)/third_party/icu/icu.gyp:icuuc', 18 '<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl', 19 '<(webrtc_root)/modules/modules.gyp:video_render_module_internal_impl', 20 '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default', 21 '<(webrtc_root)/test/test.gyp:channel_transport', 22 '<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core', 23 '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine', 24 ], 25 'sources': [ 26 'examples/android/media_demo/jni/jni_helpers.cc', 27 'examples/android/media_demo/jni/on_load.cc', 28 'examples/android/media_demo/jni/video_engine_jni.cc', 29 'examples/android/media_demo/jni/voice_engine_jni.cc', 30 'examples/android/media_demo/jni/media_codec_video_decoder.cc', 31 ], 32 'link_settings': { 33 'libraries': [ 34 '-llog', 35 '-lGLESv2', 36 '-lOpenSLES', 37 ], 38 } 39 }, 40 { 41 'target_name': 'WebRTCDemo', 42 'type': 'none', 43 'dependencies': [ 44 'libwebrtcdemo-jni', 45 '<(modules_java_gyp_path):*', 46 ], 47 'actions': [ 48 { 49 # TODO(yujie.mao): Convert building of the demo to a proper GYP 50 # target so this action is not needed once chromium's 51 # apk-building machinery can be used. (crbug.com/225101) 52 'action_name': 'build_webrtcdemo_apk', 53 'variables': { 54 'android_webrtc_demo_root': '<(webrtc_root)/examples/android/media_demo', 55 'ant_log': '../../../<(INTERMEDIATE_DIR)/ant.log', # ../../.. to compensate for the cd below. 56 }, 57 'inputs' : [ 58 '<(PRODUCT_DIR)/lib.java/audio_device_module_java.jar', 59 '<(PRODUCT_DIR)/lib.java/video_capture_module_java.jar', 60 '<(PRODUCT_DIR)/lib.java/video_render_module_java.jar', 61 '<(PRODUCT_DIR)/libwebrtcdemo-jni.so', 62 '<!@(find <(android_webrtc_demo_root)/src -name "*.java")', 63 '<!@(find <(android_webrtc_demo_root)/res -type f)', 64 '<(android_webrtc_demo_root)/AndroidManifest.xml', 65 '<(android_webrtc_demo_root)/build.xml', 66 '<(android_webrtc_demo_root)/project.properties', 67 ], 68 'outputs': ['<(PRODUCT_DIR)/WebRTCDemo-debug.apk'], 69 'action': [ 70 'bash', '-ec', 71 'rm -fr <(_outputs) <(android_webrtc_demo_root)/{bin,libs} && ' 72 'mkdir -p <(INTERMEDIATE_DIR) && ' # Must happen _before_ the cd below 73 'mkdir -p <(android_webrtc_demo_root)/libs/<(android_app_abi) && ' 74 'cp <(PRODUCT_DIR)/lib.java/audio_device_module_java.jar <(android_webrtc_demo_root)/libs/ &&' 75 'cp <(PRODUCT_DIR)/lib.java/video_capture_module_java.jar <(android_webrtc_demo_root)/libs/ &&' 76 'cp <(PRODUCT_DIR)/lib.java/video_render_module_java.jar <(android_webrtc_demo_root)/libs/ &&' 77 '<(android_strip) -o <(android_webrtc_demo_root)/libs/<(android_app_abi)/libwebrtcdemo-jni.so <(PRODUCT_DIR)/libwebrtcdemo-jni.so && ' 78 'cd <(android_webrtc_demo_root) && ' 79 '{ ANDROID_SDK_ROOT=<(android_sdk_root) ' 80 'ant debug > <(ant_log) 2>&1 || ' 81 ' { cat <(ant_log) ; exit 1; } } && ' 82 'cd - > /dev/null && ' 83 'cp <(android_webrtc_demo_root)/bin/WebRTCDemo-debug.apk <(_outputs)' 84 ], 85 }, 86 ], 87 }, 88 { 89 'target_name': 'libopensl-demo-jni', 90 'type': 'loadable_module', 91 'dependencies': [ 92 '<(webrtc_root)/modules/modules.gyp:audio_device', 93 ], 94 'sources': [ 95 'examples/android/opensl_loopback/jni/opensl_runner.cc', 96 'examples/android/opensl_loopback/fake_audio_device_buffer.cc', 97 ], 98 'link_settings': { 99 'libraries': [ 100 '-llog', 101 '-lOpenSLES', 102 ], 103 }, 104 }, 105 { 106 'target_name': 'OpenSlDemo', 107 'type': 'none', 108 'dependencies': [ 109 'libopensl-demo-jni', 110 '<(modules_java_gyp_path):*', 111 ], 112 'actions': [ 113 { 114 # TODO(henrik): Convert building of the demo to a proper GYP 115 # target so this action is not needed once chromium's 116 # apk-building machinery can be used. (crbug.com/225101) 117 'action_name': 'build_opensldemo_apk', 118 'variables': { 119 'android_opensl_demo_root': '<(webrtc_root)/examples/android/opensl_loopback', 120 'ant_log': '../../../<(INTERMEDIATE_DIR)/ant.log', # ../../.. to compensate for the cd below. 121 }, 122 'inputs' : [ 123 '<(PRODUCT_DIR)/lib.java/audio_device_module_java.jar', 124 '<(PRODUCT_DIR)/libopensl-demo-jni.so', 125 '<!@(find <(android_opensl_demo_root)/src -name "*.java")', 126 '<!@(find <(android_opensl_demo_root)/res -name "*.xml")', 127 '<!@(find <(android_opensl_demo_root)/res -name "*.png")', 128 '<(android_opensl_demo_root)/AndroidManifest.xml', 129 '<(android_opensl_demo_root)/build.xml', 130 '<(android_opensl_demo_root)/project.properties', 131 ], 132 'outputs': ['<(PRODUCT_DIR)/OpenSlDemo-debug.apk'], 133 'action': [ 134 'bash', '-ec', 135 'rm -fr <(_outputs) <(android_opensl_demo_root)/{bin,libs} && ' 136 'mkdir -p <(android_opensl_demo_root)/libs/<(android_app_abi) && ' 137 'mkdir -p <(INTERMEDIATE_DIR) && ' # Must happen _before_ the cd below 138 '<(android_strip) -o <(android_opensl_demo_root)/libs/<(android_app_abi)/libopensl-demo-jni.so <(PRODUCT_DIR)/libopensl-demo-jni.so && ' 139 'cp <(PRODUCT_DIR)/lib.java/audio_device_module_java.jar <(android_opensl_demo_root)/libs/ &&' 140 'cd <(android_opensl_demo_root) && ' 141 '{ ANDROID_SDK_ROOT=<(android_sdk_root) ' 142 'ant debug > <(ant_log) 2>&1 || ' 143 ' { cat <(ant_log) ; exit 1; } } && ' 144 'cd - > /dev/null && ' 145 'cp <(android_opensl_demo_root)/bin/OpenSlDemo-debug.apk <(_outputs)' 146 ], 147 }, 148 ], 149 }, 150 ], 151 }], 152 ], 153} 154