OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 |
| 3 # Copyright 2014 Google Inc. |
| 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. |
| 7 |
| 8 """ |
| 9 Modified version of gyp_skia, used by gyp_to_android.py to generate Android.mk |
| 10 """ |
| 11 |
| 12 import os |
| 13 import sys |
| 14 |
| 15 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 16 |
| 17 # Unlike gyp_skia, this file is nested deep inside Skia. Find Skia's trunk dir. |
| 18 # This line depends on the fact that the script is three levels deep |
| 19 # (specifically, it is in platform_tools/android/bin). |
| 20 SKIA_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir, |
| 21 os.pardir)) |
| 22 dir_contents = os.listdir(SKIA_DIR) |
| 23 assert 'third_party' in dir_contents and 'gyp' in dir_contents |
| 24 |
| 25 # Directory within which we can find the gyp source. |
| 26 GYP_SOURCE_DIR = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp') |
| 27 |
| 28 # Ensure we import our current gyp source's module, not any version |
| 29 # pre-installed in your PYTHONPATH. |
| 30 sys.path.insert(0, os.path.join(GYP_SOURCE_DIR, 'pylib')) |
| 31 |
| 32 import gyp |
| 33 |
| 34 def main(target_dir, target_file, skia_arch_type, have_neon): |
| 35 """ |
| 36 Create gypd files based on target_file. |
| 37 @param target_dir Directory containing all gyp files, including common.gypi |
| 38 @param target_file Gyp file to start on. Other files within target_dir will |
| 39 be read if target_file depends on them. |
| 40 @param skia_arch_type Target architecture to pass to gyp. |
| 41 @param have_neon Whether to generate files including neon optimizations. |
| 42 Only meaningful if skia_arch_type is 'arm'. |
| 43 """ |
| 44 # Set GYP_DEFINES for building for the android framework. |
| 45 gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s ' |
| 46 % skia_arch_type) |
| 47 if skia_arch_type == 'arm': |
| 48 # Always use thumb and version 7 for arm |
| 49 gyp_defines += 'arm_thumb=1 arm_version=7 ' |
| 50 if have_neon: |
| 51 gyp_defines += 'arm_neon=1 ' |
| 52 else: |
| 53 gyp_defines += 'arm_neon=0 ' |
| 54 |
| 55 os.environ['GYP_DEFINES'] = gyp_defines |
| 56 |
| 57 args = [] |
| 58 args.extend(['--depth', '.']) |
| 59 args.extend([os.path.join(target_dir, target_file)]) |
| 60 # Common conditions |
| 61 args.extend(['-I', os.path.join(target_dir, 'common.gypi')]) |
| 62 # Use the debugging format. We'll use these to create one master make file. |
| 63 args.extend(['-f', 'gypd']) |
| 64 |
| 65 # Off we go... |
| 66 return gyp.main(args) |
OLD | NEW |