# 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',
+ },
+ ],
+ }
+ ],
],
}
--- /dev/null
+# 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',
+ ],
+ },
+ ],
+}
],
},
],
+ [ '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'
}
},
],
+ ['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"]',
{
'-fuse-ld=gold',
],
'conditions': [
+ [ 'skia_android_framework', {
+ 'libraries!': [
+ '-lstdc++',
+ '-lm',
+ ],
+ }],
[ 'skia_shared_lib', {
'cflags': [
'-fPIC',
# 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,
}, {
'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,
}, {
'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)',
'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': [
],
},
}],
+ [ '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',
+ ]
+ }],
],
},
{
'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',
'../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',
'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!': [
{
'variables': {
- 'use_system_libwebp%': 0,
+ 'conditions':[
+ ['skia_android_framework == 1', {
+ 'use_system_libwebp': 1,
+ }, {
+ 'use_system_libwebp%': 0,
+ }],
+ ],
},
'conditions': [
['use_system_libwebp==0', {
},
],
}, {
+ # 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',
+ ],
+ },
+ },
],
- },
+ ],
}
],
}],
+# Gyp file for opts projects
{
'targets': [
# Due to an unfortunate intersection of lameness between gcc and gyp,
}],
],
}],
- [ '(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',
+# This file builds the PDF backend.
{
'targets': [
{
'../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': {
+# Target for including zlib.
{
'targets': [
{
}],
[ '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',
+ ],
}],
],
},