From a03c343b47938fcb1b562741ff05252b01a4e39d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 16 Mar 2016 15:35:20 -0400 Subject: Enable building pdf_use_skia in the standalone build. This CL adds the necessary pieces so you can add pdf_use_skia=1 to GYP_DEFINES and do a standalone build. R=caryclark@google.com Review URL: https://codereview.chromium.org/1812563002 . --- .gitignore | 1 + DEPS | 39 +++-- core/fxge/skia/fx_skia_device.h | 183 +++++++++++----------- skia/config/SkUserConfig.h | 268 ++++++++++++++++++++++++++++++++ skia/ext/DEPS | 3 + skia/ext/google_logging.cc | 24 +++ skia/skia.gyp | 71 +++++++++ skia/skia_common.gypi | 157 +++++++++++++++++++ skia/skia_library.gypi | 312 +++++++++++++++++++++++++++++++++++++ skia/skia_library_opts.gyp | 330 ++++++++++++++++++++++++++++++++++++++++ skia/skia_pdfium.gypi | 29 ++++ 11 files changed, 1316 insertions(+), 101 deletions(-) create mode 100644 skia/config/SkUserConfig.h create mode 100644 skia/ext/DEPS create mode 100644 skia/ext/google_logging.cc create mode 100644 skia/skia.gyp create mode 100644 skia/skia_common.gypi create mode 100644 skia/skia_library.gypi create mode 100644 skia/skia_library_opts.gyp create mode 100644 skia/skia_pdfium.gypi diff --git a/.gitignore b/.gitignore index cbd1e7da4e..45bcec530e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ /testing/gtest /third_party/llvm /third_party/llvm-build +/third_party/skia /tools/clang /v8 /xcodebuild diff --git a/DEPS b/DEPS index 11ce870301..9967e890dc 100644 --- a/DEPS +++ b/DEPS @@ -1,38 +1,57 @@ use_relative_paths = True +vars = { + 'chromium_git': 'https://chromium.googlesource.com', + 'pdfium_git': 'https://pdfium.googlesource.com', + + 'buildtools_revision': 'c2f259809d5ede3275df5ea0842f0431990c4f98', + 'cygwin_revision': 'c89e446b273697fadf3a10ff1007a97c0b7de6df', + 'gmock_revision': '29763965ab52f24565299976b936d1265cb6a271', + 'gtest_revision': '8245545b6dc9c4703e6496d1efd19e975ad2b038', + 'icu_revision': '8d342a405be5ae8aacb1e16f0bc31c3a4fbf26a2', + 'pdfium_tests_revision': 'bafb069353f96d441c6a37786d18cd9f5407937f', + 'skia_revision': 'ed854fb897fa134f2f64738a75293502fdcf1af2', + 'trace_event_revision': 'd83d44b13d07c2fd0a40101a7deef9b93b841732', + 'v8_revision': '3c3d7e7be80f45eeea0dc74a71d7552e2afc2985', + +} + deps = { "build/gyp": - "https://chromium.googlesource.com/external/gyp", + Var('chromium_git') + "/external/gyp", "buildtools": - "https://chromium.googlesource.com/chromium/buildtools.git@c2f259809d5ede3275df5ea0842f0431990c4f98", + Var('chromium_git') + "/chromium/buildtools.git@" + Var('buildtools_revision'), "testing/corpus": - "https://pdfium.googlesource.com/pdfium_tests@bafb069353f96d441c6a37786d18cd9f5407937f", + Var('pdfium_git') + "/pdfium_tests@" + Var('pdfium_tests_revision'), "testing/gmock": - "https://chromium.googlesource.com/external/googlemock.git@29763965ab52f24565299976b936d1265cb6a271", + Var('chromium_git') + "/external/googlemock.git@" + Var('gmock_revision'), "testing/gtest": - "https://chromium.googlesource.com/external/googletest.git@8245545b6dc9c4703e6496d1efd19e975ad2b038", + Var('chromium_git') + "/external/googletest.git@" + Var('gtest_revision'), + + "third_party/skia": + Var('chromium_git') + '/skia.git' + '@' + Var('skia_revision'), "tools/clang": - "https://chromium.googlesource.com/chromium/src/tools/clang", + Var('chromium_git') + "/chromium/src/tools/clang", "v8": - "https://chromium.googlesource.com/v8/v8.git@3c3d7e7be80f45eeea0dc74a71d7552e2afc2985", + Var('chromium_git') + "/v8/v8.git@" + Var('v8_revision'), "v8/base/trace_event/common": - "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git@d83d44b13d07c2fd0a40101a7deef9b93b841732", + Var('chromium_git') + "/chromium/src/base/trace_event/common.git@" + Var('trace_event_revision'), "v8/third_party/icu": - "https://chromium.googlesource.com/chromium/deps/icu.git@8d342a405be5ae8aacb1e16f0bc31c3a4fbf26a2", + Var('chromium_git') + "/chromium/deps/icu.git@" + Var('icu_revision'), } deps_os = { "win": { "v8/third_party/cygwin": - "https://chromium.googlesource.com/chromium/deps/cygwin@c89e446b273697fadf3a10ff1007a97c0b7de6df", + Var('chromium_git') + "/chromium/deps/cygwin@" + Var('cygwin_revision'), }, } diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index bb0a651263..7d266d39b2 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -25,119 +25,120 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { ~CFX_SkiaDeviceDriver() override; /** Options */ - virtual int GetDeviceCaps(int caps_id); + int GetDeviceCaps(int caps_id) override; /** Save and restore all graphic states */ - virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); + void SaveState() override; + void RestoreState(FX_BOOL bKeepSaved) override; /** Set clipping path using filled region */ - virtual FX_BOOL SetClip_PathFill( + FX_BOOL SetClip_PathFill( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation - int fill_mode); // fill mode, WINDING or ALTERNATE + int fill_mode) override; // fill mode, WINDING or ALTERNATE /** Set clipping path using stroked region */ - virtual FX_BOOL SetClip_PathStroke( + FX_BOOL SetClip_PathStroke( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation const CFX_GraphStateData* - pGraphState); // graphic state, for pen attributes + pGraphState) // graphic state, for pen attributes + override; /** Draw a path */ - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, - int fill_mode, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + FX_DWORD fill_color, + FX_DWORD stroke_color, + int fill_mode, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; + + FX_BOOL SetPixel(int x, + int y, + FX_DWORD color, + int alpha_flag = 0, + void* pIccTransform = NULL) override; + + FX_BOOL FillRect(const FX_RECT* pRect, + FX_DWORD fill_color, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; - virtual FX_BOOL SetPixel(int x, - int y, + /** Draw a single pixel (device dependant) line */ + FX_BOOL DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, FX_DWORD color, int alpha_flag = 0, - void* pIccTransform = NULL); - - virtual FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, - int alpha_flag = 0, void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - /** Draw a single pixel (device dependant) line */ - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_DWORD color, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) { + int blend_type = FXDIB_BLEND_NORMAL) override { return FALSE; } - virtual FX_BOOL GetClipBox(FX_RECT* pRect); + FX_BOOL GetClipBox(FX_RECT* pRect) override; /** Load device buffer into a DIB */ - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top, - void* pIccTransform = NULL, - FX_BOOL bDEdge = FALSE); - - virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop(); } - - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - const FX_RECT* pSrcRect, - int dest_left, - int dest_top, - int blend_type, - int alpha_flag = 0, - void* pIccTransform = NULL); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - FX_DWORD flags, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - FX_DWORD color, - const CFX_Matrix* pMatrix, - FX_DWORD flags, - void*& handle, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); - virtual void CancelDIBits(void* handle); - - virtual FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - FX_DWORD color, - int alpha_flag = 0, - void* pIccTransform = NULL); - - virtual FX_BOOL RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, - FX_DWORD color, - FX_BOOL bFullCover, - FX_BOOL bGroupKnockout, - int alpha_flag, - void* pIccTransform); + FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, + int left, + int top, + void* pIccTransform = NULL, + FX_BOOL bDEdge = FALSE) override; + + CFX_DIBitmap* GetBackDrop() override { return m_pAggDriver->GetBackDrop(); } + + FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + const FX_RECT* pSrcRect, + int dest_left, + int dest_top, + int blend_type, + int alpha_flag = 0, + void* pIccTransform = NULL) override; + FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + FX_DWORD flags, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; + + FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + FX_DWORD color, + const CFX_Matrix* pMatrix, + FX_DWORD flags, + void*& handle, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; + FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override; + void CancelDIBits(void* handle) override; + + FX_BOOL DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + FX_DWORD color, + int alpha_flag = 0, + void* pIccTransform = NULL) override; + + FX_BOOL RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, + FX_DWORD color, + FX_BOOL bFullCover, + FX_BOOL bGroupKnockout, + int alpha_flag, + void* pIccTransform); void SetClipMask(agg::rasterizer_scanline_aa& rasterizer); void SetClipMask(SkPath& skPath, SkPaint* spaint); virtual uint8_t* GetBuffer() const { return m_pAggDriver->GetBuffer(); } diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h new file mode 100644 index 0000000000..2f13fda7b5 --- /dev/null +++ b/skia/config/SkUserConfig.h @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SKIA_CONFIG_SKUSERCONFIG_H_ +#define SKIA_CONFIG_SKUSERCONFIG_H_ + +/* SkTypes.h, the root of the public header files, does the following trick: + + #include + #include + #include + + SkPreConfig.h runs first, and it is responsible for initializing certain + skia defines. + + SkPostConfig.h runs last, and its job is to just check that the final + defines are consistent (i.e. that we don't have mutually conflicting + defines). + + SkUserConfig.h (this file) runs in the middle. It gets to change or augment + the list of flags initially set in preconfig, and then postconfig checks + that everything still makes sense. + + Below are optional defines that add, subtract, or change default behavior + in Skia. Your port can locally edit this file to enable/disable flags as + you choose, or these can be delared on your command line (i.e. -Dfoo). + + By default, this include file will always default to having all of the flags + commented out, so including it will have no effect. +*/ + +/////////////////////////////////////////////////////////////////////////////// + +/* Skia has lots of debug-only code. Often this is just null checks or other + parameter checking, but sometimes it can be quite intrusive (e.g. check that + each 32bit pixel is in premultiplied form). This code can be very useful + during development, but will slow things down in a shipping product. + + By default, these mutually exclusive flags are defined in SkPreConfig.h, + based on the presence or absence of NDEBUG, but that decision can be changed + here. + */ +// #define SK_DEBUG +// #define SK_RELEASE + +// #ifdef DCHECK_ALWAYS_ON +// #undef SK_RELEASE +// #define SK_DEBUG +// #endif + +/* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) + it will call SK_CRASH(). If this is not defined it, it is defined in + SkPostConfig.h to write to an illegal address + */ +// #define SK_CRASH() *(int *)(uintptr_t)0 = 0 + +/* preconfig will have attempted to determine the endianness of the system, + but you can change these mutually exclusive flags here. + */ +// #define SK_CPU_BENDIAN +// #define SK_CPU_LENDIAN + +/* If zlib is available and you want to support the flate compression + algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the + include path. + */ +// #define SK_ZLIB_INCLUDE + +/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow + them, but modern PDF interpreters should handle them just fine. + */ +// #define SK_ALLOW_LARGE_PDF_SCALARS + +/* Define this to provide font subsetter for font subsetting when generating + PDF documents. + */ +// #define SK_SFNTLY_SUBSETTER \ +// "third_party/sfntly/src/cpp/src/sample/chromium/font_subsetter.h" + +/* To write debug messages to a console, skia will call SkDebugf(...) following + printf conventions (e.g. const char* format, ...). If you want to redirect + this to something other than printf, define yours here + */ +// #define SkDebugf(...) MyFunction(__VA_ARGS__) + +/* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST + which will run additional self-tests at startup. These can take a long time, + so this flag is optional. + */ +#ifdef SK_DEBUG +#define SK_SUPPORT_UNITTEST +#endif + +/* If cross process SkPictureImageFilters are not explicitly enabled then + they are always disabled. + */ +#ifndef SK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS +#ifndef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS +#define SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS +#endif +#endif + +/* If your system embeds skia and has complex event logging, define this + symbol to name a file that maps the following macros to your system's + equivalents: + SK_TRACE_EVENT0(event) + SK_TRACE_EVENT1(event, name1, value1) + SK_TRACE_EVENT2(event, name1, value1, name2, value2) + src/utils/SkDebugTrace.h has a trivial implementation that writes to + the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, + SkTrace.h will define the above three macros to do nothing. +*/ +#undef SK_USER_TRACE_INCLUDE_FILE + +// ===== Begin Chrome-specific definitions ===== + +#define SK_SCALAR_IS_FLOAT +#undef SK_SCALAR_IS_FIXED + +#define SK_MSCALAR_IS_FLOAT +#undef SK_MSCALAR_IS_DOUBLE + +#define GR_MAX_OFFSCREEN_AA_DIM 512 + +// Log the file and line number for assertions. +#define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, false, __VA_ARGS__) +SK_API void SkDebugf_FileLine(const char* file, + int line, + bool fatal, + const char* format, + ...); + +// Marking the debug print as "fatal" will cause a debug break, so we don't need +// a separate crash call here. +#define SK_DEBUGBREAK(cond) \ + do { \ + if (!(cond)) { \ + SkDebugf_FileLine(__FILE__, __LINE__, true, \ + "%s:%d: failed assertion \"%s\"\n", __FILE__, \ + __LINE__, #cond); \ + } \ + } while (false) + +#if !defined(ANDROID) // On Android, we use the skia default settings. +#define SK_A32_SHIFT 24 +#define SK_R32_SHIFT 16 +#define SK_G32_SHIFT 8 +#define SK_B32_SHIFT 0 +#endif + +#if defined(SK_BUILD_FOR_WIN32) + +#define SK_BUILD_FOR_WIN + +// Skia uses this deprecated bzero function to fill zeros into a string. +#define bzero(str, len) memset(str, 0, len) + +#elif defined(SK_BUILD_FOR_MAC) + +#define SK_CPU_LENDIAN +#undef SK_CPU_BENDIAN + +#elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) + +// Prefer FreeType's emboldening algorithm to Skia's +// TODO: skia used to just use hairline, but has improved since then, so +// we should revisit this choice... +#define SK_USE_FREETYPE_EMBOLDEN + +#if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN) +// Above we set the order for ARGB channels in registers. I suspect that, on +// big endian machines, you can keep this the same and everything will work. +// The in-memory order will be different, of course, but as long as everything +// is reading memory as words rather than bytes, it will all work. However, if +// you find that colours are messed up I thought that I would leave a helpful +// locator for you. Also see the comments in +// base/gfx/bitmap_platform_device_linux.h +#error Read the comment at this location +#endif + +#endif + +// The default crash macro writes to badbeef which can cause some strange +// problems. Instead, pipe this through to the logging function as a fatal +// assertion. +#define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") + +// These flags are no longer defined in Skia, but we have them (temporarily) +// until we update our call-sites (typically these are for API changes). +// +// Remove these as we update our sites. +// +#ifndef SK_SUPPORT_LEGACY_GETTOPDEVICE +#define SK_SUPPORT_LEGACY_GETTOPDEVICE +#endif + +#ifndef SK_SUPPORT_LEGACY_GETDEVICE +#define SK_SUPPORT_LEGACY_GETDEVICE +#endif + +// Workaround for poor anisotropic mipmap quality, +// pending Skia ripmap support. +// (https://bugs.chromium.org/p/skia/issues/detail?id=4863) +#ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE +#define SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE +#endif + +#ifndef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX +#define SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX +#endif + +#ifndef SK_IGNORE_ETC1_SUPPORT +#define SK_IGNORE_ETC1_SUPPORT +#endif + +#ifndef SK_IGNORE_GPU_DITHER +#define SK_IGNORE_GPU_DITHER +#endif + +#ifndef SK_SUPPORT_LEGACY_EVAL_CUBIC +#define SK_SUPPORT_LEGACY_EVAL_CUBIC +#endif + +///////////////////////// Imported from BUILD.gn and skia_common.gypi + +/* In some places Skia can use static initializers for global initialization, + * or fall back to lazy runtime initialization. Chrome always wants the latter. + */ +#define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 + +/* This flag forces Skia not to use typographic metrics with GDI. + */ +#define SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS + +#define SK_IGNORE_BLURRED_RRECT_OPT +#define SK_USE_DISCARDABLE_SCALEDIMAGECACHE +#define SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT + +#define SK_ATTR_DEPRECATED SK_NOTHING_ARG1 +#define SK_ENABLE_INST_COUNT 0 +#define GR_GL_CUSTOM_SETUP_HEADER "GrGLConfig_chrome.h" + +// Blink layout tests are baselined to Clang optimizing through the UB in +// SkDivBits. +#define SK_SUPPORT_LEGACY_DIVBITS_UB + +// mtklein's fiddling with Src / SrcOver. Will rebaseline these only once when +// done. +#define SK_SUPPORT_LEGACY_X86_BLITS + +#define SK_DISABLE_TILE_IMAGE_FILTER_OPTIMIZATION + +// ===== End Chrome-specific definitions ===== + +#endif // SKIA_CONFIG_SKUSERCONFIG_H_ diff --git a/skia/ext/DEPS b/skia/ext/DEPS new file mode 100644 index 0000000000..007e5550d5 --- /dev/null +++ b/skia/ext/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + '+third_party/skia/include/core' +] diff --git a/skia/ext/google_logging.cc b/skia/ext/google_logging.cc new file mode 100644 index 0000000000..c0ddd99c0e --- /dev/null +++ b/skia/ext/google_logging.cc @@ -0,0 +1,24 @@ +// Copyright (c) 2012 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. + +// This file provides integration with Google-style "base/logging.h" assertions +// for Skia SkASSERT. If you don't want this, you can link with another file +// that provides integration with the logging of your choice. + +#include + +#include "third_party/skia/include/core/SkTypes.h" + +void SkDebugf_FileLine(const char* file, + int line, + bool fatal, + const char* format, + ...) { + va_list ap; + va_start(ap, format); + + fprintf(stderr, "%s:%d ", file, line); + vfprintf(stderr, format, ap); + va_end(ap); +} diff --git a/skia/skia.gyp b/skia/skia.gyp new file mode 100644 index 0000000000..29f5464938 --- /dev/null +++ b/skia/skia.gyp @@ -0,0 +1,71 @@ +# Copyright (c) 2012 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. + +{ + 'conditions': [ + # In component mode (shared_lib), we build all of skia as a single DLL. + # However, in the static mode, we need to build skia as multiple targets + # in order to support the use case where a platform (e.g. Android) may + # already have a copy of skia as a system library. + ['component=="static_library"', { + 'targets': [ + { + 'target_name': 'skia_library', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + 'skia_library.gypi', + ], + }, + ], + }], + ['component=="static_library"', { + 'targets': [ + { + 'target_name': 'skia', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'type': 'none', + 'dependencies': [ + 'skia_library', + 'skia_pdfium', + ], + 'export_dependent_settings': [ + 'skia_library', + 'skia_pdfium', + ], + 'direct_dependent_settings': { + 'conditions': [ + [ 'OS == "win"', { + 'defines': [ + 'GR_GL_FUNCTION_TYPE=__stdcall', + ], + }], + ], + }, + }, + { + 'target_name': 'skia_pdfium', + 'type': 'static_library', + 'includes': [ + 'skia_pdfium.gypi', + 'skia_common.gypi', + ], + }, + ], + }], + ], +} diff --git a/skia/skia_common.gypi b/skia/skia_common.gypi new file mode 100644 index 0000000000..4b7a51b6b1 --- /dev/null +++ b/skia/skia_common.gypi @@ -0,0 +1,157 @@ +# Copyright 2013 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. + +# This gypi file handles the removal of platform-specific files from the +# Skia build. +{ + 'include_dirs': [ + '..', + 'config', + ], + + 'conditions': [ + [ 'OS != "android"', { + 'sources/': [ + ['exclude', '_android\\.(cc|cpp)$'], + ], + }], + [ 'OS != "ios"', { + 'sources/': [ + ['exclude', '_ios\\.(cc|cpp|mm?)$'], + ], + }], + [ 'OS == "ios"', { + 'defines': [ + 'SK_BUILD_FOR_IOS', + ], + }], + [ 'OS != "mac"', { + 'sources/': [ + ['exclude', '_mac\\.(cc|cpp|mm?)$'], + ], + }], + [ 'OS == "mac"', { + 'defines': [ + 'SK_BUILD_FOR_MAC', + ], + }], + [ 'OS != "win"', { + 'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ], + }], + [ 'OS == "win"', { + 'defines': [ + # On windows, GDI handles are a scarse system-wide resource so we have to keep + # the glyph cache, which holds up to 4 GDI handles per entry, to a fairly small + # size. + # http://crbug.com/314387 + 'SK_DEFAULT_FONT_CACHE_COUNT_LIMIT=256', + 'GR_GL_FUNCTION_TYPE=__stdcall', + ], + }], + [ 'OS!="linux"', { + 'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ], + }], + + #Settings for text blitting, chosen to approximate the system browser. + [ 'OS == "linux"', { + 'defines': [ + 'SK_GAMMA_EXPONENT=1.2', + 'SK_GAMMA_CONTRAST=0.2', + ], + }], + ['OS == "android"', { + 'defines': [ + 'SK_GAMMA_APPLY_TO_A8', + 'SK_GAMMA_EXPONENT=1.4', + 'SK_GAMMA_CONTRAST=0.0', + ], + }], + ['OS == "win"', { + 'defines': [ + 'SK_GAMMA_SRGB', + 'SK_GAMMA_CONTRAST=0.5', + ], + }], + ['OS == "mac"', { + 'defines': [ + 'SK_GAMMA_SRGB', + 'SK_GAMMA_CONTRAST=0.0', + ], + }], + + # Neon support. + [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', { + 'defines': [ + 'SK_ARM_HAS_NEON', + ], + }], + [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 0 and arm_neon_optional == 1', { + 'defines': [ + 'SK_ARM_HAS_OPTIONAL_NEON', + ], + }], + ], + + 'variables': { + 'variables': { + 'conditions': [ + ['OS== "ios"', { + 'skia_support_gpu': 0, + }, { + 'skia_support_gpu': 1, + }], + ], + }, + 'skia_support_gpu': '<(skia_support_gpu)', + 'skia_support_pdf': '<(skia_support_pdf)', + + # These two set the paths so we can include skia/gyp/core.gypi + 'skia_src_path': '../third_party/skia/src', + 'skia_include_path': '../third_party/skia/include', + + # This list will contain all defines that also need to be exported to + # dependent components. + 'skia_export_defines': [ + 'SK_SUPPORT_GPU=<(skia_support_gpu)', + ], + + 'default_font_cache_limit%': '(20*1024*1024)', + + 'conditions': [ + ['OS== "android"', { + # Android devices are typically more memory constrained, so + # default to a smaller glyph cache (it may be overriden at runtime + # when the renderer starts up, depending on the actual device memory). + 'default_font_cache_limit': '(1*1024*1024)', + 'skia_export_defines': [ + 'SK_BUILD_FOR_ANDROID', + ], + }], + ], + }, + + 'defines': [ + '<@(skia_export_defines)', + + 'SK_DEFAULT_FONT_CACHE_LIMIT=<(default_font_cache_limit)', + ], + + 'direct_dependent_settings': { + 'defines': [ + '<@(skia_export_defines)', + ], + }, + + # We would prefer this to be direct_dependent_settings, + # however we currently have no means to enforce that direct dependents + # re-export if they include Skia headers in their public headers. + 'all_dependent_settings': { + 'include_dirs': [ + '..', + 'config', + ], + }, + + 'msvs_disabled_warnings': [4244, 4267, 4341, 4345, 4390, 4554, 4748, 4800], +} diff --git a/skia/skia_library.gypi b/skia/skia_library.gypi new file mode 100644 index 0000000000..fea93a3abc --- /dev/null +++ b/skia/skia_library.gypi @@ -0,0 +1,312 @@ +# Copyright 2013 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. + + +# This gypi file contains the Skia library. +# In component mode (shared_lib) it is folded into a single shared library with +# the Chrome-specific enhancements but in all other cases it is a separate lib. + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# variables and defines should go in skia_common.gypi so they can be seen +# by files listed here and in skia_library_opts.gypi. +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +{ + 'dependencies': [ + 'skia_library_opts.gyp:skia_opts', + '../third_party/third_party.gyp:fx_zlib', + ], + + 'includes': [ + '../third_party/skia/gyp/core.gypi', + '../third_party/skia/gyp/effects.gypi', + '../third_party/skia/gyp/pdf.gypi', + '../third_party/skia/gyp/utils.gypi', + ], + + 'sources': [ + '../third_party/skia/src/lazy/SkDiscardableMemoryPool.cpp', + + '../third_party/skia/src/ports/SkImageDecoder_empty.cpp', + '../third_party/skia/src/images/SkScaledBitmapSampler.cpp', + + '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp', + '../third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp', + + '../third_party/skia/src/ports/SkDiscardableMemory_none.cpp', + + '../third_party/skia/src/fonts/SkFontMgr_indirect.cpp', + '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', + + '../third_party/skia/src/ports/SkFontMgr_empty_factory.cpp', + '../third_party/skia/src/fonts/SkFontMgr_indirect.cpp', + '../third_party/skia/src/fonts/SkRemotableFontMgr.cpp', + '../third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp', + + '../third_party/skia/src/ports/SkImageGenerator_none.cpp', + + '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', + '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp', + '../third_party/skia/src/ports/SkFontHost_mac.cpp', + '../third_party/skia/src/ports/SkFontHost_win.cpp', + "../third_party/skia/src/ports/SkFontMgr_android.cpp", + "../third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + '../third_party/skia/src/ports/SkFontMgr_android_parser.cpp', + '../third_party/skia/src/ports/SkFontMgr_win_dw.cpp', + '../third_party/skia/src/ports/SkGlobalInitialization_default.cpp', + '../third_party/skia/src/ports/SkMemory_malloc.cpp', + '../third_party/skia/src/ports/SkOSFile_posix.cpp', + '../third_party/skia/src/ports/SkOSFile_stdio.cpp', + '../third_party/skia/src/ports/SkOSFile_win.cpp', + '../third_party/skia/src/ports/SkScalerContext_win_dw.cpp', + '../third_party/skia/src/ports/SkTime_Unix.cpp', + '../third_party/skia/src/ports/SkTLS_pthread.cpp', + '../third_party/skia/src/ports/SkTLS_win.cpp', + '../third_party/skia/src/ports/SkTypeface_win_dw.cpp', + + '../third_party/skia/src/sfnt/SkOTTable_name.cpp', + '../third_party/skia/src/sfnt/SkOTUtils.cpp', + ], + + # Exclude all unused files in skia utils.gypi file + 'sources!': [ + '../third_party/skia/src/utils/SkBoundaryPatch.cpp', + '../third_party/skia/src/utils/SkFrontBufferedStream.cpp', + '../third_party/skia/src/utils/SkCamera.cpp', + '../third_party/skia/src/utils/SkDumpCanvas.cpp', + '../third_party/skia/src/utils/SkInterpolator.cpp', + '../third_party/skia/src/utils/SkLayer.cpp', + '../third_party/skia/src/utils/SkMD5.cpp', + '../third_party/skia/src/utils/SkMeshUtils.cpp', + '../third_party/skia/src/utils/SkNinePatch.cpp', + '../third_party/skia/src/utils/SkOSFile.cpp', + '../third_party/skia/src/utils/SkParsePath.cpp', + +#windows + '../third_party/skia/src/utils/win/SkAutoCoInitialize.cpp', + '../third_party/skia/src/utils/win/SkIStream.cpp', + '../third_party/skia/src/utils/win/SkWGL_win.cpp', + +#testing + '../third_party/skia/src/fonts/SkGScalerContext.cpp', + ], + + 'include_dirs': [ + '../third_party/skia/include/c', + '../third_party/skia/include/core', + '../third_party/skia/include/client/android', + '../third_party/skia/include/effects', + '../third_party/skia/include/images', + '../third_party/skia/include/lazy', + '../third_party/skia/include/pathops', + '../third_party/skia/include/pdf', + '../third_party/skia/include/pipe', + '../third_party/skia/include/ports', + '../third_party/skia/include/private', + '../third_party/skia/include/utils', + '../third_party/skia/src/core', + '../third_party/skia/src/opts', + '../third_party/skia/src/image', + '../third_party/skia/src/pdf', + '../third_party/skia/src/ports', + '../third_party/skia/src/sfnt', + '../third_party/skia/src/utils', + '../third_party/skia/src/lazy', + ], + 'conditions': [ + ['skia_support_gpu != 0', { + 'includes': [ + '../third_party/skia/gyp/gpu.gypi', + ], + 'sources': [ + '<@(skgpu_null_gl_sources)', + '<@(skgpu_sources)', + ], + 'include_dirs': [ + '../third_party/skia/include/gpu', + '../third_party/skia/src/gpu', + ], + }], + ['skia_support_pdf == 0', { + 'sources/': [ + ['exclude', '../third_party/skia/src/doc/SkDocument_PDF.cpp'], + ['exclude', '../third_party/skia/src/pdf/'], + ], + }], + ['skia_support_pdf == 1', { + 'dependencies': [ + '../third_party/sfntly/sfntly.gyp:sfntly', + ], + }], + + [ 'OS == "win"', { + 'sources!': [ + # Keeping _win.cpp + "../third_party/skia/src/utils/SkThreadUtils_pthread.cpp", + ], + },{ + 'sources!': [ + # Keeping _pthread.cpp + "../third_party/skia/src/utils/SkThreadUtils_win.cpp", + ], + }], + + [ 'OS != "mac"', { + 'sources/': [ + ['exclude', '/mac/'] + ], + }], + [ 'OS == "android" and target_arch == "arm"', { + 'sources': [ + '../third_party/skia/src/core/SkUtilsArm.cpp', + ], + }], + [ 'OS=="linux"', { + 'dependencies': [ + '../third_party/third_party.gyp:fx_freetype' + ], + 'cflags': [ + '-Wno-unused', + '-Wno-unused-function', + ], + # TODO(dsinclair): Right way to use third_party.gyp:fx_freetype? + 'include_dirs': [ + '../third_party/freetype/include', + ], + }], + [ 'OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', { + 'sources!': [ + '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp', + '../third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp', + '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp', + '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp', + ], + }], + [ 'OS=="win" or OS=="mac" or OS=="ios"', { + 'sources!': [ + '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', + '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp', + + ], + }], + [ 'OS == "android"', { + 'dependencies': [ + '../third_party/expat/expat.gyp:expat', + '../third_party/freetype-android/freetype.gyp:ft2', + ], + # This exports a hard dependency because it needs to run its + # symlink action in order to expose the skia header files. + 'hard_dependency': 1, + 'include_dirs': [ + '../third_party/expat/files/lib', + ], + },{ # not 'OS == "android"' + 'sources!': [ + "../third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + '../third_party/skia/src/ports/SkFontMgr_android_parser.cpp', + ], + }], + [ 'OS == "ios"', { + 'include_dirs': [ + '../third_party/skia/include/utils/ios', + '../third_party/skia/include/utils/mac', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework', + ], + }, + 'sources': [ + # This file is used on both iOS and Mac, so it should be removed + # from the ios and mac conditions and moved into the main sources + # list. + '../third_party/skia/src/utils/mac/SkStream_mac.cpp', + ], + + # The main skia_opts target does not currently work on iOS because the + # target architecture on iOS is determined at compile time rather than + # gyp time (simulator builds are x86, device builds are arm). As a + # temporary measure, this is a separate opts target for iOS-only, using + # the _none.cpp files to avoid architecture-dependent implementations. + 'dependencies': [ + 'skia_library_opts.gyp:skia_opts_none', + ], + 'dependencies!': [ + 'skia_library_opts.gyp:skia_opts', + ], + }], + [ 'OS == "mac"', { + 'direct_dependent_settings': { + 'include_dirs': [ + '../third_party/skia/include/utils/mac', + ], + }, + 'include_dirs': [ + '../third_party/skia/include/utils/mac', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + ], + }, + 'sources': [ + '../third_party/skia/src/utils/mac/SkStream_mac.cpp', + ], + }], + [ 'OS == "win"', { + 'sources!': [ + '../third_party/skia/src/ports/SkOSFile_posix.cpp', + '../third_party/skia/src/ports/SkTime_Unix.cpp', + '../third_party/skia/src/ports/SkTLS_pthread.cpp', + ], + 'include_dirs': [ + '../third_party/skia/include/utils/win', + '../third_party/skia/src/utils/win', + ], + },{ # not 'OS == "win"' + 'sources!': [ + '../third_party/skia/src/ports/SkFontMgr_win_dw.cpp', + '../third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp', + '../third_party/skia/src/ports/SkScalerContext_win_dw.cpp', + '../third_party/skia/src/ports/SkTypeface_win_dw.cpp', + + '../third_party/skia/src/utils/win/SkDWrite.cpp', + '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp', + '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp', + '../third_party/skia/src/utils/win/SkHRESULT.cpp', + ], + }], + ], + 'target_conditions': [ + # Pull in specific Mac files for iOS (which have been filtered out + # by file name rules). + [ 'OS == "ios"', { + 'sources/': [ + ['include', 'SkFontHost_mac\\.cpp$',], + ['include', 'SkStream_mac\\.cpp$',], + ['include', 'SkCreateCGImageRef\\.cpp$',], + ], + 'xcode_settings' : { + 'WARNING_CFLAGS': [ + # SkFontHost_mac.cpp uses API deprecated in iOS 7. + # crbug.com/408571 + '-Wno-deprecated-declarations', + ], + }, + }], + ], + + 'direct_dependent_settings': { + 'include_dirs': [ + '../third_party/skia/include/core', + '../third_party/skia/include/effects', + '../third_party/skia/include/pdf', + '../third_party/skia/include/gpu', + '../third_party/skia/include/lazy', + '../third_party/skia/include/pathops', + '../third_party/skia/include/pipe', + '../third_party/skia/include/ports', + '../third_party/skia/include/utils', + ], + }, +} diff --git a/skia/skia_library_opts.gyp b/skia/skia_library_opts.gyp new file mode 100644 index 0000000000..32b69bb164 --- /dev/null +++ b/skia/skia_library_opts.gyp @@ -0,0 +1,330 @@ +# Copyright 2013 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. + +# This gyp file contains the platform-specific optimizations for Skia +{ + 'variables': { + 'skia_src_path': '../third_party/skia/src', + 'includes': [ '../third_party/skia/gyp/opts.gypi' ], + 'include_dirs': [ + '../third_party/skia/include/core', + '../third_party/skia/include/effects', + '../third_party/skia/include/private', + '../third_party/skia/include/utils', + '../third_party/skia/src/core', + '../third_party/skia/src/opts', + '../third_party/skia/src/utils', + ], + }, + + 'targets': [ + # SSE files have to be built in a separate target, because gcc needs + # different -msse flags for different SSE levels which enable use of SSE + # intrinsics but also allow emission of SSE2 instructions for scalar code. + # gyp does not allow per-file compiler flags. + # For about the same reason, we need to compile the ARM opts files + # separately as well. + { + 'target_name': 'skia_opts', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'conditions': [ + [ 'target_arch != "arm" and target_arch != "mipsel" and \ + target_arch != "arm64" and target_arch != "mips64el"', { + # Chrome builds with -msse2 locally, so sse2_sources could in theory + # be in the regular skia target. But we need skia_opts for arm + # anyway, so putting sse2_sources here is simpler than making this + # conditionally a type none target on x86. + 'sources': [ '<@(sse2_sources)' ], + 'dependencies': [ + 'skia_opts_ssse3', + 'skia_opts_sse41', + 'skia_opts_sse42', + 'skia_opts_avx', + 'skia_opts_avx2', + ], + }], + [ 'target_arch == "arm"', { + 'conditions': [ + [ 'arm_version >= 7', { + 'sources': [ '<@(armv7_sources)' ], + }, { # arm_version < 7 + 'sources': [ '<@(none_sources)' ], + }], + [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', { + 'dependencies': [ + 'skia_opts_neon', + ] + }], + ], + # The assembly uses the frame pointer register (r7 in Thumb/r11 in + # ARM), the compiler doesn't like that. Explicitly remove the + # -fno-omit-frame-pointer flag for Android, as that gets added to all + # targets via common.gypi. + 'cflags!': [ + '-fno-omit-frame-pointer', + '-marm', + '-mapcs-frame', + ], + 'cflags': [ + '-fomit-frame-pointer', + ], + }], + [ 'target_arch == "mipsel"',{ + 'cflags': [ '-fomit-frame-pointer' ], + 'conditions': [ + [ 'mips_dsp_rev >= 1', { + 'sources': [ '<@(mips_dsp_sources)' ], + }, { # mips_dsp_rev == 0 + 'sources': [ '<@(none_sources)' ], + }], + ], + }], + [ 'target_arch == "mips64el"',{ + 'cflags': [ '-fomit-frame-pointer' ], + 'sources': [ '<@(none_sources)' ], + }], + [ 'target_arch == "arm64"', { + 'sources': [ '<@(arm64_sources)' ], + }], + ], + }, + # For the same lame reasons as what is done for skia_opts, we have to + # create another target specifically for SSSE3 code as we would not want + # to compile the SSE2 code with -mssse3 which would potentially allow + # gcc to generate SSSE3 code. + { + 'target_name': 'skia_opts_ssse3', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-mssse3' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', + }, + }], + [ 'OS == "win" and clang == 1', { + # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe + # doesn't need it for intrinsics. clang-cl does need it, though. + 'msvs_settings': { + 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] }, + }, + }], + [ 'OS == "win"', { + 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], + }], + [ 'target_arch != "arm" and target_arch != "arm64" and \ + target_arch != "mipsel" and target_arch != "mips64el"', { + 'sources': [ '<@(ssse3_sources)' ], + }], + ], + }, + # For the same lame reasons as what is done for skia_opts, we also have to + # create another target specifically for SSE4.1 code as we would not want + # to compile the SSE2 code with -msse4.1 which would potentially allow + # gcc to generate SSE4.1 code. + { + 'target_name': 'skia_opts_sse41', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(sse41_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-msse4.1' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES', + }, + }], + [ 'OS == "win" and clang == 1', { + # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe + # doesn't need it for intrinsics. clang-cl does need it, though. + 'msvs_settings': { + 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] }, + }, + }], + [ 'OS == "win"', { + 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], + }], + ], + }, + { + 'target_name': 'skia_opts_sse42', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(sse42_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-msse4.2' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES', + }, + }], + [ 'OS == "win" and clang == 1', { + # cl.exe's /arch flag doesn't have a setting for SSE4.2, and cl.exe + # doesn't need it for intrinsics. clang-cl does need it, though. + 'msvs_settings': { + 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.2' ] }, + }, + }], + [ 'OS == "win"', { + 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ], + }], + ], + }, + { + 'target_name': 'skia_opts_avx', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(avx_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-mavx' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'OTHER_CFLAGS': [ '-mavx' ], + }, + }], + [ 'OS == "win"', { + 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '3' } }, + }], + ], + }, + { + 'target_name': 'skia_opts_avx2', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(avx2_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-mavx2' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'OTHER_CFLAGS': [ '-mavx2' ], + }, + }], + [ 'OS == "win"', { + 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '5' } }, + }], + ], + }, + { + 'target_name': 'skia_opts_none', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(none_sources)' ], + }, + ], + 'conditions': [ + # NEON code must be compiled with -mfpu=neon which also affects scalar + # code. To support dynamic NEON code paths, we need to build all + # NEON-specific sources in a separate static library. The situation + # is very similar to the SSSE3 one. + ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', { + 'targets': [ + { + 'target_name': 'skia_opts_neon', + 'type': 'static_library', + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'cflags!': [ + '-fno-omit-frame-pointer', + '-mfpu=vfp', # remove them all, just in case. + '-mfpu=vfpv3', + '-mfpu=vfpv3-d16', + ], + 'cflags': [ + '-mfpu=neon', + '-fomit-frame-pointer', + ], + 'ldflags': [ + '-march=armv7-a', + '-Wl,--fix-cortex-a8', + ], + 'sources': [ '<@(neon_sources)' ], + }, + ], + }], + ], +} diff --git a/skia/skia_pdfium.gypi b/skia/skia_pdfium.gypi new file mode 100644 index 0000000000..0de3f84d72 --- /dev/null +++ b/skia/skia_pdfium.gypi @@ -0,0 +1,29 @@ +# Copyright 2013 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. + + +# This gypi file contains all the Chrome-specific enhancements to Skia. +# In component mode (shared_lib) it is folded into a single shared library with +# the Skia files but in all other cases it is a separate library. +{ + 'dependencies': [ + 'skia_library', + ], + + 'direct_dependent_settings': { + 'include_dirs': [ + 'ext', + ], + }, + 'variables': { + # TODO(scottmg): http://crbug.com/177306 + 'clang_warning_flags_unset': [ + # Don't warn about string->bool used in asserts. + '-Wstring-conversion', + ], + }, + 'sources': [ + 'ext/google_logging.cc', + ], +} -- cgit v1.2.3