First page-set for media-related metrics measurement.
[chromium-blink-merge.git] / skia / skia.gyp
blob8f5d2bfd2d3c0f975413d1942c3f17b01c645fe1
1 # Copyright (c) 2012 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.
6   'targets': [
7     {
8       'target_name': 'skia',
9       'type': '<(component)',
10       'variables': {
11         'conditions': [
12           ['OS== "ios"', {
13             'skia_support_gpu': 0,
14           }, {
15             'skia_support_gpu': 1,
16           }],
17         ],
19         'optimize': 'max',
21         # These two set the paths so we can include skia/gyp/core.gypi
22         'skia_src_path': '../third_party/skia/src',
23         'skia_include_path': '../third_party/skia/include',
24       },
26       'includes': [
27         '../third_party/skia/gyp/core.gypi',
28         '../third_party/skia/gyp/effects.gypi',
29       ],
31       'sources': [
32         # this should likely be moved into src/utils in skia
33         '../third_party/skia/src/core/SkFlate.cpp',
34         # We don't want to add this to Skia's core.gypi since it is
35         # Android only. Include it here and remove it for everyone
36         # but Android later.
37         '../third_party/skia/src/core/SkPaintOptionsAndroid.cpp',
39         '../third_party/skia/src/ports/SkImageDecoder_empty.cpp',
40         #'../third_party/skia/src/images/bmpdecoderhelper.cpp',
41         #'../third_party/skia/src/images/bmpdecoderhelper.h',
42         #'../third_party/skia/src/images/SkFDStream.cpp',
43         #'../third_party/skia/src/images/SkImageDecoder.cpp',
44         #'../third_party/skia/src/images/SkImageDecoder_FactoryDefault.cpp',
45         #'../third_party/skia/src/images/SkImageDecoder_FactoryRegistrar.cpp',
46         #'../third_party/skia/src/images/SkImageDecoder_fpdfemb.cpp',
47         #'../third_party/skia/src/images/SkImageDecoder_libbmp.cpp',
48         #'../third_party/skia/src/images/SkImageDecoder_libgif.cpp',
49         #'../third_party/skia/src/images/SkImageDecoder_libico.cpp',
50         #'../third_party/skia/src/images/SkImageDecoder_libjpeg.cpp',
51         #'../third_party/skia/src/images/SkImageDecoder_libpng.cpp',
52         #'../third_party/skia/src/images/SkImageDecoder_libpvjpeg.cpp',
53         #'../third_party/skia/src/images/SkImageDecoder_wbmp.cpp',
54         #'../third_party/skia/src/images/SkImageEncoder.cpp',
55         #'../third_party/skia/src/images/SkImageEncoder_Factory.cpp',
56         #'../third_party/skia/src/images/SkImageRef.cpp',
57         #'../third_party/skia/src/images/SkImageRefPool.cpp',
58         #'../third_party/skia/src/images/SkImageRefPool.h',
59         #'../third_party/skia/src/images/SkImageRef_GlobalPool.cpp',
60         #'../third_party/skia/src/images/SkMovie.cpp',
61         #'../third_party/skia/src/images/SkMovie_gif.cpp',
62         '../third_party/skia/src/images/SkScaledBitmapSampler.cpp',
63         '../third_party/skia/src/images/SkScaledBitmapSampler.h',
65         '../third_party/skia/src/opts/opts_check_SSE2.cpp',
67         '../third_party/skia/src/pdf/SkPDFCatalog.cpp',
68         '../third_party/skia/src/pdf/SkPDFCatalog.h',
69         '../third_party/skia/src/pdf/SkPDFDevice.cpp',
70         '../third_party/skia/src/pdf/SkPDFDocument.cpp',
71         '../third_party/skia/src/pdf/SkPDFFont.cpp',
72         '../third_party/skia/src/pdf/SkPDFFont.h',
73         '../third_party/skia/src/pdf/SkPDFFormXObject.cpp',
74         '../third_party/skia/src/pdf/SkPDFFormXObject.h',
75         '../third_party/skia/src/pdf/SkPDFGraphicState.cpp',
76         '../third_party/skia/src/pdf/SkPDFGraphicState.h',
77         '../third_party/skia/src/pdf/SkPDFImage.cpp',
78         '../third_party/skia/src/pdf/SkPDFImage.h',
79         '../third_party/skia/src/pdf/SkPDFImageStream.cpp',
80         '../third_party/skia/src/pdf/SkPDFImageStream.h',
81         '../third_party/skia/src/pdf/SkPDFPage.cpp',
82         '../third_party/skia/src/pdf/SkPDFPage.h',
83         '../third_party/skia/src/pdf/SkPDFShader.cpp',
84         '../third_party/skia/src/pdf/SkPDFShader.h',
85         '../third_party/skia/src/pdf/SkPDFStream.cpp',
86         '../third_party/skia/src/pdf/SkPDFStream.h',
87         '../third_party/skia/src/pdf/SkPDFTypes.cpp',
88         '../third_party/skia/src/pdf/SkPDFTypes.h',
89         '../third_party/skia/src/pdf/SkPDFUtils.cpp',
90         '../third_party/skia/src/pdf/SkPDFUtils.h',
92         #'../third_party/skia/src/ports/SkPurgeableMemoryBlock_android.cpp',
93         #'../third_party/skia/src/ports/SkPurgeableMemoryBlock_mac.cpp',
94         '../third_party/skia/src/ports/SkPurgeableMemoryBlock_none.cpp',
96         '../third_party/skia/src/ports/SkFontConfigInterface_android.cpp',
97         #'../third_party/skia/src/ports/SkFontHost_FONTPATH.cpp',
98         '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
99         '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
100         '../third_party/skia/src/ports/SkFontHost_FreeType_common.h',
101         '../third_party/skia/src/ports/SkFontConfigParser_android.cpp',
102         #'../third_party/skia/src/ports/SkFontHost_ascender.cpp',
103         #'../third_party/skia/src/ports/SkFontHost_linux.cpp',
104         '../third_party/skia/src/ports/SkFontHost_mac.cpp',
105         #'../third_party/skia/src/ports/SkFontHost_none.cpp',
106         '../third_party/skia/src/ports/SkFontHost_win.cpp',
107         '../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp',
108         #'../third_party/skia/src/ports/SkImageDecoder_CG.cpp',
109         #'../third_party/skia/src/ports/SkImageDecoder_empty.cpp',
110         #'../third_party/skia/src/ports/SkImageRef_ashmem.cpp',
111         #'../third_party/skia/src/ports/SkImageRef_ashmem.h',
112         #'../third_party/skia/src/ports/SkOSEvent_android.cpp',
113         #'../third_party/skia/src/ports/SkOSEvent_dummy.cpp',
114         '../third_party/skia/src/ports/SkOSFile_posix.cpp',
115         '../third_party/skia/src/ports/SkOSFile_stdio.cpp',
116         '../third_party/skia/src/ports/SkOSFile_win.cpp', 
117         #'../third_party/skia/src/ports/SkThread_none.cpp',
118         '../third_party/skia/src/ports/SkThread_pthread.cpp',
119         '../third_party/skia/src/ports/SkTLS_pthread.cpp',
120         '../third_party/skia/src/ports/SkThread_win.cpp',
121         '../third_party/skia/src/ports/SkTLS_win.cpp',
122         '../third_party/skia/src/ports/SkTime_Unix.cpp',
123         #'../third_party/skia/src/ports/SkXMLParser_empty.cpp',
124         #'../third_party/skia/src/ports/SkXMLParser_expat.cpp',
125         #'../third_party/skia/src/ports/SkXMLParser_tinyxml.cpp',
126         #'../third_party/skia/src/ports/SkXMLPullParser_expat.cpp',
128         '../third_party/skia/src/sfnt/SkOTUtils.cpp',
129         '../third_party/skia/src/sfnt/SkOTUtils.h',
131         '../third_party/skia/include/utils/mac/SkCGUtils.h',
132         '../third_party/skia/include/utils/SkDeferredCanvas.h',
133         '../third_party/skia/include/utils/SkMatrix44.h',
134         '../third_party/skia/src/utils/debugger/SkDebugCanvas.cpp',
135         '../third_party/skia/src/utils/debugger/SkDebugCanvas.h',
136         '../third_party/skia/src/utils/debugger/SkDrawCommand.cpp',
137         '../third_party/skia/src/utils/debugger/SkDrawCommand.h',
138         '../third_party/skia/src/utils/debugger/SkObjectParser.cpp',
139         '../third_party/skia/src/utils/debugger/SkObjectParser.h',
140         '../third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp',
141         '../third_party/skia/src/utils/SkBase64.cpp',
142         '../third_party/skia/src/utils/SkBase64.h',
143         '../third_party/skia/src/utils/SkBitSet.cpp',
144         '../third_party/skia/src/utils/SkBitSet.h',
145         '../third_party/skia/src/utils/SkDeferredCanvas.cpp',
146         '../third_party/skia/src/utils/SkMatrix44.cpp',
147         '../third_party/skia/src/utils/SkNullCanvas.cpp',
148         '../third_party/skia/include/utils/SkNWayCanvas.h',
149         '../third_party/skia/src/utils/SkNWayCanvas.cpp',
150         '../third_party/skia/src/utils/SkPictureUtils.cpp',
151         '../third_party/skia/src/utils/SkRTConf.cpp',
152         '../third_party/skia/include/utils/SkRTConf.h',
153         '../third_party/skia/include/pdf/SkPDFDevice.h',
154         '../third_party/skia/include/pdf/SkPDFDocument.h',
156         '../third_party/skia/include/ports/SkTypeface_win.h',
158         #'../third_party/skia/include/images/SkImageDecoder.h',
159         #'../third_party/skia/include/images/SkImageEncoder.h',
160         '../third_party/skia/include/images/SkImageRef.h',
161         '../third_party/skia/include/images/SkImageRef_GlobalPool.h',
162         '../third_party/skia/include/images/SkMovie.h',
163         '../third_party/skia/include/images/SkPageFlipper.h',
165         '../third_party/skia/include/utils/SkNullCanvas.h',
166         '../third_party/skia/include/utils/SkPictureUtils.h',
167         'ext/analysis_canvas.cc',
168         'ext/analysis_canvas.h',
169         'ext/bitmap_platform_device.h',
170         'ext/bitmap_platform_device_android.cc',
171         'ext/bitmap_platform_device_android.h',
172         'ext/bitmap_platform_device_data.h',
173         'ext/bitmap_platform_device_linux.cc',
174         'ext/bitmap_platform_device_linux.h',
175         'ext/bitmap_platform_device_mac.cc',
176         'ext/bitmap_platform_device_mac.h',
177         'ext/bitmap_platform_device_win.cc',
178         'ext/bitmap_platform_device_win.h',
179         'ext/convolver.cc',
180         'ext/convolver.h',
181         'ext/google_logging.cc',
182         'ext/image_operations.cc',
183         'ext/image_operations.h',
184         'ext/lazy_pixel_ref.cc',
185         'ext/lazy_pixel_ref.h',
186         'ext/lazy_pixel_ref_utils.cc',
187         'ext/lazy_pixel_ref_utils.h',
188         'ext/SkThread_chrome.cc',
189         'ext/paint_simplifier.cc',
190         'ext/paint_simplifier.h',
191         'ext/platform_canvas.cc',
192         'ext/platform_canvas.h',
193         'ext/platform_device.cc',
194         'ext/platform_device.h',
195         'ext/platform_device_linux.cc',
196         'ext/platform_device_mac.cc',
197         'ext/platform_device_win.cc',
198         'ext/recursive_gaussian_convolution.cc',
199         'ext/recursive_gaussian_convolution.h',
200         'ext/refptr.h',
201         'ext/SkMemory_new_handler.cpp',
202         'ext/skia_trace_shim.h',
203         'ext/skia_utils_base.cc',
204         'ext/skia_utils_base.h',
205         'ext/skia_utils_ios.mm',
206         'ext/skia_utils_ios.h',
207         'ext/skia_utils_mac.mm',
208         'ext/skia_utils_mac.h',
209         'ext/skia_utils_win.cc',
210         'ext/skia_utils_win.h',
211         'ext/vector_canvas.cc',
212         'ext/vector_canvas.h',
213         'ext/vector_platform_device_emf_win.cc',
214         'ext/vector_platform_device_emf_win.h',
215         'ext/vector_platform_device_skia.cc',
216         'ext/vector_platform_device_skia.h',
217       ],
218       'include_dirs': [
219         '..',
220         'config',
221         '../third_party/skia/include/config',
222         '../third_party/skia/include/core',
223         '../third_party/skia/include/effects',
224         '../third_party/skia/include/images',
225         '../third_party/skia/include/lazy',
226         '../third_party/skia/include/pathops',
227         '../third_party/skia/include/pdf',
228         '../third_party/skia/include/pipe',
229         '../third_party/skia/include/ports',
230         '../third_party/skia/include/utils',
231         '../third_party/skia/src/core',
232         '../third_party/skia/src/image',
233         '../third_party/skia/src/sfnt',
234         '../third_party/skia/src/utils',
235         '../third_party/skia/src/lazy',
236       ],
237       'msvs_disabled_warnings': [4244, 4267, 4341, 4345, 4390, 4554, 4748, 4800],
238       'defines': [
239         #'SK_GAMMA_SRGB',
240         #'SK_GAMMA_APPLY_TO_A8',
241         'SK_BUILD_NO_IMAGE_ENCODE',
242         'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
243         'GR_STATIC_RECT_VB=1',
244         'GR_AGGRESSIVE_SHADER_OPTS=1',
245         'SK_DEFERRED_CANVAS_USES_GPIPE=1',
246         'SK_ENABLE_INST_COUNT=0',
248         # this flag can be removed entirely once this has baked for a while
249         'SK_ALLOW_OVER_32K_BITMAPS',
251         # skia uses static initializers to initialize the serialization logic
252         # of its "pictures" library. This is currently not used in chrome; if
253         # it ever gets used the processes that use it need to call
254         # SkGraphics::Init().
255         'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
257         # Disable this check because it is too strict for some Chromium-specific
258         # subclasses of SkPixelRef. See bug: crbug.com/171776.
259         'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
261         'IGNORE_ROT_AA_RECT_OPT',
262         'SK_IGNORE_IMAGE_PRESCALE',
263       ],
264       'sources!': [
265         '../third_party/skia/include/core/SkTypes.h',
266       ],
267       'conditions': [
268         ['skia_support_gpu != 0', {
269           'includes': [
270             '../third_party/skia/gyp/gpu.gypi',
271           ],
272           'sources': [
273             '<@(skgpu_sources)',
274           ],
275           'include_dirs': [
276             '../third_party/skia/include/gpu',
277             '../third_party/skia/include/gpu/gl',
278             '../third_party/skia/src/gpu',
279           ],
280         }, {  # skia_support_gpu == 0
281           'defines': [
282             'SK_SUPPORT_GPU=0',
283           ],
284         }],
285         #Settings for text blitting, chosen to approximate the system browser.
286         [ 'OS == "linux"', {
287           'defines': [
288             'SK_GAMMA_EXPONENT=1.2',
289             'SK_GAMMA_CONTRAST=0.2',
290           ],
291         }],
292         ['OS == "android"', {
293           'defines': [
294             'SK_GAMMA_APPLY_TO_A8',
295             'SK_GAMMA_EXPONENT=1.4',
296             'SK_GAMMA_CONTRAST=0.0',
297           ],
298         }],
299         ['OS == "win"', {
300           'defines': [
301             'SK_GAMMA_SRGB',
302             'SK_GAMMA_CONTRAST=0.5',
303           ],
304         }],
305         ['OS == "mac"', {
306           'defines': [
307             'SK_GAMMA_SRGB',
308             'SK_GAMMA_CONTRAST=0.0',
309           ],
310         }],
312         # For POSIX platforms, prefer the Mutex implementation provided by Skia
313         # since it does not generate static initializers.
314         [ 'OS == "android" or OS == "linux" or OS == "mac" or OS == "ios"', {
315           'defines+': [
316             'SK_USE_POSIX_THREADS',
317           ],
318           'direct_dependent_settings': {
319             'defines': [
320               'SK_USE_POSIX_THREADS',
321             ],
322           },
323           'sources!': [
324             'ext/SkThread_chrome.cc',
325           ],
326         }],
327         [ 'OS != "android"', {
328           'sources/': [
329             ['exclude', '_android\\.(cc|cpp)$'],
330           ],
331           'sources!': [
332             '../third_party/skia/src/core/SkPaintOptionsAndroid.cpp',
333           ],
334           'defines': [
335             'SK_DEFAULT_FONT_CACHE_LIMIT=(20*1024*1024)',
336           ],
337         }],
338         [ 'OS != "ios"', {
339           'sources/': [
340             ['exclude', '_ios\\.(cc|cpp|mm?)$'],
341           ],
342           'dependencies': [
343             '<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/skia_webkit.gyp:skia_webkit',
344           ],
345         }],
346         [ 'OS != "mac"', {
347           'sources/': [
348             ['exclude', '_mac\\.(cc|cpp|mm?)$'],
349             ['exclude', '/mac/']
350           ],
351         }],
352         [ 'OS != "win"', {
353           'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ],
354         }],
355         [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', {
356           'defines': [
357             '__ARM_HAVE_NEON',
358           ],
359         }],
360         [ 'target_arch == "arm" and arm_version >= 7 and arm_neon_optional == 1', {
361           'defines': [
362             '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
363           ],
364         }],
365         [ 'OS == "android" and target_arch == "arm"', {
366           'sources': [
367             '../third_party/skia/src/core/SkUtilsArm.cpp',
368           ],
369           'includes': [
370             '../build/android/cpufeatures.gypi',
371           ],
372         }],
373         [ 'target_arch == "arm" or target_arch == "mipsel"', {
374           'sources!': [
375             '../third_party/skia/src/opts/opts_check_SSE2.cpp'
376           ],
377         }],
378         [ 'use_glib == 1', {
379           'dependencies': [
380             '../build/linux/system.gyp:fontconfig',
381             '../build/linux/system.gyp:freetype2',
382             '../build/linux/system.gyp:pangocairo',
383             '../third_party/icu/icu.gyp:icuuc',
384           ],
385           'cflags': [
386             '-Wno-unused',
387             '-Wno-unused-function',
388           ],
389           'sources': [
390             '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp',
391             '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp',
392             '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp',
393           ],
394           'defines': [
395 #            'SK_USE_COLOR_LUMINANCE',
396           ],
397         }],
398         [ 'use_glib == 0 and OS != "android"', {
399           'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ],
400           'sources!': [
401             '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
402             '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
403           ],
404         }],
405         [ 'toolkit_uses_gtk == 1', {
406           'dependencies': [
407             '../build/linux/system.gyp:gdk',
408           ],
409         }, {  # toolkit_uses_gtk == 0
410           'sources/': [ ['exclude', '_gtk\\.(cc|cpp)$'] ],
411         }],
412         [ 'OS == "android"', {
413           'sources': [
414             '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp',
415           ],
416           'sources/': [
417             ['exclude', '_linux\\.(cc|cpp)$'],
418           ],
419           'conditions': [
420             [ '_toolset == "target"', {
421               'defines': [
422                 'HAVE_PTHREADS',
423                 'OS_ANDROID',
424                 'SK_BUILD_FOR_ANDROID',
425                 # Android devices are typically more memory constrained, so
426                 # use a smaller glyph cache.
427                 'SK_DEFAULT_FONT_CACHE_LIMIT=(8*1024*1024)',
428                 'USE_CHROMIUM_SKIA',
429               ],
430               'dependencies': [
431                 '../third_party/expat/expat.gyp:expat',
432                 '../third_party/freetype/freetype.gyp:ft2',
433                 'skia_opts'
434               ],
435               'dependencies!': [
436                 # Android doesn't use Skia's PDF generation, which is what uses
437                 # sfntly.
438                 '../third_party/sfntly/sfntly.gyp:sfntly',
439               ],
440               # This exports a hard dependency because it needs to run its
441               # symlink action in order to expose the skia header files.
442               'hard_dependency': 1,
443               'include_dirs': [
444                 '../third_party/expat/files/lib',
445               ],
446               'sources/': [
447                 ['include', 'ext/platform_device_linux\\.cc$'],
448                 ['exclude', '../third_party/skia/src/pdf/'],
449               ],
450               'sources!': [
451                 'ext/vector_platform_device_skia.cc',
452               ],
453             }],
454             [ '_toolset == "target" and android_webview_build == 0', {
455               'defines': [
456                 'HAVE_ENDIAN_H',
457               ],
458             }],
459             [ '_toolset=="host" and host_os=="linux"', {
460               'sources': [
461                 'ext/platform_device_linux.cc',
462               ],
463             }],
464           ],
465         }],
466         [ 'OS == "ios"', {
467           'defines': [
468             'SK_BUILD_FOR_IOS',
469             'SK_USE_MAC_CORE_TEXT',
470           ],
471           'include_dirs': [
472             '../third_party/skia/include/utils/ios',
473             '../third_party/skia/include/utils/mac',
474           ],
475           'link_settings': {
476             'libraries': [
477               '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework',
478             ],
479           },
480           'dependencies': [
481             'skia_opts_ios',
482           ],
483           'dependencies!': [
484             'skia_opts',
485             '../third_party/sfntly/sfntly.gyp:sfntly',
486           ],
487           'sources': [
488             # This file is used on both iOS and Mac, so it should be removed
489             #  from the ios and mac conditions and moved into the main sources
490             #  list.
491             '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
492           ],
493           'sources/': [
494             ['exclude', '/pdf/'],
495             ['exclude', '^ext/vector_platform_device_skia\\.'],
496             ['exclude', 'opts_check_SSE2\\.cpp$'],
497           ],
498         }],
499         [ 'OS == "mac"', {
500           'defines': [
501             'SK_BUILD_FOR_MAC',
502             'SK_USE_MAC_CORE_TEXT',
503 #           'SK_USE_COLOR_LUMINANCE',
504           ],
505           'include_dirs': [
506             '../third_party/skia/include/utils/mac',
507           ],
508           'link_settings': {
509             'libraries': [
510               '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
511             ],
512           },
513           'sources': [
514             '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
515           ],
516         }],
517         [ 'OS == "win"', {
518           'defines': [
519             'SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS'
520           ],
521           'sources!': [
522             '../third_party/skia/src/ports/SkOSFile_posix.cpp',
523             '../third_party/skia/src/ports/SkThread_pthread.cpp',
524             '../third_party/skia/src/ports/SkTLS_pthread.cpp',
525             '../third_party/skia/src/ports/SkTime_Unix.cpp',
526             'ext/SkThread_chrome.cc',
527           ],
528           'include_dirs': [
529             'config/win',
530           ],
531           'direct_dependent_settings': {
532             'include_dirs': [
533               'config/win',
534             ],
535           },
536         }],
537         ['component=="shared_library"', {
538           'defines': [
539             'GR_DLL=1',
540             'GR_IMPLEMENTATION=1',
541             'SKIA_DLL',
542             'SKIA_IMPLEMENTATION=1',
543           ],
544           'dependencies': [
545             '../base/base.gyp:base',
546           ],
547           'direct_dependent_settings': {
548             'defines': [
549               'GR_DLL',
550               'SKIA_DLL',
551             ],
552           },
553         }],
554         # TODO(scottmg): http://crbug.com/177306
555         ['clang==1', {
556           'xcode_settings': {
557             'WARNING_CFLAGS!': [
558               # Don't warn about string->bool used in asserts.
559               '-Wstring-conversion',
560             ],
561           },
562           'cflags!': [
563             '-Wstring-conversion',
564           ],
565         }],
566       ],
567       'dependencies': [
568         'skia_opts',
569         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
570         '../third_party/sfntly/sfntly.gyp:sfntly',
571         '../third_party/zlib/zlib.gyp:zlib',
572       ],
573       'direct_dependent_settings': {
574         'include_dirs': [
575           'config',
577           #temporary until we can hide SkFontHost
578           '../third_party/skia/src/core',
580           '../third_party/skia/include/config',
581           '../third_party/skia/include/core',
582           '../third_party/skia/include/effects',
583           '../third_party/skia/include/pdf',
584           '../third_party/skia/include/gpu',
585           '../third_party/skia/include/gpu/gl',
586           '../third_party/skia/include/lazy',
587           '../third_party/skia/include/pathops',
588           '../third_party/skia/include/pipe',
589           '../third_party/skia/include/ports',
590           '../third_party/skia/include/utils',
591           'ext',
592         ],
593         'defines': [
594           'SK_BUILD_NO_IMAGE_ENCODE',
595           'SK_DEFERRED_CANVAS_USES_GPIPE=1',
596           'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
597           'GR_AGGRESSIVE_SHADER_OPTS=1',
598           'SK_ENABLE_INST_COUNT=0',
599         ],
600         'conditions': [
601           ['OS=="android"', {
602             'dependencies!': [
603               'skia_opts',
604               '../third_party/zlib/zlib.gyp:zlib',
605             ],
606             'defines': [
607               # Don't use non-NDK available stuff.
608               'SK_BUILD_FOR_ANDROID',
609             ],
610             'conditions': [
611               [ '_toolset == "target" and android_webview_build == 0', {
612                 'defines': [
613                   'HAVE_ENDIAN_H',
614                 ],
615               }],
616             ],
617           }],
618           ['OS=="mac"', {
619             'include_dirs': [
620               '../third_party/skia/include/utils/mac',
621             ],
622           }],
623         ],
624       },
625       'target_conditions': [
626         # Pull in specific Mac files for iOS (which have been filtered out
627         # by file name rules).
628         [ 'OS == "ios"', {
629           'sources/': [
630             ['include', 'SkFontHost_mac\\.cpp$',],
631             ['include', 'SkStream_mac\\.cpp$',],
632             ['include', 'SkCreateCGImageRef\\.cpp$',],
633           ],
634         }],
635       ],
636     },
638     # Due to an unfortunate intersection of lameness between gcc and gyp,
639     # we have to build the *_SSE2.cpp files in a separate target.  The
640     # gcc lameness is that, in order to compile SSE2 intrinsics code, it
641     # must be passed the -msse2 flag.  However, with this flag, it may
642     # emit SSE2 instructions even for scalar code, such as the CPUID
643     # test used to test for the presence of SSE2.  So that, and all other
644     # code must be compiled *without* -msse2.  The gyp lameness is that it
645     # does not allow file-specific CFLAGS, so we must create this extra
646     # target for those files to be compiled with -msse2.
647     #
648     # This is actually only a problem on 32-bit Linux (all Intel Macs have
649     # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
650     # SSE2 from instrinsics, which generating plain ol' 386 for everything
651     # else).  However, to keep the .gyp file simple and avoid platform-specific
652     # build breakage, we do this on all platforms.
654     # For about the same reason, we need to compile the ARM opts files
655     # separately as well.
656     {
657       'target_name': 'skia_opts',
658       'type': 'static_library',
659       'variables': {
660         'optimize': 'max',
661       },
662       'include_dirs': [
663         '..',
664         'config',
665         '../third_party/skia/include/config',
666         '../third_party/skia/include/core',
667         '../third_party/skia/include/effects',
668         '../third_party/skia/include/images',
669         '../third_party/skia/include/lazy',
670         '../third_party/skia/include/pathops',
671         '../third_party/skia/include/utils',
672         '../third_party/skia/src/core',
673       ],
674       'conditions': [
675         [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
676            target_arch != "arm" and target_arch != "mipsel"', {
677           'cflags': [
678             '-msse2',
679           ],
680         }],
681         [ 'OS == "android"', {
682           'defines': [
683             'SK_BUILD_FOR_ANDROID',
684           ],
685         }],
686         [ 'target_arch != "arm" and target_arch != "mipsel"', {
687           'sources': [
688             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
689             '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
690             '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
691             '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
692             '../third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp',
693             'ext/convolver_SSE2.cc',
694           ],
695           'conditions': [
696             # x86 Android doesn't support SSSE3 instructions.
697             [ 'OS != "android"', {
698               'dependencies': [
699                 'skia_opts_ssse3',
700               ],
701             }],
702           ],
703         }],
704         [ 'target_arch == "arm"', {
705           'conditions': [
706             [ 'arm_version >= 7 and arm_neon == 1', {
707               'defines': [
708                 '__ARM_HAVE_NEON',
709               ],
710             }],
711             [ 'arm_version >= 7 and arm_neon_optional == 1', {
712               'defines': [
713                 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
714               ],
715             }],
716             [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
717               'cflags': [
718                 # The neon assembly contains conditional instructions which
719                 # aren't enclosed in an IT block. The assembler complains
720                 # without this option.
721                 # See #86592.
722                 '-Wa,-mimplicit-it=always',
723               ],
724               'dependencies': [
725                 'skia_opts_neon',
726               ]
727            }],
728           ],
729           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
730           # ARM), the compiler doesn't like that. Explicitly remove the
731           # -fno-omit-frame-pointer flag for Android, as that gets added to all
732           # targets via common.gypi.
733           'cflags!': [
734             '-fno-omit-frame-pointer',
735             '-marm',
736             '-mapcs-frame',
737           ],
738           'cflags': [
739             '-fomit-frame-pointer',
740           ],
741           'sources': [
742             '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
743           ],
744         }],
745         [ 'target_arch == "arm" and (arm_version < 7 or (arm_neon == 0 and arm_neon_optional == 1))', {
746           'sources': [
747             '../third_party/skia/src/opts/memset.arm.S',
748           ],
749         }],
750         [ 'target_arch == "arm" and arm_version < 6', {
751           'sources': [
752             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
753             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
754           ],
755         }],
756         [ 'target_arch == "arm" and arm_version >= 6', {
757           'sources': [
758             '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
759             '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
760             '../third_party/skia/src/opts/opts_check_arm.cpp',
761           ],
762         }],
763         [ 'target_arch == "mipsel"',{
764           'cflags': [
765             '-fomit-frame-pointer',
766           ],
767           'sources': [
768             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
769             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
770             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
771             'ext/convolver_mips_dspr2.cc',
772           ],
773         }],
774       ],
775     },
776     # For the same lame reasons as what is done for skia_opts, we have to
777     # create another target specifically for SSSE3 code as we would not want
778     # to compile the SSE2 code with -mssse3 which would potentially allow
779     # gcc to generate SSSE3 code.
780     {
781       'target_name': 'skia_opts_ssse3',
782       'type': 'static_library',
783       'variables': {
784         'optimize': 'max',
785       },
786       'include_dirs': [
787         '..',
788         'config',
789         '../third_party/skia/include/config',
790         '../third_party/skia/include/core',
791         '../third_party/skia/include/pathops',
792         '../third_party/skia/src/core',
793       ],
794       'conditions': [
795         [ 'OS in ["linux", "freebsd", "openbsd", "solaris"]', {
796           'cflags': [
797             '-mssse3',
798           ],
799         }],
800         [ 'OS == "mac"', {
801           'xcode_settings': {
802             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
803           },
804         }],
805         [ 'OS == "win"', {
806           'include_dirs': [
807             'config/win',
808           ],
809           'direct_dependent_settings': {
810             'include_dirs': [
811               'config/win',
812             ],
813           },
814         }],
815         [ 'target_arch != "arm" and target_arch != "mipsel"', {
816           'sources': [
817             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
818           ],
819         }],
820       ],
821     },
822     # NEON code must be compiled with -mfpu=neon which also affects scalar
823     # code. To support dynamic NEON code paths, we need to build all
824     # NEON-specific sources in a separate static library. The situation
825     # is very similar to the SSSE3 one.
826     {
827       'target_name': 'skia_opts_neon',
828       'type': 'static_library',
829       'include_dirs': [
830         '..',
831         'config',
832         '../third_party/skia/include/config',
833         '../third_party/skia/include/core',
834         '../third_party/skia/src/core',
835         '../third_party/skia/src/opts',
836       ],
837       'cflags!': [
838         '-fno-omit-frame-pointer',
839         '-mfpu=vfp',  # remove them all, just in case.
840         '-mfpu=vfpv3',
841         '-mfpu=vfpv3-d16',
842       ],
843       'cflags': [
844         '-mfpu=neon',
845         '-fomit-frame-pointer',
846       ],
847       'ldflags': [
848         '-march=armv7-a',
849         '-Wl,--fix-cortex-a8',
850       ],
851       'conditions': [
852         ['arm_neon == 1', {
853           'defines': [
854             '__ARM_HAVE_NEON',
855           ],
856         }],
857         ['arm_neon_optional == 1', {
858           'defines': [
859             '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
860           ],
861         }],
862         ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
863           'sources': [
864             '../third_party/skia/src/opts/memset16_neon.S',
865             '../third_party/skia/src/opts/memset32_neon.S',
866             '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
867             '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
868             '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
869             '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
870             '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
871           ],
872         }],
873       ],
874     },
875     {
876       'target_name': 'image_operations_bench',
877       'type': 'executable',
878       'dependencies': [
879         '../base/base.gyp:base',
880         'skia',
881       ],
882       'include_dirs': [
883         '..',
884       ],
885       'sources': [
886         'ext/image_operations_bench.cc',
887       ],
888     },
889   ],
890   'conditions': [
891     ['OS=="ios"', {
892       'targets': [
893         # The main skia_opts target does not currently work on iOS because the
894         # target architecture on iOS is determined at compile time rather than
895         # gyp time (simulator builds are x86, device builds are arm).  As a
896         # temporary measure, this is a separate opts target for iOS-only, using
897         # the _none.cpp files to avoid architecture-dependent implementations.
898         {
899           'target_name': 'skia_opts_ios',
900           'type': 'static_library',
901           'include_dirs': [
902             '..',
903             'config',
904             '../third_party/skia/include/config',
905             '../third_party/skia/include/core',
906             '../third_party/skia/include/effects',
907             '../third_party/skia/include/images',
908             '../third_party/skia/include/lazy',
909             '../third_party/skia/include/pathops',
910             '../third_party/skia/include/utils',
911             '../third_party/skia/src/core',
912           ],
913           'sources': [
914             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
915             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
916             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
917           ],
918         },
919       ],
920     }],
921   ],