Include chrome_elf pdb in chrome-win32-syms.zip
[chromium-blink-merge.git] / skia / BUILD.gn
blob8d23c068d17d1de7c862f3bef720d1f93486a933
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 =
16     exec_script("//build/gypi_to_gn.py",
17                 [
18                   rebase_path(
19                       "//third_party/WebKit/public/blink_skia_config.gypi"),
20                   "--replace=<(skia_include_path)=//third_party/skia/include",
21                   "--replace=<(skia_src_path)=//third_party/skia/src",
22                 ],
23                 "scope",
24                 [ "//third_party/WebKit/public/blink_skia_config.gypi" ])
26 # The list of Skia defines that are to be set for chromium.
27 gypi_skia_defines =
28     exec_script("//build/gypi_to_gn.py",
29                 [
30                   rebase_path(
31                       "//third_party/skia/gyp/skia_for_chromium_defines.gypi"),
32                   "--replace=<(skia_include_path)=//third_party/skia/include",
33                   "--replace=<(skia_src_path)=//third_party/skia/src",
34                 ],
35                 "scope",
36                 [ "//third_party/skia/gyp/skia_for_chromium_defines.gypi" ])
38 # The list of Skia core sources that are to be set for chromium.
39 gypi_skia_core =
40     exec_script("//build/gypi_to_gn.py",
41                 [
42                   rebase_path("//third_party/skia/gyp/core.gypi"),
43                   "--replace=<(skia_include_path)=//third_party/skia/include",
44                   "--replace=<(skia_src_path)=//third_party/skia/src",
45                 ],
46                 "scope",
47                 [ "//third_party/skia/gyp/core.gypi" ])
49 # The list of Skia gpu sources that are to be set for chromium.
50 gypi_skia_gpu =
51     exec_script("//build/gypi_to_gn.py",
52                 [
53                   rebase_path("//third_party/skia/gyp/gpu.gypi"),
54                   "--replace=<(skia_include_path)=//third_party/skia/include",
55                   "--replace=<(skia_src_path)=//third_party/skia/src",
56                 ],
57                 "scope",
58                 [ "//third_party/skia/gyp/gpu.gypi" ])
60 # The list of Skia pdf sources that are to be set for chromium.
61 gypi_skia_pdf =
62     exec_script("//build/gypi_to_gn.py",
63                 [
64                   rebase_path("//third_party/skia/gyp/pdf.gypi"),
65                   "--replace=<(skia_include_path)=//third_party/skia/include",
66                   "--replace=<(skia_src_path)=//third_party/skia/src",
67                 ],
68                 "scope",
69                 [ "//third_party/skia/gyp/pdf.gypi" ])
71 # The list of Skia effects that are to be set for chromium.
72 gypi_skia_effects =
73     exec_script("//build/gypi_to_gn.py",
74                 [
75                   rebase_path("//third_party/skia/gyp/effects.gypi"),
76                   "--replace=<(skia_include_path)=//third_party/skia/include",
77                   "--replace=<(skia_src_path)=//third_party/skia/src",
78                 ],
79                 "scope",
80                 [ "//third_party/skia/gyp/effects.gypi" ])
82 # The list of Skia utilss that are to be set for chromium.
83 gypi_skia_utils =
84     exec_script("//build/gypi_to_gn.py",
85                 [
86                   rebase_path("//third_party/skia/gyp/utils.gypi"),
87                   "--replace=<(skia_include_path)=//third_party/skia/include",
88                   "--replace=<(skia_src_path)=//third_party/skia/src",
89                 ],
90                 "scope",
91                 [ "//third_party/skia/gyp/utils.gypi" ])
93 # The list of Skia files is kept in skia_gn_files.gypi. Read it.
94 gypi_values =
95     exec_script("//build/gypi_to_gn.py",
96                 [
97                   rebase_path("skia_gn_files.gypi"),
98                   "--replace=<(skia_include_path)=//third_party/skia/include",
99                   "--replace=<(skia_src_path)=//third_party/skia/src",
100                 ],
101                 "scope",
102                 [ "skia_gn_files.gypi" ])
104 # External-facing config for dependent code.
105 config("skia_config") {
106   include_dirs = [
107     "config",
108     "ext",
109     "//third_party/skia/include/c",
110     "//third_party/skia/include/config",
111     "//third_party/skia/include/core",
112     "//third_party/skia/include/effects",
113     "//third_party/skia/include/images",
114     "//third_party/skia/include/lazy",
115     "//third_party/skia/include/pathops",
116     "//third_party/skia/include/pdf",
117     "//third_party/skia/include/pipe",
118     "//third_party/skia/include/ports",
119     "//third_party/skia/include/utils",
120     "//third_party/skia/src/core",
121     "//third_party/skia/src/image",
122     "//third_party/skia/src/opts",
123     "//third_party/skia/src/ports",
124     "//third_party/skia/src/sfnt",
125     "//third_party/skia/src/utils",
126     "//third_party/skia/src/lazy",
127   ]
129   defines = gypi_blink_skia_defines.blink_skia_defines
130   defines += gypi_skia_defines.skia_for_chromium_defines
132   defines += [
133     "SK_ENABLE_INST_COUNT=0",
134     "GR_GL_CUSTOM_SETUP_HEADER=\"GrGLConfig_chrome.h\"",
135     "SK_ENABLE_LEGACY_API_ALIASING=1",
136     "SK_ATTR_DEPRECATED=SK_NOTHING_ARG1",
137     "GR_GL_IGNORE_ES3_MSAA=0",
138     "SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT",
139     "SK_SUPPORT_LEGACY_GETTOTALCLIP",
140   ]
142   if (component_mode == "shared_library") {
143     defines += [ "SKIA_DLL" ]
144   }
146   if (skia_support_gpu) {
147     include_dirs += [
148       "//third_party/skia/include/gpu",
149       "//third_party/skia/src/gpu",
150     ]
151     defines += [ "SK_SUPPORT_GPU=1" ]
152   } else {
153     defines += [ "SK_SUPPORT_GPU=0" ]
154   }
156   # For POSIX platforms, prefer the Mutex implementation provided by Skia
157   # since it does not generate static initializers.
158   if (is_posix) {
159     defines += [ "SK_USE_POSIX_THREADS" ]
160   }
162   if (is_android) {
163     defines += [
164       "SK_BUILD_FOR_ANDROID",
165       "USE_CHROMIUM_SKIA",
166     ]
167   }
169   if (is_mac) {
170     defines += [ "SK_BUILD_FOR_MAC" ]
171   }
174 # Internal-facing config for Skia library code.
175 config("skia_library_config") {
176   # These include directories are only included for Skia code and are not
177   # exported to dependents. It's not clear if this is on purpose, but this
178   # matches the GYP build.
179   include_dirs = []
180   if (is_mac || is_ios) {
181     include_dirs += [ "//third_party/skia/include/utils/mac" ]
182   }
183   if (is_mac) {
184     include_dirs += [ "//third_party/skia/include/utils/ios" ]
185   }
187   defines = [
188     #skia_export_defines ???) TODO
190     # skia uses static initializers to initialize the serialization logic
191     # of its "pictures" library. This is currently not used in chrome; if
192     # it ever gets used the processes that use it need to call
193     # SkGraphics::Init().
194     "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0",
196     # Forcing the unoptimized path for the offset image filter in skia until
197     # all filters used in Blink support the optimized path properly
198     "SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION",
199     "IGNORE_ROT_AA_RECT_OPT",
200     "SK_IGNORE_BLURRED_RRECT_OPT",
202     # this flag forces Skia not to use typographic metrics with GDI.
203     "SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS",
204     "SK_USE_DISCARDABLE_SCALEDIMAGECACHE",
205   ]
207   if (component_mode == "shared_library") {
208     defines += [ "SKIA_IMPLEMENTATION=1" ]
209   }
211   if (cpu_arch == "arm") {
212     if (arm_use_neon) {
213       defines += [ "SK_ARM_HAS_NEON" ]
214     }
215     if (arm_optionally_use_neon) {
216       defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ]
217     }
218   }
220   # Settings for text blitting, chosen to approximate the system browser.
221   if (is_linux) {
222     defines += [
223       "SK_GAMMA_EXPONENT=1.2",
224       "SK_GAMMA_CONTRAST=0.2",
225       "SK_HIGH_QUALITY_IS_LANCZOS",
226     ]
227   } else if (is_android) {
228     defines += [
229       "SK_GAMMA_APPLY_TO_A8",
230       "SK_GAMMA_EXPONENT=1.4",
231       "SK_GAMMA_CONTRAST=0.0",
232     ]
233   } else if (is_win) {
234     defines += [
235       "SK_GAMMA_SRGB",
236       "SK_GAMMA_CONTRAST=0.5",
237       "SK_HIGH_QUALITY_IS_LANCZOS",
238     ]
239   } else if (is_mac) {
240     defines += [
241       "SK_GAMMA_SRGB",
242       "SK_GAMMA_CONTRAST=0.0",
243       "SK_HIGH_QUALITY_IS_LANCZOS",
244     ]
245   }
247   if (is_android) {
248     defines += [
249       # Android devices are typically more memory constrained, so default to a
250       # smaller glyph cache (it may be overriden at runtime when the renderer
251       # starts up, depending on the actual device memory).
252       "SK_DEFAULT_FONT_CACHE_LIMIT=1048576",  # 1024 * 1024
253     ]
254   } else {
255     defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ]  # 20 * 1024 * 1024
256   }
258   if (is_win) {
259     include_dirs = [
260       "//third_party/skia/include/utils/win",
261       "//third_party/skia/src/utils/win",
262     ]
264     defines += [ "SK_FONTHOST_USES_FONTMGR" ]
266     cflags = [
267       "/wd4244",  # conversion from 'type1( __int64)' to 'type2 (unsigned int)'
268       "/wd4267",  # conversion from 'size_t' (64 bit) to 'type'(32 bit).
269       "/wd4341",  # signed value is out of range for enum constant.
270       "/wd4345",  # Object is default-initialized if initialization is omitted.
271       "/wd4390",  # ';'empty statement found in looping;is it what was intended?
272       "/wd4554",  # 'operator' : check operator precedence for possible error
273       "/wd4748",  # compiler will disable optimizations if a function has inline
274                   # assembly code contains flow control(jmp or jcc) statements.
275       "/wd4800",  # forcing value to bool 'true/false'(assigning int to bool).
276     ]
277   }
280 component("skia") {
281   sources = [
282     # Chrome sources.
283     "config/SkUserConfig.h",
284     "ext/analysis_canvas.cc",
285     "ext/analysis_canvas.h",
286     "ext/benchmarking_canvas.cc",
287     "ext/benchmarking_canvas.h",
288     "ext/bitmap_platform_device.h",
289     "ext/convolver.cc",
290     "ext/convolver.h",
291     "ext/event_tracer_impl.cc",
292     "ext/event_tracer_impl.h",
293     "ext/fontmgr_default_win.cc",
294     "ext/fontmgr_default_win.h",
295     "ext/google_logging.cc",
296     "ext/image_operations.cc",
297     "ext/image_operations.h",
298     "ext/opacity_draw_filter.cc",
299     "ext/opacity_draw_filter.h",
300     "ext/pixel_ref_utils.cc",
301     "ext/pixel_ref_utils.h",
302     "ext/platform_canvas.cc",
303     "ext/platform_canvas.h",
304     "ext/platform_device.cc",
305     "ext/platform_device.h",
306     "ext/platform_device_linux.cc",
307     "ext/platform_device_mac.cc",
308     "ext/platform_device_win.cc",
309     "ext/recursive_gaussian_convolution.cc",
310     "ext/recursive_gaussian_convolution.h",
311     "ext/refptr.h",
312     "ext/SkDiscardableMemory_chrome.h",
313     "ext/SkDiscardableMemory_chrome.cc",
314     "ext/SkMemory_new_handler.cpp",
315     "ext/skia_utils_base.cc",
316     "ext/skia_utils_base.h",
317     "ext/skia_utils_ios.mm",
318     "ext/skia_utils_ios.h",
319     "ext/skia_utils_mac.mm",
320     "ext/skia_utils_mac.h",
321     "ext/skia_utils_win.cc",
322     "ext/skia_utils_win.h",
323     "ext/vector_canvas.h",
324     "ext/vector_platform_device_emf_win.cc",
325     "ext/vector_platform_device_emf_win.h",
326   ]
328   # The skia gypi values are relative to the skia_dir, so we need to rebase.
329   sources += gypi_skia_core.sources
330   sources += gypi_skia_effects.sources
331   sources += gypi_skia_utils.sources
332   sources += gypi_values.skia_library_sources
334   if (cpu_arch == "arm") {
335     sources += [
336       "//third_party/skia/src/core/SkUtilsArm.cpp",
337       "//third_party/skia/src/core/SkUtilsArm.h",
338     ]
339   }
341   # GPU
342   if (skia_support_gpu) {
343     sources += gypi_skia_gpu.skgpu_sources
344     sources += gypi_skia_gpu.skgpu_null_gl_sources
345   }
347   # Remove unused util files include in utils.gypi
348   sources -= [
349     "//third_party/skia/include/utils/SkBoundaryPatch.h",
350     "//third_party/skia/include/utils/SkFrontBufferedStream.h",
351     "//third_party/skia/include/utils/SkCamera.h",
352     "//third_party/skia/include/utils/SkCanvasStateUtils.h",
353     "//third_party/skia/include/utils/SkCubicInterval.h",
354     "//third_party/skia/include/utils/SkCullPoints.h",
355     "//third_party/skia/include/utils/SkDebugUtils.h",
356     "//third_party/skia/include/utils/SkDumpCanvas.h",
357     "//third_party/skia/include/utils/SkEventTracer.h",
358     "//third_party/skia/include/utils/SkInterpolator.h",
359     "//third_party/skia/include/utils/SkLayer.h",
360     "//third_party/skia/include/utils/SkMeshUtils.h",
361     "//third_party/skia/include/utils/SkNinePatch.h",
362     "//third_party/skia/include/utils/SkParse.h",
363     "//third_party/skia/include/utils/SkParsePaint.h",
364     "//third_party/skia/include/utils/SkParsePath.h",
365     "//third_party/skia/include/utils/SkRandom.h",
366     "//third_party/skia/src/utils/SkBitmapHasher.cpp",
367     "//third_party/skia/src/utils/SkBitmapHasher.h",
368     "//third_party/skia/src/utils/SkBoundaryPatch.cpp",
369     "//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
370     "//third_party/skia/src/utils/SkCamera.cpp",
371     "//third_party/skia/src/utils/SkCanvasStack.h",
372     "//third_party/skia/src/utils/SkCubicInterval.cpp",
373     "//third_party/skia/src/utils/SkCullPoints.cpp",
374     "//third_party/skia/src/utils/SkDumpCanvas.cpp",
375     "//third_party/skia/src/utils/SkFloatUtils.h",
376     "//third_party/skia/src/utils/SkGatherPixelRefsAndRects.cpp",
377     "//third_party/skia/src/utils/SkGatherPixelRefsAndRects.h",
378     "//third_party/skia/src/utils/SkInterpolator.cpp",
379     "//third_party/skia/src/utils/SkLayer.cpp",
380     "//third_party/skia/src/utils/SkMD5.cpp",
381     "//third_party/skia/src/utils/SkMD5.h",
382     "//third_party/skia/src/utils/SkMeshUtils.cpp",
383     "//third_party/skia/src/utils/SkNinePatch.cpp",
384     "//third_party/skia/src/utils/SkOSFile.cpp",
385     "//third_party/skia/src/utils/SkParse.cpp",
386     "//third_party/skia/src/utils/SkParseColor.cpp",
387     "//third_party/skia/src/utils/SkParsePath.cpp",
388     "//third_party/skia/src/utils/SkPathUtils.cpp",
389     "//third_party/skia/src/utils/SkSHA1.cpp",
390     "//third_party/skia/src/utils/SkSHA1.h",
391     "//third_party/skia/src/utils/SkTFitsIn.h",
392     "//third_party/skia/src/utils/SkTLogic.h",
394     # We don't currently need to change thread affinity, so leave out this complexity for now.
395     "//third_party/skia/src/utils/SkThreadUtils_pthread_mach.cpp",
396     "//third_party/skia/src/utils/SkThreadUtils_pthread_linux.cpp",
398     #testing
399     "//third_party/skia/src/fonts/SkGScalerContext.cpp",
400     "//third_party/skia/src/fonts/SkGScalerContext.h",
401   ]
403   if (is_win) {
404     sources -= [
405       # Keeping _win.cpp
406       "//third_party/skia/src/utils/SkThreadUtils_pthread.cpp",
407       "//third_party/skia/src/utils/SkThreadUtils_pthread_other.cpp",
408     ]
409   } else {
410     sources -= [
411       # Keeping _pthread.cpp and _pthread_other.cpp.
412       "//third_party/skia/src/utils/SkThreadUtils_win.cpp",
413     ]
414   }
416   # need separate win section to handle chromes auto gn filter
417   # (build/config/BUILDCONFIG.gn)
418   if (is_win) {
419     sources -= [
420       #windows
421       "//third_party/skia/include/utils/win/SkAutoCoInitialize.h",
422       "//third_party/skia/include/utils/win/SkHRESULT.h",
423       "//third_party/skia/include/utils/win/SkIStream.h",
424       "//third_party/skia/include/utils/win/SkTScopedComPtr.h",
425       "//third_party/skia/src/utils/win/SkAutoCoInitialize.cpp",
426       "//third_party/skia/src/utils/win/SkIStream.cpp",
427       "//third_party/skia/src/utils/win/SkWGL_win.cpp",
428     ]
429   }
431   if (is_android && (!enable_basic_printing && !enable_print_preview)) {
432     sources -= [ "ext/skia_utils_base.cc" ]
433   }
435   # Fixup skia library sources.
436   if (is_win) {
437     sources -= [
438       "//third_party/skia/src/ports/SkOSFile_posix.cpp",
439       "//third_party/skia/src/ports/SkTime_Unix.cpp",
440       "//third_party/skia/src/ports/SkTLS_pthread.cpp",
441     ]
442   } else {
443     sources -= [
444       "//third_party/skia/src/ports/SkFontHost_win.cpp",
445       "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
446       "//third_party/skia/src/ports/SkOSFile_win.cpp",
447       "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
448       "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
449       "//third_party/skia/src/ports/SkScalerContext_win_dw.h",
450       "//third_party/skia/src/ports/SkTLS_win.cpp",
451       "//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
452       "//third_party/skia/src/ports/SkTypeface_win_dw.h",
453     ]
454   }
455   if (!is_android) {
456     sources -= [
457       "//third_party/skia/src/ports/SkFontConfigParser_android.cpp",
458       "//third_party/skia/src/ports/SkFontMgr_android.cpp",
459     ]
460   }
461   if (!is_mac) {
462     sources -= [ "//third_party/skia/src/ports/SkFontHost_mac.cpp" ]
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 += [ "//third_party/icu:icuuc" ]
539   }
541   if (is_android) {
542     set_sources_assignment_filter([])
543     sources += [ "ext/platform_device_linux.cc" ]
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   }
552   if (skia_support_pdf) {
553     deps += [ "//third_party/sfntly" ]
554     sources += gypi_skia_pdf.sources
555   }
557   if (is_android && !is_debug) {
558     configs -= [ "//build/config/compiler:optimize" ]
559     configs += [ "//build/config/compiler:optimize_max" ]
560   }
563 # Separated out so it can be compiled with different flags for SSE.
564 source_set("skia_opts") {
565   cflags = []
566   defines = []
568   if (cpu_arch == "x86" || cpu_arch == "x64") {
569     sources = [
570       "//third_party/skia/src/opts/SkTextureCompression_opts_none.cpp",
572       # SSE 2
573       "//third_party/skia/src/opts/opts_check_x86.cpp",
574       "//third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp",
575       "//third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp",
576       "//third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp",
577       "//third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp",
578       "//third_party/skia/src/opts/SkBlurImage_opts_SSE2.cpp",
579       "//third_party/skia/src/opts/SkMorphology_opts_SSE2.cpp",
580       "//third_party/skia/src/opts/SkUtils_opts_SSE2.cpp",
581       "//third_party/skia/src/opts/SkXfermode_opts_SSE2.cpp",
583       # SSSE 3
584       "//third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp",
586       # SSE 4
587       "//third_party/skia/src/opts/SkBlurImage_opts_SSE4.cpp",
589       # Chrome-specific.
590       "ext/convolver_SSE2.cc",
592       # These are header files used by this target from the skia one above.
593       "ext/convolver.h",
594       "//third_party/skia/include/core/SkTypes.h",
595     ]
597     if (!is_win) {
598       # SSE 4
599       if (cpu_arch == "x86") {
600         sources += [ "//third_party/skia/src/opts/SkBlitRow_opts_SSE4_asm.S" ]
601       } else {  # x64
602         sources +=
603             [ "//third_party/skia/src/opts/SkBlitRow_opts_SSE4_x64_asm.S" ]
604       }
605     }
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     ]
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" ]
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         ]
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 += [ "-mfpu=neon" ]
641         }
643         #ldflags = [
644         #  "-march=armv7-a",
645         #  "-Wl,--fix-cortex-a8",
646         #]
647       }
648     }
650     # Non-Neon ARM code.
651     if (arm_version < 7 || !arm_use_neon) {
652       sources += [ "//third_party/skia/src/opts/memset.arm.S" ]
653     }
655     if (arm_version < 6) {
656       sources += [
657         "//third_party/skia/src/opts/SkBlitMask_opts_none.cpp",
658         "//third_party/skia/src/opts/SkBlitRow_opts_none.cpp",
659         "//third_party/skia/src/opts/SkBlurImage_opts_none.cpp",
660         "//third_party/skia/src/opts/SkMorphology_opts_none.cpp",
661         "//third_party/skia/src/opts/SkTextureCompression_opts_none.cpp",
662         "//third_party/skia/src/opts/SkUtils_opts_none.cpp",
663         "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
664       ]
665     } else {
666       # arm version >= 6.
667       sources += [
668         "//third_party/skia/src/opts/SkBlitMask_opts_arm.cpp",
669         "//third_party/skia/src/opts/SkBlitRow_opts_arm.cpp",
670         "//third_party/skia/src/opts/SkBlitRow_opts_arm.h",
671         "//third_party/skia/src/opts/SkBlurImage_opts_arm.cpp",
672         "//third_party/skia/src/opts/SkMorphology_opts_arm.cpp",
673         "//third_party/skia/src/opts/SkTextureCompression_opts_arm.cpp",
674         "//third_party/skia/src/opts/SkUtils_opts_arm.cpp",
675         "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
676       ]
677     }
678   } else if (cpu_arch == "mipsel") {
679     cflags += [ "-fomit-frame-pointer" ]
680     sources = [
681       "//third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp",
682       "//third_party/skia/src/opts/SkBlitMask_opts_none.cpp",
683       "//third_party/skia/src/opts/SkBlitRow_opts_none.cpp",
684       "//third_party/skia/src/opts/SkBlurImage_opts_none.cpp",
685       "//third_party/skia/src/opts/SkMorphology_opts_none.cpp",
686       "//third_party/skia/src/opts/SkTextureCompression_opts_none.cpp",
687       "//third_party/skia/src/opts/SkUtils_opts_none.cpp",
688       "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
689     ]
690   } else {
691     assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
692   }
694   if (is_android && !is_debug) {
695     configs -= [ "//build/config/compiler:optimize" ]
696     configs += [ "//build/config/compiler:optimize_max" ]
697   }
699   configs -= [ "//build/config/compiler:chromium_code" ]
700   configs += [
701     ":skia_config",
702     ":skia_library_config",
703     "//build/config/compiler:no_chromium_code",
704   ]
706   deps = [
707     "//base",
708   ]
710   visibility = [ ":skia" ]