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