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