Commit 33b56822 authored by brettw@chromium.org's avatar brettw@chromium.org

Make skia compile in Android GN build.

Adds a bunch of ARM configuration and assembly sources. MIPS still not done.

Implements the Android Freetype build and fixes expat.

Fixes some minor optimization-related flags I noticed along the way.

TBR=djsollen@google.com

Review URL: https://codereview.chromium.org/289973006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271603 0039d316-1c4b-4281-b951-d872f2087c98
parent ab37ca87
......@@ -78,7 +78,6 @@ group("root") {
"//crypto",
"//gpu/command_buffer/client", # Needs Skia.
"//net",
"//skia", # Needs some ARM stuff
"//third_party/libusb",
"//third_party/WebKit/Source/wtf", # TODO(brettw) re-enable for Android.
"//tools/gn",
......
......@@ -674,8 +674,18 @@ if (is_win) {
"-fdata-sections",
"-ffunction-sections",
]
common_optimize_on_ldflags = []
if (is_android) {
common_optimize_on_cflags += [
"-fomit-frame-pointer",
]
common_optimize_on_ldflags += [
# Warn in case of text relocations.
"-Wl,--warn-shared-textrel",
]
}
if (is_mac) {
if (symbol_level == 2) {
# Mac dead code stripping requires symbols.
......
......@@ -415,6 +415,13 @@ component("skia") {
]
}
if (is_android) {
deps += [
"//third_party/expat",
"//third_party/freetype",
]
}
if (skia_support_pdf) {
deps += [ "//third_party/sfntly" ]
}
......@@ -422,6 +429,9 @@ component("skia") {
# Separated out so it can be compiled with different flags for SSE.
source_set("skia_opts") {
cflags = []
defines = []
if (cpu_arch == "x86" || cpu_arch == "x64") {
sources = [
# SSE 2
......@@ -447,10 +457,88 @@ source_set("skia_opts") {
]
if (is_linux || is_mac) {
cflags = [ "-mssse3" ] # Note third 's'.
cflags += [ "-mssse3" ] # Note third 's'.
}
} else if (cpu_arch == "arm") {
sources = [
"//third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp",
]
# The assembly uses the frame pointer register (r7 in Thumb/r11 in
# ARM), the compiler doesn't like that.
cflags += [ "-fomit-frame-pointer" ]
if (arm_version >= 7) {
if (arm_use_neon || arm_optionally_use_neon) {
sources += [
"//third_party/skia/src/opts/memset16_neon.S",
"//third_party/skia/src/opts/memset32_neon.S",
"//third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp",
"//third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp",
"//third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h",
"//third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h",
"//third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp",
"//third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp",
"//third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp",
"//third_party/skia/src/opts/SkBlurImage_opts_neon.cpp",
"//third_party/skia/src/opts/SkMorphology_opts_neon.cpp",
]
cflags += [
# The neon assembly contains conditional instructions which aren't
# enclosed in an IT block. The assembler complains without this
# option. See #86592.
"-Wa,-mimplicit-it=always",
]
# Root build config sets -mfpu=$arm_fpu, which we expect to be neon
# when running this.
assert(arm_fpu == "neon")
#ldflags = [
# "-march=armv7-a",
# "-Wl,--fix-cortex-a8",
#]
}
if (arm_use_neon) {
defines += [ "__ARM_HAVE_NEON" ]
}
if (arm_optionally_use_neon) {
defines += [ "__ARM_HAVE_OPTIONAL_NEON_SUPPORT" ]
}
}
# Non-Neon ARM code.
if (arm_version < 7 || (!arm_use_neon && arm_optionally_use_neon)) {
sources += [ "//third_party/skia/src/opts/memset.arm.S" ]
}
if (arm_version < 6) {
sources += [
"//third_party/skia/src/opts/SkBlitMask_opts_none.cpp",
"//third_party/skia/src/opts/SkBlitRow_opts_none.cpp",
"//third_party/skia/src/opts/SkUtils_opts_none.cpp",
"//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
"//third_party/skia/src/opts/SkMorphology_opts_none.cpp",
"//third_party/skia/src/opts/SkBlurImage_opts_none.cpp",
]
} else {
# arm version >= 6.
sources += [
"//third_party/skia/src/opts/SkBlitMask_opts_arm.cpp",
"//third_party/skia/src/opts/SkBlitRow_opts_arm.cpp",
"//third_party/skia/src/opts/SkBlitRow_opts_arm.h",
"//third_party/skia/src/opts/SkBlurImage_opts_arm.cpp",
"//third_party/skia/src/opts/SkMorphology_opts_arm.cpp",
"//third_party/skia/src/opts/SkUtils_opts_arm.cpp",
"//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
]
}
} else {
assert(false, "Need to port ARM/MIPS stuff from skia_library_opts.gyp")
assert(false, "Need to port MIPS stuff from skia_library_opts.gyp")
}
configs -= [ "//build/config/compiler:chromium_code" ]
......
......@@ -2,6 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_android) {
import("//build/config/android/config.gni")
}
if (is_linux) {
config("expat_config") {
libs = [ "expat" ]
......@@ -16,6 +20,9 @@ if (is_linux) {
} else {
config("expat_config") {
include_dirs = [ "files/lib" ]
if (is_android) {
include_dirs += [ "$android_src/external/expat/lib" ]
}
defines = [ "XML_STATIC" ]
}
......@@ -27,6 +34,8 @@ if (is_linux) {
"files/lib/xmltok.c",
]
direct_dependent_configs = [ ":expat_config" ]
defines = [ "_LIB" ]
if (is_win) {
defines += [ "COMPILED_FROM_DSP" ]
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
assert(is_android, "This library is only used on Android")
config("freetype_config") {
include_dirs = [ "include" ]
}
source_set("freetype") {
sources = [
# The following files are not sorted alphabetically, but in the
# same order as in Android.mk to ease maintenance.
"src/base/ftbbox.c",
"src/base/ftbitmap.c",
"src/base/ftfstype.c",
"src/base/ftglyph.c",
"src/base/ftlcdfil.c",
"src/base/ftstroke.c",
"src/base/fttype1.c",
"src/base/ftxf86.c",
"src/base/ftbase.c",
"src/base/ftsystem.c",
"src/base/ftinit.c",
"src/base/ftgasp.c",
"src/raster/raster.c",
"src/sfnt/sfnt.c",
"src/smooth/smooth.c",
"src/autofit/autofit.c",
"src/truetype/truetype.c",
"src/cff/cff.c",
"src/psnames/psnames.c",
"src/pshinter/pshinter.c",
]
defines = [
"FT2_BUILD_LIBRARY",
"DARWIN_NO_CARBON",
]
include_dirs = [
"build",
]
direct_dependent_configs = [ ":freetype_config" ]
deps = [
"//third_party/libpng",
"//third_party/zlib",
]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment