Revert of Change to Shill's IPConfig objects. (patchset #1 id:1 of https://codereview...
[chromium-blink-merge.git] / skia / BUILD.gn
blobe9cc7d2ae4bf4e8c2cb6fc24994561a81f303c8d
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/features.gni")
6 import("//build/config/ui.gni")
7 if (cpu_arch == "arm") {
8   import("//build/config/arm.gni")
11 skia_support_gpu = !is_ios
12 skia_support_pdf = !is_ios && (enable_basic_printing || enable_print_preview)
14 # The list of Skia defines that are to be set for blink.
15 gypi_blink_skia_defines = exec_script(
16     "//build/gypi_to_gn.py",
17     [ rebase_path("//third_party/WebKit/public/blink_skia_config.gypi"),
18       "--replace=<(skia_include_path)=//third_party/skia/include",
19       "--replace=<(skia_src_path)=//third_party/skia/src" ],
20     "scope",
21     [ "//third_party/WebKit/public/blink_skia_config.gypi" ])
23 # The list of Skia defines that are to be set for chromium.
24 gypi_skia_defines = exec_script(
25     "//build/gypi_to_gn.py",
26     [ rebase_path("//third_party/skia/gyp/skia_for_chromium_defines.gypi"),
27       "--replace=<(skia_include_path)=//third_party/skia/include",
28       "--replace=<(skia_src_path)=//third_party/skia/src" ],
29     "scope",
30     [ "//third_party/skia/gyp/skia_for_chromium_defines.gypi" ])
32 # The list of Skia core sources that are to be set for chromium.
33 gypi_skia_core = exec_script(
34     "//build/gypi_to_gn.py",
35     [ rebase_path("//third_party/skia/gyp/core.gypi"),
36       "--replace=<(skia_include_path)=//third_party/skia/include",
37       "--replace=<(skia_src_path)=//third_party/skia/src" ],
38     "scope",
39     [ "//third_party/skia/gyp/core.gypi" ])
41 # The list of Skia gpu sources that are to be set for chromium.
42 gypi_skia_gpu = exec_script(
43     "//build/gypi_to_gn.py",
44     [ rebase_path("//third_party/skia/gyp/gpu.gypi"),
45       "--replace=<(skia_include_path)=//third_party/skia/include",
46       "--replace=<(skia_src_path)=//third_party/skia/src" ],
47     "scope",
48     [ "//third_party/skia/gyp/gpu.gypi" ])
50 # The list of Skia pdf sources that are to be set for chromium.
51 gypi_skia_pdf = exec_script(
52     "//build/gypi_to_gn.py",
53     [ rebase_path("//third_party/skia/gyp/pdf.gypi"),
54       "--replace=<(skia_include_path)=//third_party/skia/include",
55       "--replace=<(skia_src_path)=//third_party/skia/src" ],
56     "scope",
57     [ "//third_party/skia/gyp/pdf.gypi" ])
59 # The list of Skia effects that are to be set for chromium.
60 gypi_skia_effects = exec_script(
61     "//build/gypi_to_gn.py",
62     [ rebase_path("//third_party/skia/gyp/effects.gypi"),
63       "--replace=<(skia_include_path)=//third_party/skia/include",
64       "--replace=<(skia_src_path)=//third_party/skia/src" ],
65     "scope",
66     [ "//third_party/skia/gyp/effects.gypi" ])
68 # The list of Skia utilss that are to be set for chromium.
69 gypi_skia_utils = exec_script(
70     "//build/gypi_to_gn.py",
71     [ rebase_path("//third_party/skia/gyp/utils.gypi"),
72       "--replace=<(skia_include_path)=//third_party/skia/include",
73       "--replace=<(skia_src_path)=//third_party/skia/src" ],
74     "scope",
75     [ "//third_party/skia/gyp/utils.gypi" ])
77 # The list of Skia files is kept in skia_gn_files.gypi. Read it.
78 gypi_values = exec_script(
79     "//build/gypi_to_gn.py",
80     [ rebase_path("skia_gn_files.gypi"),
81       "--replace=<(skia_include_path)=//third_party/skia/include",
82       "--replace=<(skia_src_path)=//third_party/skia/src" ],
83     "scope",
84     [ "skia_gn_files.gypi" ])
86 # External-facing config for dependent code.
87 config("skia_config") {
88   include_dirs = [
89     "config",
90     "ext",
91     "//third_party/skia/include/c",
92     "//third_party/skia/include/config",
93     "//third_party/skia/include/core",
94     "//third_party/skia/include/effects",
95     "//third_party/skia/include/images",
96     "//third_party/skia/include/lazy",
97     "//third_party/skia/include/pathops",
98     "//third_party/skia/include/pdf",
99     "//third_party/skia/include/pipe",
100     "//third_party/skia/include/ports",
101     "//third_party/skia/include/utils",
102     "//third_party/skia/src/core",
103     "//third_party/skia/src/image",
104     "//third_party/skia/src/opts",
105     "//third_party/skia/src/ports",
106     "//third_party/skia/src/sfnt",
107     "//third_party/skia/src/utils",
108     "//third_party/skia/src/lazy",
109   ]
111   defines = gypi_blink_skia_defines.blink_skia_defines
112   defines += gypi_skia_defines.skia_for_chromium_defines
114   defines += [
115     "SK_ENABLE_INST_COUNT=0",
116     "GR_GL_CUSTOM_SETUP_HEADER=\"GrGLConfig_chrome.h\"",
117     "SK_ENABLE_LEGACY_API_ALIASING=1",
118     "SK_ATTR_DEPRECATED=SK_NOTHING_ARG1",
119     "GR_GL_IGNORE_ES3_MSAA=0",
120     "SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT",
121     "SK_SUPPORT_LEGACY_GETTOTALCLIP",
122   ]
124   if (component_mode == "shared_library") {
125     defines += [ "SKIA_DLL" ]
126   }
128   if (skia_support_gpu) {
129     include_dirs += [
130       "//third_party/skia/include/gpu",
131       "//third_party/skia/src/gpu",
132     ]
133     defines += [ "SK_SUPPORT_GPU=1" ]
134   } else {
135     defines += [ "SK_SUPPORT_GPU=0" ]
136   }
138   # For POSIX platforms, prefer the Mutex implementation provided by Skia
139   # since it does not generate static initializers.
140   if (is_posix) {
141     defines += [ "SK_USE_POSIX_THREADS" ]
142   }
144   if (is_android) {
145     defines += [
146       "SK_BUILD_FOR_ANDROID",
147       "USE_CHROMIUM_SKIA",
148     ]
149   }
151   if (is_mac) {
152     defines += [ "SK_BUILD_FOR_MAC" ]
153   }
156 # Internal-facing config for Skia library code.
157 config("skia_library_config") {
158   # These include directories are only included for Skia code and are not
159   # exported to dependents. It's not clear if this is on purpose, but this
160   # matches the GYP build.
161   include_dirs = []
162   if (is_mac || is_ios) {
163     include_dirs += [ "//third_party/skia/include/utils/mac" ]
164   }
165   if (is_mac) {
166     include_dirs += [ "//third_party/skia/include/utils/ios" ]
167   }
169   defines = [
170     #skia_export_defines ???) TODO
172     # skia uses static initializers to initialize the serialization logic
173     # of its "pictures" library. This is currently not used in chrome; if
174     # it ever gets used the processes that use it need to call
175     # SkGraphics::Init().
176     "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0",
178     # Forcing the unoptimized path for the offset image filter in skia until
179     # all filters used in Blink support the optimized path properly
180     "SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION",
182     "IGNORE_ROT_AA_RECT_OPT",
184     "SK_IGNORE_BLURRED_RRECT_OPT",
186     # this flag forces Skia not to use typographic metrics with GDI.
187     "SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS",
189     "SK_USE_DISCARDABLE_SCALEDIMAGECACHE",
190   ]
192   if (component_mode == "shared_library") {
193     defines += [ "SKIA_IMPLEMENTATION=1" ]
194   }
196   if (cpu_arch == "arm") {
197     if (arm_use_neon) {
198       defines += [ "SK_ARM_HAS_NEON" ]
199     }
200     if (arm_optionally_use_neon) {
201       defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ]
202     }
203   }
205   # Settings for text blitting, chosen to approximate the system browser.
206   if (is_linux) {
207     defines += [
208       "SK_GAMMA_EXPONENT=1.2",
209       "SK_GAMMA_CONTRAST=0.2",
210       "SK_HIGH_QUALITY_IS_LANCZOS",
211     ]
212   } else if (is_android) {
213     defines += [
214       "SK_GAMMA_APPLY_TO_A8",
215       "SK_GAMMA_EXPONENT=1.4",
216       "SK_GAMMA_CONTRAST=0.0",
217     ]
218   } else if (is_win) {
219     defines += [
220       "SK_GAMMA_SRGB",
221       "SK_GAMMA_CONTRAST=0.5",
222       "SK_HIGH_QUALITY_IS_LANCZOS",
223     ]
224   } else if (is_mac) {
225     defines += [
226       "SK_GAMMA_SRGB",
227       "SK_GAMMA_CONTRAST=0.0",
228       "SK_HIGH_QUALITY_IS_LANCZOS",
229     ]
230   }
232   if (is_android) {
233     defines += [
234       # Android devices are typically more memory constrained, so default to a
235       # smaller glyph cache (it may be overriden at runtime when the renderer
236       # starts up, depending on the actual device memory).
237       "SK_DEFAULT_FONT_CACHE_LIMIT=1048576"  # 1024 * 1024
238     ]
239   } else {
240     defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ]  # 20 * 1024 * 1024
241   }
243   if (is_win) {
244     include_dirs = [
245       "//third_party/skia/include/utils/win",
246       "//third_party/skia/src/utils/win",
247     ]
249     defines += [ "SK_FONTHOST_USES_FONTMGR" ]
251     cflags = [
252       "/wd4244", # conversion from 'type1( __int64)' to 'type2 (unsigned int)'
253       "/wd4267", # conversion from 'size_t' (64 bit) to 'type'(32 bit).
254       "/wd4341", # signed value is out of range for enum constant.
255       "/wd4345", # Object is default-initialized if initialization is omitted.
256       "/wd4390", # ';'empty statement found in looping;is it what was intended?
257       "/wd4554", # 'operator' : check operator precedence for possible error
258       "/wd4748", # compiler will disable optimizations if a function has inline
259                  # assembly code contains flow control(jmp or jcc) statements.
260       "/wd4800", # forcing value to bool 'true/false'(assigning int to bool).
261     ]
262   }
265 component("skia") {
266   sources = [
267     # Chrome sources.
268     "config/SkUserConfig.h",
269     "ext/analysis_canvas.cc",
270     "ext/analysis_canvas.h",
271     "ext/benchmarking_canvas.cc",
272     "ext/benchmarking_canvas.h",
273     "ext/bitmap_platform_device.h",
274     "ext/convolver.cc",
275     "ext/convolver.h",
276     "ext/event_tracer_impl.cc",
277     "ext/event_tracer_impl.h",
278     "ext/fontmgr_default_win.cc",
279     "ext/fontmgr_default_win.h",
280     "ext/google_logging.cc",
281     "ext/image_operations.cc",
282     "ext/image_operations.h",
283     "ext/lazy_pixel_ref.cc",
284     "ext/lazy_pixel_ref.h",
285     "ext/SkThread_chrome.cc",
286     "ext/opacity_draw_filter.cc",
287     "ext/opacity_draw_filter.h",
288     "ext/pixel_ref_utils.cc",
289     "ext/pixel_ref_utils.h",
290     "ext/platform_canvas.cc",
291     "ext/platform_canvas.h",
292     "ext/platform_device.cc",
293     "ext/platform_device.h",
294     "ext/platform_device_linux.cc",
295     "ext/platform_device_mac.cc",
296     "ext/platform_device_win.cc",
297     "ext/recursive_gaussian_convolution.cc",
298     "ext/recursive_gaussian_convolution.h",
299     "ext/refptr.h",
300     "ext/SkDiscardableMemory_chrome.h",
301     "ext/SkDiscardableMemory_chrome.cc",
302     "ext/SkMemory_new_handler.cpp",
303     "ext/skia_utils_base.cc",
304     "ext/skia_utils_base.h",
305     "ext/skia_utils_ios.mm",
306     "ext/skia_utils_ios.h",
307     "ext/skia_utils_mac.mm",
308     "ext/skia_utils_mac.h",
309     "ext/skia_utils_win.cc",
310     "ext/skia_utils_win.h",
311     "ext/vector_canvas.h",
312     "ext/vector_platform_device_emf_win.cc",
313     "ext/vector_platform_device_emf_win.h",
314   ]
316   # The skia gypi values are relative to the skia_dir, so we need to rebase.
317   sources += gypi_skia_core.sources
318   sources += gypi_skia_effects.sources
319   sources += gypi_skia_utils.sources
320   sources += gypi_values.skia_library_sources
322   if (cpu_arch == "arm") {
323     sources += [
324       "//third_party/skia/src/core/SkUtilsArm.cpp",
325       "//third_party/skia/src/core/SkUtilsArm.h",
326     ]
327   }
329   # GPU
330   if (skia_support_gpu) {
331     sources += gypi_skia_gpu.skgpu_sources
332     sources += gypi_skia_gpu.skgpu_null_gl_sources
333   }
335   # Remove unused util files include in utils.gypi
336   sources -= [
337   "//third_party/skia/include/utils/SkBoundaryPatch.h",
338   "//third_party/skia/include/utils/SkFrontBufferedStream.h",
339   "//third_party/skia/include/utils/SkCamera.h",
340   "//third_party/skia/include/utils/SkCanvasStateUtils.h",
341   "//third_party/skia/include/utils/SkCubicInterval.h",
342   "//third_party/skia/include/utils/SkCullPoints.h",
343   "//third_party/skia/include/utils/SkDebugUtils.h",
344   "//third_party/skia/include/utils/SkDumpCanvas.h",
345   "//third_party/skia/include/utils/SkEventTracer.h",
346   "//third_party/skia/include/utils/SkInterpolator.h",
347   "//third_party/skia/include/utils/SkLayer.h",
348   "//third_party/skia/include/utils/SkMeshUtils.h",
349   "//third_party/skia/include/utils/SkNinePatch.h",
350   "//third_party/skia/include/utils/SkParse.h",
351   "//third_party/skia/include/utils/SkParsePaint.h",
352   "//third_party/skia/include/utils/SkParsePath.h",
353   "//third_party/skia/include/utils/SkRandom.h",
355   "//third_party/skia/src/utils/SkBitmapHasher.cpp",
356   "//third_party/skia/src/utils/SkBitmapHasher.h",
357   "//third_party/skia/src/utils/SkBoundaryPatch.cpp",
358   "//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
359   "//third_party/skia/src/utils/SkCamera.cpp",
360   "//third_party/skia/src/utils/SkCanvasStack.h",
361   "//third_party/skia/src/utils/SkCubicInterval.cpp",
362   "//third_party/skia/src/utils/SkCullPoints.cpp",
363   "//third_party/skia/src/utils/SkDumpCanvas.cpp",
364   "//third_party/skia/src/utils/SkFloatUtils.h",
365   "//third_party/skia/src/utils/SkGatherPixelRefsAndRects.cpp",
366   "//third_party/skia/src/utils/SkGatherPixelRefsAndRects.h",
367   "//third_party/skia/src/utils/SkInterpolator.cpp",
368   "//third_party/skia/src/utils/SkLayer.cpp",
369   "//third_party/skia/src/utils/SkMD5.cpp",
370   "//third_party/skia/src/utils/SkMD5.h",
371   "//third_party/skia/src/utils/SkMeshUtils.cpp",
372   "//third_party/skia/src/utils/SkNinePatch.cpp",
373   "//third_party/skia/src/utils/SkOSFile.cpp",
374   "//third_party/skia/src/utils/SkParse.cpp",
375   "//third_party/skia/src/utils/SkParseColor.cpp",
376   "//third_party/skia/src/utils/SkParsePath.cpp",
377   "//third_party/skia/src/utils/SkPathUtils.cpp",
378   "//third_party/skia/src/utils/SkSHA1.cpp",
379   "//third_party/skia/src/utils/SkSHA1.h",
380   "//third_party/skia/src/utils/SkTFitsIn.h",
381   "//third_party/skia/src/utils/SkTLogic.h",
383   # We don't currently need to change thread affinity, so leave out this complexity for now.
384   "//third_party/skia/src/utils/SkThreadUtils_pthread_mach.cpp",
385   "//third_party/skia/src/utils/SkThreadUtils_pthread_linux.cpp",
387   #testing
388   "//third_party/skia/src/fonts/SkGScalerContext.cpp",
389   "//third_party/skia/src/fonts/SkGScalerContext.h",
390   ]
392   if (is_win) {
393     sources -= [
394       # Keeping _win.cpp
395       "//third_party/skia/src/utils/SkThreadUtils_pthread.cpp",
396       "//third_party/skia/src/utils/SkThreadUtils_pthread_other.cpp",
397     ]
398   } else {
399     sources -= [
400       # Keeping _pthread.cpp and _pthread_other.cpp.
401       "//third_party/skia/src/utils/SkThreadUtils_win.cpp",
402     ]
403   }
405   # need separate win section to handle chromes auto gn filter
406   # (build/config/BUILDCONFIG.gn)
407   if (is_win) {
408     sources -= [
409       #windows
410       "//third_party/skia/include/utils/win/SkAutoCoInitialize.h",
411       "//third_party/skia/include/utils/win/SkHRESULT.h",
412       "//third_party/skia/include/utils/win/SkIStream.h",
413       "//third_party/skia/include/utils/win/SkTScopedComPtr.h",
414       "//third_party/skia/src/utils/win/SkAutoCoInitialize.cpp",
415       "//third_party/skia/src/utils/win/SkIStream.cpp",
416       "//third_party/skia/src/utils/win/SkWGL_win.cpp",
417     ]
418   }
420   # Fixup Chrome sources.
421   if (is_posix) {
422     sources -= [ "ext/SkThread_chrome.cc" ]
423   }
424   if (is_win) {
425     sources -= [ "ext/SkThread_chrome.cc" ]
426   }
427   if (is_android && (!enable_basic_printing && !enable_print_preview)) {
428     sources -= [
429       "ext/skia_utils_base.cc",
430     ]
431   }
433   # Fixup skia library sources.
434   if (is_win) {
435     sources -= [
436       "//third_party/skia/src/ports/SkOSFile_posix.cpp",
437       "//third_party/skia/src/ports/SkTime_Unix.cpp",
438       "//third_party/skia/src/ports/SkTLS_pthread.cpp",
439     ]
440   } else {
441     sources -= [
442       "//third_party/skia/src/ports/SkFontHost_win.cpp",
443       "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
444       "//third_party/skia/src/ports/SkOSFile_win.cpp",
445       "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
446       "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
447       "//third_party/skia/src/ports/SkScalerContext_win_dw.h",
448       "//third_party/skia/src/ports/SkTLS_win.cpp",
449       "//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
450       "//third_party/skia/src/ports/SkTypeface_win_dw.h",
451     ]
452   }
453   if (!is_android) {
454     sources -= [
455       "//third_party/skia/src/ports/SkFontConfigParser_android.cpp",
456       "//third_party/skia/src/ports/SkFontMgr_android.cpp",
457     ]
458   }
459   if (!is_mac) {
460     sources -= [
461       "//third_party/skia/src/ports/SkFontHost_mac.cpp",
462     ]
463   }
465   if (!is_linux) {
466     sources -= [
467       "//third_party/skia/src/ports/SkFontHost_fontconfig.cpp",
468       "//third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp",
469       "//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
470     ]
471   }
473   if (!is_linux && !is_android) {
474     sources -= [
475       "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
476       "//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
477     ]
478   }
480   # Select the right BitmapPlatformDevice.
481   if (is_win) {
482     sources += [
483       "ext/bitmap_platform_device_win.cc",
484       "ext/bitmap_platform_device_win.h",
485     ]
486   } else if (is_mac) {
487     sources += [
488       "ext/bitmap_platform_device_mac.cc",
489       "ext/bitmap_platform_device_mac.h",
490     ]
491   } else if (use_cairo) {
492     sources += [
493       "ext/bitmap_platform_device_cairo.cc",
494       "ext/bitmap_platform_device_cairo.h",
495     ]
496   } else {
497     sources += [
498       "ext/bitmap_platform_device_skia.cc",
499       "ext/bitmap_platform_device_skia.h",
500     ]
501   }
503   if (is_clang) {
504     # Skia won't compile with some of the more strict clang warnings.
505     # e.g. it does:
506     #  SkASSERT(!"sk_out_of_memory");
507     configs -= [ "//build/config/clang:extra_warnings" ]
508   }
510   configs -= [ "//build/config/compiler:chromium_code" ]
511   configs += [
512     ":skia_library_config",
513     "//build/config/compiler:no_chromium_code"
514   ]
515   public_configs = [ ":skia_config" ]
517   deps = [
518     ":skia_opts",
519     "//base",
520     "//base/third_party/dynamic_annotations",
521     "//third_party/zlib",
522   ]
524   if (is_win) {
525     configs -= [
526       # Some files define WIN32_LEAN_AND_MEAN and we want to avoid a duplicate
527       # definition warning.
528       "//build/config/win:lean_and_mean",
529     ]
530   }
532   if (is_linux) {
533     configs += [
534       "//build/config/linux:fontconfig",
535       "//build/config/linux:freetype2",
536       "//build/config/linux:pangocairo",
537     ]
538     deps += [
539       "//third_party/icu:icuuc",
540     ]
541   }
543   if (is_android) {
544     set_sources_assignment_filter([])
545     sources += [
546       "ext/platform_device_linux.cc",
547     ]
548     set_sources_assignment_filter(sources_assignment_filter)
549     deps += [
550       "//third_party/expat",
551       "//third_party/freetype",
552       "//third_party/android_tools:cpu_features",
553     ]
554   }
556   if (skia_support_pdf) {
557     deps += [ "//third_party/sfntly" ]
558     sources += gypi_skia_pdf.sources
559   }
561   if (is_android && !is_debug) {
562     configs -= [ "//build/config/compiler:optimize" ]
563     configs += [ "//build/config/compiler:optimize_max" ]
564   }
567 # Separated out so it can be compiled with different flags for SSE.
568 source_set("skia_opts") {
569   cflags = []
570   defines = []
572   if (cpu_arch == "x86" || cpu_arch == "x64") {
573     sources = [
574       "//third_party/skia/src/opts/SkTextureCompression_opts_none.cpp",
576       # SSE 2
577       "//third_party/skia/src/opts/opts_check_x86.cpp",
578       "//third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp",
579       "//third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp",
580       "//third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp",
581       "//third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp",
582       "//third_party/skia/src/opts/SkBlurImage_opts_SSE2.cpp",
583       "//third_party/skia/src/opts/SkMorphology_opts_SSE2.cpp",
584       "//third_party/skia/src/opts/SkUtils_opts_SSE2.cpp",
585       "//third_party/skia/src/opts/SkXfermode_opts_SSE2.cpp",
587       # SSSE 3
588       "//third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp",
590       # SSE 4
591       "//third_party/skia/src/opts/SkBlurImage_opts_SSE4.cpp",
593       # Chrome-specific.
594       "ext/convolver_SSE2.cc",
596       # These are header files used by this target from the skia one above.
597       "ext/convolver.h",
598       "//third_party/skia/include/core/SkTypes.h",
599     ]
601     if (!is_win) {
602       # SSE 4
603       if (cpu_arch == "x86") {
604         sources += [ "//third_party/skia/src/opts/SkBlitRow_opts_SSE4_asm.S" ]
605       } else {  # x64
606         sources += [
607           "//third_party/skia/src/opts/SkBlitRow_opts_SSE4_x64_asm.S"
608         ]
609       }
610     }
612     if (is_linux || is_mac) {
613       cflags += [ "-msse4.1" ]
614     }
615   } else if (cpu_arch == "arm") {
616     sources = [
617       "//third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp",
618     ]
620     # The assembly uses the frame pointer register (r7 in Thumb/r11 in
621     # ARM), the compiler doesn't like that.
622     cflags += [ "-fomit-frame-pointer" ]
624     if (arm_version >= 7) {
625       if (arm_use_neon || arm_optionally_use_neon) {
626         sources += [
627           "//third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp",
628           "//third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp",
629           "//third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h",
630           "//third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h",
631           "//third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp",
632           "//third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp",
633           "//third_party/skia/src/opts/SkBlurImage_opts_neon.cpp",
634           "//third_party/skia/src/opts/SkMorphology_opts_neon.cpp",
635           "//third_party/skia/src/opts/SkTextureCompression_opts_neon.cpp",
636           "//third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp",
637           "//third_party/skia/src/opts/memset16_neon.S",
638           "//third_party/skia/src/opts/memset32_neon.S",
639         ]
641         # Root build config sets -mfpu=$arm_fpu, which we expect to be neon
642         # when running this.
643         if (!arm_use_neon) {
644           configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
645           cflags += [
646             "-mfpu=neon"
647           ]
648         }
650         #ldflags = [
651         #  "-march=armv7-a",
652         #  "-Wl,--fix-cortex-a8",
653         #]
654       }
655     }
657     # Non-Neon ARM code.
658     if (arm_version < 7 || !arm_use_neon) {
659       sources += [ "//third_party/skia/src/opts/memset.arm.S" ]
660     }
662     if (arm_version < 6) {
663       sources += [
664         "//third_party/skia/src/opts/SkBlitMask_opts_none.cpp",
665         "//third_party/skia/src/opts/SkBlitRow_opts_none.cpp",
666         "//third_party/skia/src/opts/SkBlurImage_opts_none.cpp",
667         "//third_party/skia/src/opts/SkMorphology_opts_none.cpp",
668         "//third_party/skia/src/opts/SkTextureCompression_opts_none.cpp",
669         "//third_party/skia/src/opts/SkUtils_opts_none.cpp",
670         "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
671       ]
672     } else {
673       # arm version >= 6.
674       sources += [
675         "//third_party/skia/src/opts/SkBlitMask_opts_arm.cpp",
676         "//third_party/skia/src/opts/SkBlitRow_opts_arm.cpp",
677         "//third_party/skia/src/opts/SkBlitRow_opts_arm.h",
678         "//third_party/skia/src/opts/SkBlurImage_opts_arm.cpp",
679         "//third_party/skia/src/opts/SkMorphology_opts_arm.cpp",
680         "//third_party/skia/src/opts/SkTextureCompression_opts_arm.cpp",
681         "//third_party/skia/src/opts/SkUtils_opts_arm.cpp",
682         "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
683       ]
684     }
686   } else if (cpu_arch == "mipsel") {
687     cflags += [ "-fomit-frame-pointer" ]
688     sources = [
689       "//third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp",
690       "//third_party/skia/src/opts/SkBlitMask_opts_none.cpp",
691       "//third_party/skia/src/opts/SkBlitRow_opts_none.cpp",
692       "//third_party/skia/src/opts/SkBlurImage_opts_none.cpp",
693       "//third_party/skia/src/opts/SkMorphology_opts_none.cpp",
694       "//third_party/skia/src/opts/SkTextureCompression_opts_none.cpp",
695       "//third_party/skia/src/opts/SkUtils_opts_none.cpp",
696       "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
697     ]
698   } else {
699     assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
700   }
702   if (is_android && !is_debug) {
703     configs -= [ "//build/config/compiler:optimize" ]
704     configs += [ "//build/config/compiler:optimize_max" ]
705   }
707   configs -= [ "//build/config/compiler:chromium_code" ]
708   configs += [
709     ":skia_config",
710     ":skia_library_config",
711     "//build/config/compiler:no_chromium_code"
712   ]
714   deps = [
715     "//base",
716   ]
718   visibility = [ ":skia" ]