diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-04 14:50:20 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-04 14:50:20 +0000 |
commit | d59abfb4b2af3113507baa081429a1bd9e27e420 (patch) | |
tree | bc03c40119777b184d95c09d4db04698ea6ad4e1 | |
parent | 24f078203c3c0ba29955bc95791eaaf6a5b2107c (diff) | |
download | gyp-d59abfb4b2af3113507baa081429a1bd9e27e420.tar.gz |
Gyp file changes for the android framework.
Split off from https://codereview.chromium.org/140503007/.
The eventual goal is to create our Android.mk from gyp. This patch
adds an option for skia_android_framework with the right settings.
The follow-up (https://codereview.chromium.org/140503007/) will
use scripts to create the final makefile.
gyp/android_deps.gyp:
Use different dependencies for the framework than for building Skia
normally.
gyp/android_framework_lib.gyp:
Like skia_lib, specifies the minimum needed for building Skia, in this
case for the framework.
gyp/common_conditions.gypi:
Add settings specific to skia_android_framework. In some cases this
means turning off flags and defines.
gyp/common.gypi
Turn off SK_DEBUG and SK_DEVELOPER when building for the framework.
This allows the framework to create a single makefile which can be
modified to add SK_DEBUG and SK_DEVELOPER as desired.
gyp/common_variables.gypi:
Add skia_android_framework.
gyp/core.gyp:
Don't depend on cpufeatures, and add the cutils library for
skia_android_framework.
gyp/freetype.gyp:
skia_android_framework-specific options:
Don't include freetype_static as a dependency.
Include the proper folders.
Include the android library.
gyp/images.gyp:
Don't export libjpeg as a dependency for targets that include images
for the framework.
Also reorder image decoders to match the Android order, leaving our
most commonly used ones last (and therefore first in the chain for
trying them).
gyp/libwebp.gyp:
Use the system webp when building for the Android framework. Specify
the correct settings for the framework.
gyp/opts.gyp:
Specify a default set of files to compile when there are no possible
optimizations.
gyp/pdf.gyp:
Add dependencies for Android framework.
gyp/zlib.gyp:
Include the zlib folder, and undefine SK_ZLIB_INCLUDE.
BUG=skia:1975
R=djsollen@google.com
Review URL: https://codereview.chromium.org/153093003
git-svn-id: http://skia.googlecode.com/svn/trunk/gyp@13298 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | android_deps.gyp | 65 | ||||
-rw-r--r-- | android_framework_lib.gyp | 20 | ||||
-rw-r--r-- | common.gypi | 43 | ||||
-rw-r--r-- | common_conditions.gypi | 54 | ||||
-rw-r--r-- | common_variables.gypi | 14 | ||||
-rw-r--r-- | core.gyp | 6 | ||||
-rw-r--r-- | freetype.gyp | 16 | ||||
-rw-r--r-- | images.gyp | 30 | ||||
-rw-r--r-- | libwebp.gyp | 42 | ||||
-rw-r--r-- | opts.gyp | 5 | ||||
-rw-r--r-- | pdf.gyp | 15 | ||||
-rw-r--r-- | zlib.gyp | 12 |
12 files changed, 270 insertions, 52 deletions
diff --git a/android_deps.gyp b/android_deps.gyp index cd5b1b0..1669b2b 100644 --- a/android_deps.gyp +++ b/android_deps.gyp @@ -14,7 +14,68 @@ # This is due to the fact that we cannot use variables in an includes as the # variable expansion step for gyp happens after the includes are processed. { - 'includes': [ - '../platform_tools/android/gyp/dependencies.gypi', + 'conditions': [ + [ 'skia_android_framework == 0', + { + 'includes': [ + '../platform_tools/android/gyp/dependencies.gypi', + ], + }, { # else skia_android_framework + 'cflags': [ + '-Wno-error' + ], + 'targets': [ + { + 'target_name': 'expat', + 'type': 'none', + 'direct_dependent_settings': { + 'libraries' : [ + '-lexpat', + ], + }, + }, + { + 'target_name': 'gif', + 'type': 'none', + 'direct_dependent_settings': { + 'libraries' : [ + 'libgif.a', + ], + 'include_dirs': [ + 'external/giflib', + ], + }, + }, + { + 'target_name': 'png', + 'type': 'none', + 'direct_dependent_settings': { + 'libraries' : [ + '-lpng', + ], + 'include_dirs': [ + 'external/libpng', + ], + }, + }, + { + 'target_name': 'jpeg', + 'type': 'none', + 'direct_dependent_settings': { + 'libraries' : [ + '-ljpeg', + ], + 'include_dirs': [ + 'external/jpeg', + ], + }, + }, + { + 'target_name': 'cpu_features', + 'type': 'none', + }, + ], + } + ], ], } diff --git a/android_framework_lib.gyp b/android_framework_lib.gyp new file mode 100644 index 0000000..2b05598 --- /dev/null +++ b/android_framework_lib.gyp @@ -0,0 +1,20 @@ +# Copyright 2014 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'libskia', + 'type': 'shared_library', + 'dependencies': [ + 'core.gyp:core', + 'effects.gyp:effects', + 'images.gyp:images', + 'opts.gyp:opts', + 'pdf.gyp:pdf', + 'ports.gyp:ports', + ], + }, + ], +} diff --git a/common.gypi b/common.gypi index 48b9a6d..2a5bbd4 100644 --- a/common.gypi +++ b/common.gypi @@ -88,25 +88,30 @@ ], }, ], + [ 'skia_android_framework==0', { + # These defines are not used for skia_android_framework, where we build + # one makefile and allow someone to add SK_DEBUG etc for their own + # debugging purposes. + 'configurations': { + 'Debug': { + 'defines': [ + 'SK_DEBUG', + 'SK_DEVELOPER=1', + ], + }, + 'Release': { + 'defines': [ + 'SK_RELEASE', + ], + }, + 'Release_Developer': { + 'inherit_from': ['Release'], + 'defines': [ + 'SK_DEVELOPER=1', + ], + }, + }, + }], ], - 'configurations': { - 'Debug': { - 'defines': [ - 'SK_DEBUG', - 'SK_DEVELOPER=1', - ], - }, - 'Release': { - 'defines': [ - 'SK_RELEASE', - ], - }, - 'Release_Developer': { - 'inherit_from': ['Release'], - 'defines': [ - 'SK_DEVELOPER=1', - ], - }, - }, }, # end 'target_defaults' } diff --git a/common_conditions.gypi b/common_conditions.gypi index 4db0a40..48a07b3 100644 --- a/common_conditions.gypi +++ b/common_conditions.gypi @@ -193,6 +193,28 @@ }, ], + ['skia_android_framework', { + 'cflags': [ + # Skia does not enforce this usage pattern so we disable it here to avoid + # unecessary log spew when building + '-Wno-unused-parameter', + + # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString. + # Revert to -D_FORTIFY_SOURCE=1 + '-U_FORTIFY_SOURCE', + '-D_FORTIFY_SOURCE=1', + ], + 'defines': [ + 'DCT_IFAST_SUPPORTED', + # using freetype's embolden allows us to adjust fake bold settings at + # draw-time, at which point we know which SkTypeface is being drawn + 'SK_USE_FREETYPE_EMBOLDEN', + # Android provides at least FreeType 2.4.0 at runtime. + 'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400', + # Skia should not use dlopen on Android. + 'SK_CAN_USE_DLOPEN=0', + ], + }], [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]', { @@ -434,18 +456,28 @@ 'SK_BUILD_FOR_ANDROID', 'SK_FONTHOST_DOES_NOT_USE_FONTMGR', ], - 'configurations': { - 'Debug': { - 'cflags': ['-g'] - }, - 'Release': { - 'cflags': ['-O2'], - 'defines': [ 'NDEBUG' ], - }, - }, + 'conditions': [ + [ 'skia_android_framework==0', { + # Don't use the configurations for skia_android_framework, where + # we generate a single makefile for all builds, and flags can be + # set manually for debugging. + 'configurations': { + 'Debug': { + 'cflags': ['-g'] + }, + 'Release': { + 'cflags': ['-O2'], + 'defines': [ 'NDEBUG' ], + }, + }, + # Adding these libraries is not necessary for the framework. + 'libraries': [ + '-lstdc++', + '-lm', + ], + }], + ], 'libraries': [ - '-lstdc++', - '-lm', '-llog', ], 'cflags': [ diff --git a/common_variables.gypi b/common_variables.gypi index c06666d..26b9961 100644 --- a/common_variables.gypi +++ b/common_variables.gypi @@ -45,13 +45,21 @@ # We set it automatically based on 'OS' (the host OS), but allow the # user to override it via GYP_DEFINES if they like. 'skia_os%': '<(OS)', + + 'skia_android_framework%': 0, }, # Re-define all variables defined within the level-3 'variables' dict, # so that siblings of the level-2 'variables' dict can see them. - 'skia_os%': '<(skia_os)', + # (skia_os will depend on skia_android_framework.) + 'skia_android_framework%': '<(skia_android_framework)', 'conditions': [ + [ 'skia_android_framework == 1', { + 'skia_os%': 'android', + }, { + 'skia_os%': '<(skia_os)', + }], [ 'skia_os == "win"', { 'os_posix%': 0, }, { @@ -109,7 +117,8 @@ 'conditions': [ [ 'skia_os == "win" and skia_arch_width == 32 or ' - 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"] or ' + 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"] ' + 'and skia_android_framework == 0 or ' 'skia_os == "mac" and skia_arch_width == 32', { 'skia_warnings_as_errors%': 1, }, { @@ -145,6 +154,7 @@ 'skia_scalar%': '<(skia_scalar)', 'skia_mesa%': '<(skia_mesa)', 'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)', + 'skia_android_framework%': '<(skia_android_framework)', 'skia_android_path_rendering%': '<(skia_android_path_rendering)', 'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)', 'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)', @@ -80,6 +80,12 @@ 'android_deps.gyp:cpu_features', ], }], + [ 'skia_android_framework', { + 'libraries': [ + # Required for SkAtomics_android.h + '-lcutils', + ], + }], [ 'skia_arch_type == "arm"', { # The code in SkUtilsArm.cpp can be used on an ARM-based Linux system, not only Android. 'sources': [ diff --git a/freetype.gyp b/freetype.gyp index b0957d0..6717c78 100644 --- a/freetype.gyp +++ b/freetype.gyp @@ -37,6 +37,22 @@ ], }, }], + [ 'skia_android_framework', { + 'include_dirs': [ + 'external/expat/lib', + 'external/freetype/include', + ], + 'libraries': [ + '-lft2', + ], + # Remove these, and use the system's freetype instead. + 'dependencies!': [ + 'freetype_static', + ], + 'export_dependent_settings!': [ + 'freetype_static', + ] + }], ], }, { @@ -12,8 +12,12 @@ 'libwebp.gyp:libwebp', 'utils.gyp:utils', ], - 'export_dependent_settings': [ - 'libjpeg.gyp:*', + 'conditions': [ + [ 'skia_android_framework == 0', { + 'export_dependent_settings': [ + 'libjpeg.gyp:*', + ], + }], ], 'include_dirs': [ '../include/images', @@ -42,16 +46,26 @@ '../src/images/SkImageDecoder.cpp', '../src/images/SkImageDecoder_FactoryDefault.cpp', '../src/images/SkImageDecoder_FactoryRegistrar.cpp', + # If decoders are added/removed to/from (all/individual) # platform(s), be sure to update SkForceLinking.cpp # so the right decoders will be forced to link. + + # IMPORTANT: The build order of the SkImageDecoder_*.cpp files + # defines the order image decoders are tested when decoding a + # stream. The last decoder is the first one tested, so the .cpp + # files should be in listed in order from the least likely to be + # used, to the most likely (jpeg and png should be the last two + # for instance.) As a result, they are deliberately not in + # alphabetical order. + '../src/images/SkImageDecoder_wbmp.cpp', '../src/images/SkImageDecoder_libbmp.cpp', '../src/images/SkImageDecoder_libgif.cpp', '../src/images/SkImageDecoder_libico.cpp', + '../src/images/SkImageDecoder_libwebp.cpp', '../src/images/SkImageDecoder_libjpeg.cpp', '../src/images/SkImageDecoder_libpng.cpp', - '../src/images/SkImageDecoder_libwebp.cpp', - '../src/images/SkImageDecoder_wbmp.cpp', + '../src/images/SkImageEncoder.cpp', '../src/images/SkImageEncoder_Factory.cpp', '../src/images/SkImageEncoder_argb.cpp', @@ -140,8 +154,12 @@ 'android_deps.gyp:gif', 'android_deps.gyp:png', ], - 'export_dependent_settings': [ - 'android_deps.gyp:png' + 'conditions': [ + [ 'skia_android_framework == 0', { + 'export_dependent_settings': [ + 'android_deps.gyp:png' + ], + }], ], },{ #else if skia_os != android 'sources!': [ diff --git a/libwebp.gyp b/libwebp.gyp index 1f8689a..cacfab6 100644 --- a/libwebp.gyp +++ b/libwebp.gyp @@ -4,7 +4,13 @@ { 'variables': { - 'use_system_libwebp%': 0, + 'conditions':[ + ['skia_android_framework == 1', { + 'use_system_libwebp': 1, + }, { + 'use_system_libwebp%': 0, + }], + ], }, 'conditions': [ ['use_system_libwebp==0', { @@ -156,20 +162,36 @@ }, ], }, { + # use_system_libwep == 1 'targets': [ { 'target_name': 'libwebp', 'type': 'none', - 'direct_dependent_settings': { - 'defines': [ - 'ENABLE_WEBP', - ], - }, - 'link_settings': { - 'libraries': [ - '-lwebp', + 'conditions': [ + [ 'skia_android_framework', { + 'direct_dependent_settings': { + 'libraries': [ + 'libwebp-decode.a', + 'libwebp-encode.a', + ], + 'include_dirs': [ + 'external/webp/include', + ], + }, + }, { # skia_android_framework == 0 + 'direct_dependent_settings': { + 'defines': [ + 'ENABLE_WEBP', + ], + }, + 'link_settings': { + 'libraries': [ + '-lwebp', + ], + }, + }, ], - }, + ], } ], }], @@ -1,3 +1,4 @@ +# Gyp file for opts projects { 'targets': [ # Due to an unfortunate intersection of lameness between gcc and gyp, @@ -98,7 +99,9 @@ }], ], }], - [ '(skia_arch_type == "mips") or (skia_arch_type == "arm" and arm_version < 7) or (skia_os == "ios")', { + [ '(skia_arch_type == "mips") or (skia_arch_type == "arm" and arm_version < 7) \ + or (skia_os == "ios") \ + or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "mips"])', { 'sources': [ '../src/opts/SkBitmapProcState_opts_none.cpp', '../src/opts/SkBlitMask_opts_none.cpp', @@ -1,3 +1,4 @@ +# This file builds the PDF backend. { 'targets': [ { @@ -23,6 +24,20 @@ '../src/doc/SkDocument_PDF.cpp', # Chromium does use this file ], + 'conditions': [ + [ 'skia_android_framework', { + # Add SFTNLY support for PDF (which in turns depends on ICU) + 'include_dirs': [ + 'external/sfntly/cpp/src', + ], + 'libraries': [ + 'libsfntly.a', + '-licuuc', + '-licui18n', + ], + } + ], + ], # This section makes all targets that depend on this target # #define SK_SUPPORT_PDF and have access to the pdf header files. 'direct_dependent_settings': { @@ -1,3 +1,4 @@ +# Target for including zlib. { 'targets': [ { @@ -30,7 +31,16 @@ }], [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android", "nacl"]', { 'link_settings': { 'libraries': [ '-lz', ], }, - 'defines': [ 'SK_ZLIB_INCLUDE=<zlib.h>', ], + 'conditions': [ + [ 'skia_android_framework==0', { + 'defines': [ 'SK_ZLIB_INCLUDE=<zlib.h>', ], + }], + ], + }], + [ 'skia_android_framework', { + 'include_dirs': [ + 'external/zlib', + ], }], ], }, |