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