Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: platform_tools/android/bin/android_framework_gyp.py

Issue 140503007: Scripts to generate Android.mk for framework Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: VarsDict = namedtuple of OrderedSets Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: platform_tools/android/bin/android_framework_gyp.py
diff --git a/platform_tools/android/bin/android_framework_gyp.py b/platform_tools/android/bin/android_framework_gyp.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ce65aec3b74408c0b8211109cd6a6012c3eb2c4
--- /dev/null
+++ b/platform_tools/android/bin/android_framework_gyp.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+# Copyright 2014 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Modified version of gyp_skia, used by gyp_to_android.py to generate Android.mk
+"""
+
+import os
+import sys
+
+SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
+
+# Unlike gyp_skia, this file is nested deep inside Skia. Find Skia's trunk dir.
+# This line depends on the fact that the script is three levels deep
+# (specifically, it is in platform_tools/android/bin).
+SKIA_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
+ os.pardir))
+dir_contents = os.listdir(SKIA_DIR)
+assert 'third_party' in dir_contents and 'gyp' in dir_contents
+
+# Directory within which we can find the gyp source.
+GYP_SOURCE_DIR = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp')
+
+# Ensure we import our current gyp source's module, not any version
+# pre-installed in your PYTHONPATH.
+sys.path.insert(0, os.path.join(GYP_SOURCE_DIR, 'pylib'))
+
+import gyp
+
+def main(target_dir, target_file, skia_arch_type, have_neon):
+ """
+ Create gypd files based on target_file.
+ @param target_dir Directory containing all gyp files, including common.gypi
+ @param target_file Gyp file to start on. Other files within target_dir will
+ be read if target_file depends on them.
+ @param skia_arch_type Target architecture to pass to gyp.
+ @param have_neon Whether to generate files including neon optimizations.
+ Only meaningful if skia_arch_type is 'arm'.
+ """
+ # Set GYP_DEFINES for building for the android framework.
+ gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s '
+ % skia_arch_type)
+ if skia_arch_type == 'arm':
+ # Always use thumb and version 7 for arm
+ gyp_defines += 'arm_thumb=1 arm_version=7 '
+ if have_neon:
+ gyp_defines += 'arm_neon=1 '
+ else:
+ gyp_defines += 'arm_neon=0 '
+
+ os.environ['GYP_DEFINES'] = gyp_defines
+
+ args = []
+ args.extend(['--depth', '.'])
+ args.extend([os.path.join(target_dir, target_file)])
+ # Common conditions
+ args.extend(['-I', os.path.join(target_dir, 'common.gypi')])
+ # Use the debugging format. We'll use these to create one master make file.
+ args.extend(['-f', 'gypd'])
+
+ # Off we go...
+ return gyp.main(args)

Powered by Google App Engine
This is Rietveld 408576698