diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-05 16:35:12 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-05 16:35:12 +0000 |
commit | 5ce7107a4671d48972ae2fefdbd7f17721105af1 (patch) | |
tree | d6c8eea3b87d532a8496dc43f41e583844193285 | |
parent | 390b7097db59782bd533d4ff11df859cd53ac57c (diff) | |
download | gyp-5ce7107a4671d48972ae2fefdbd7f17721105af1.tar.gz |
Reland "Gyp file changes for the android framework."
Relands https://codereview.chromium.org/153093003/, which was reverted
with https://skia.googlesource.com/skia.git/+/eb6295044b97db05ec40625dcebc2459b2a38a98
This reverts commit 6b32be1402eb6c549d5ba1db71860e24f9de2991.
BUG=skia:1975
R=djsollen@google.com
Review URL: https://codereview.chromium.org/154053002
git-svn-id: http://skia.googlecode.com/svn/trunk/gyp@13321 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 | 28 | ||||
-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, 255 insertions, 41 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..bbf3097 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"]', { @@ -452,6 +474,12 @@ '-fuse-ld=gold', ], 'conditions': [ + [ 'skia_android_framework', { + 'libraries!': [ + '-lstdc++', + '-lm', + ], + }], [ 'skia_shared_lib', { 'cflags': [ '-fPIC', 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', + ], }], ], }, |