In iossim, ignore harmless messages from launchd.
[chromium-blink-merge.git] / skia / skia.gyp
blob0bffca836e695158e2600e0aa1757c0284fa5427
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           }],
18           ['inside_chromium_build==0', {
19             'webkit_src_dir': '<(DEPTH)/../../..',
20           },{
21             'webkit_src_dir': '<(DEPTH)/third_party/WebKit',
22           }],
23         ],
25         'optimize': 'max',
27         # These two set the paths so we can include skia/gyp/core.gypi
28         'skia_src_path': '../third_party/skia/src',
29         'skia_include_path': '../third_party/skia/include',
30       },
32       'includes': [
33         '../third_party/skia/gyp/core.gypi',
34         '../third_party/skia/gyp/effects.gypi',
35       ],
37       'sources': [
38         # this should likely be moved into src/utils in skia
39         '../third_party/skia/src/core/SkFlate.cpp',
41         '../third_party/skia/src/images/bmpdecoderhelper.cpp',
42         '../third_party/skia/src/images/bmpdecoderhelper.h',
43         #'../third_party/skia/src/images/SkFDStream.cpp',
44         '../third_party/skia/src/images/SkImageDecoder.cpp',
45         '../third_party/skia/src/images/SkImageDecoder_Factory.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/SkPDFPage.cpp',
80         '../third_party/skia/src/pdf/SkPDFPage.h',
81         '../third_party/skia/src/pdf/SkPDFShader.cpp',
82         '../third_party/skia/src/pdf/SkPDFShader.h',
83         '../third_party/skia/src/pdf/SkPDFStream.cpp',
84         '../third_party/skia/src/pdf/SkPDFStream.h',
85         '../third_party/skia/src/pdf/SkPDFTypes.cpp',
86         '../third_party/skia/src/pdf/SkPDFTypes.h',
87         '../third_party/skia/src/pdf/SkPDFUtils.cpp',
88         '../third_party/skia/src/pdf/SkPDFUtils.h',
90         '../third_party/skia/src/ports/FontHostConfiguration_android.cpp',
91         '../third_party/skia/src/ports/SkFontDescriptor.cpp',
92         '../third_party/skia/src/ports/SkFontDescriptor.h',
93         #'../third_party/skia/src/ports/SkFontHost_FONTPATH.cpp',
94         '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
95         '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
96         '../third_party/skia/src/ports/SkFontHost_FreeType_common.h',
97         '../third_party/skia/src/ports/SkFontHost_android.cpp',
98         #'../third_party/skia/src/ports/SkFontHost_ascender.cpp',
99         '../third_party/skia/src/ports/SkFontHost_tables.cpp',
100         #'../third_party/skia/src/ports/SkFontHost_linux.cpp',
101         '../third_party/skia/src/ports/SkFontHost_mac.cpp',
102         #'../third_party/skia/src/ports/SkFontHost_none.cpp',
103         '../third_party/skia/src/ports/SkFontHost_sandbox_none.cpp',
104         '../third_party/skia/src/ports/SkFontHost_win.cpp',
105         '../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp',
106         #'../third_party/skia/src/ports/SkImageDecoder_CG.cpp',
107         #'../third_party/skia/src/ports/SkImageDecoder_empty.cpp',
108         #'../third_party/skia/src/ports/SkImageRef_ashmem.cpp',
109         #'../third_party/skia/src/ports/SkImageRef_ashmem.h',
110         #'../third_party/skia/src/ports/SkOSEvent_android.cpp',
111         #'../third_party/skia/src/ports/SkOSEvent_dummy.cpp',
112         '../third_party/skia/src/ports/SkOSFile_stdio.cpp',
113         #'../third_party/skia/src/ports/SkThread_none.cpp',
114         '../third_party/skia/src/ports/SkThread_pthread.cpp',
115         '../third_party/skia/src/ports/SkThread_win.cpp',
116         '../third_party/skia/src/ports/SkTime_Unix.cpp',
117         #'../third_party/skia/src/ports/SkXMLParser_empty.cpp',
118         #'../third_party/skia/src/ports/SkXMLParser_expat.cpp',
119         #'../third_party/skia/src/ports/SkXMLParser_tinyxml.cpp',
120         #'../third_party/skia/src/ports/SkXMLPullParser_expat.cpp',
122         '../third_party/skia/src/sfnt/SkOTUtils.cpp',
123         '../third_party/skia/src/sfnt/SkOTUtils.h',
125         '../third_party/skia/include/utils/mac/SkCGUtils.h',
126         '../third_party/skia/include/utils/SkDeferredCanvas.h',
127         '../third_party/skia/include/utils/SkMatrix44.h',
128         '../third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp',
129         '../third_party/skia/src/utils/SkBase64.cpp',
130         '../third_party/skia/src/utils/SkBase64.h',
131         '../third_party/skia/src/utils/SkBitSet.cpp',
132         '../third_party/skia/src/utils/SkBitSet.h',
133         '../third_party/skia/src/utils/SkDeferredCanvas.cpp',
134         '../third_party/skia/src/utils/SkMatrix44.cpp',
135         '../third_party/skia/src/utils/SkNullCanvas.cpp',
136         '../third_party/skia/include/utils/SkNWayCanvas.h',
137         '../third_party/skia/src/utils/SkNWayCanvas.cpp',
138         '../third_party/skia/src/utils/SkPictureUtils.cpp',
139         '../third_party/skia/include/pdf/SkPDFDevice.h',
140         '../third_party/skia/include/pdf/SkPDFDocument.h',
142         '../third_party/skia/include/ports/SkTypeface_win.h',
144         '../third_party/skia/include/images/SkImageDecoder.h',
145         '../third_party/skia/include/images/SkImageEncoder.h',
146         '../third_party/skia/include/images/SkImageRef.h',
147         '../third_party/skia/include/images/SkImageRef_GlobalPool.h',
148         '../third_party/skia/include/images/SkMovie.h',
149         '../third_party/skia/include/images/SkPageFlipper.h',
151         '../third_party/skia/include/utils/SkNullCanvas.h',
152         '../third_party/skia/include/utils/SkPictureUtils.h',
153         'ext/bitmap_platform_device.h',
154         'ext/bitmap_platform_device_android.cc',
155         'ext/bitmap_platform_device_android.h',
156         'ext/bitmap_platform_device_data.h',
157         'ext/bitmap_platform_device_linux.cc',
158         'ext/bitmap_platform_device_linux.h',
159         'ext/bitmap_platform_device_mac.cc',
160         'ext/bitmap_platform_device_mac.h',
161         'ext/bitmap_platform_device_win.cc',
162         'ext/bitmap_platform_device_win.h',
163         'ext/convolver.cc',
164         'ext/convolver.h',
165         'ext/google_logging.cc',
166         'ext/image_operations.cc',
167         'ext/image_operations.h',
168         'ext/lazy_pixel_ref.cc',
169         'ext/lazy_pixel_ref.h',
170         'ext/SkThread_chrome.cc',
171         'ext/platform_canvas.cc',
172         'ext/platform_canvas.h',
173         'ext/platform_device.cc',
174         'ext/platform_device.h',
175         'ext/platform_device_linux.cc',
176         'ext/platform_device_mac.cc',
177         'ext/platform_device_win.cc',
178         'ext/refptr.h',
179         'ext/SkMemory_new_handler.cpp',
180         'ext/skia_sandbox_support_win.h',
181         'ext/skia_sandbox_support_win.cc',
182         'ext/skia_trace_shim.h',
183         'ext/skia_utils_ios.mm',
184         'ext/skia_utils_ios.h',
185         'ext/skia_utils_mac.mm',
186         'ext/skia_utils_mac.h',
187         'ext/skia_utils_win.cc',
188         'ext/skia_utils_win.h',
189         'ext/vector_canvas.cc',
190         'ext/vector_canvas.h',
191         'ext/vector_platform_device_emf_win.cc',
192         'ext/vector_platform_device_emf_win.h',
193         'ext/vector_platform_device_skia.cc',
194         'ext/vector_platform_device_skia.h',
195       ],
196       'include_dirs': [
197         '..',
198         'config',
199         '../third_party/skia/include/config',
200         '../third_party/skia/include/core',
201         '../third_party/skia/include/effects',
202         '../third_party/skia/include/images',
203         '../third_party/skia/include/pdf',
204         '../third_party/skia/include/pipe',
205         '../third_party/skia/include/ports',
206         '../third_party/skia/include/utils',
207         '../third_party/skia/src/core',
208         '../third_party/skia/src/image',
209         '../third_party/skia/src/sfnt',
210         '../third_party/skia/src/utils',
211       ],
212       'msvs_disabled_warnings': [4244, 4267, 4341, 4345, 4390, 4554, 4748, 4800],
213       'defines': [
214         #'SK_GAMMA_SRGB',
215         #'SK_GAMMA_APPLY_TO_A8',
216         'SK_BUILD_NO_IMAGE_ENCODE',
217         'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
218         'GR_STATIC_RECT_VB=1',
219         'GR_AGGRESSIVE_SHADER_OPTS=1',
220         'SK_DEFERRED_CANVAS_USES_GPIPE=1',
222         # this flag can be removed entirely once this has baked for a while
223         'SK_ALLOW_OVER_32K_BITMAPS',
225         # skia uses static initializers to initialize the serialization logic
226         # of its "pictures" library. This is currently not used in chrome; if
227         # it ever gets used the processes that use it need to call
228         # SkGraphics::Init().
229         'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
231         # Temporarily keep old int-srcrect behavior, until we determine if
232         # the few failures are a bug or not.
233         'SK_SUPPORT_INT_SRCRECT_DRAWBITMAPRECT',
234       ],
235       'sources!': [
236         '../third_party/skia/include/core/SkTypes.h',
237       ],
238       'conditions': [
239         ['skia_support_gpu != 0', {
240           'includes': [
241             '../third_party/skia/gyp/gpu.gypi',
242           ],
243           'sources': [
244             '<@(gr_sources)',
245             '<@(skgr_sources)',
246           ],
247           'include_dirs': [
248             '../third_party/skia/include/gpu',
249             '../third_party/skia/include/gpu/gl',
250             '../third_party/skia/src/gpu',
251           ],
252         }, {  # skia_support_gpu == 0
253           'defines': [
254             'SK_SUPPORT_GPU=0',
255           ],
256         }],
257         ['release_valgrind_build == 1', {
258           'defines': [
259             'SK_DEBUG_PATH_REF=1',
260           ],
261           'direct_dependent_settings': {
262             'defines': [
263               'SK_DEBUG_PATH_REF=1',
264             ],
265           },
266         }],
267         #Settings for text blitting, chosen to approximate the system browser.
268         [ 'OS == "linux"', {
269           'defines': [
270             'SK_GAMMA_EXPONENT=1.2',
271             'SK_GAMMA_CONTRAST=0.2',
272           ],
273         }],
274         ['OS == "android" or OS == "win"', {
275           'defines': [
276             'SK_GAMMA_SRGB',
277             'SK_GAMMA_CONTRAST=0.5',
278           ],
279         }],
280         ['OS == "mac"', {
281           'defines': [
282             'SK_GAMMA_SRGB',
283             'SK_GAMMA_CONTRAST=0.0',
284           ],
285         }],
287         # For POSIX platforms, prefer the Mutex implementation provided by Skia
288         # since it does not generate static initializers.
289         [ 'OS == "android" or OS == "linux" or OS == "mac" or OS == "ios"', {
290           'defines+': [
291             'SK_USE_POSIX_THREADS',
292           ],
293           'direct_dependent_settings': {
294             'defines': [
295               'SK_USE_POSIX_THREADS',
296             ],
297           },
298           'sources!': [
299             'ext/SkThread_chrome.cc',
300           ],
301         }],
302         [ 'OS != "android"', {
303           'sources/': [
304             ['exclude', '_android\\.(cc|cpp)$'],
305           ],
306           'defines': [
307             'SK_DEFAULT_FONT_CACHE_LIMIT=(20*1024*1024)',
308           ],
309         }],
310         [ 'OS != "ios"', {
311           'sources/': [
312             ['exclude', '_ios\\.(cc|cpp|mm?)$'],
313           ],
314           'dependencies': [
315             '<(webkit_src_dir)/Source/WebKit/chromium/skia_webkit.gyp:skia_webkit',
316           ],
317         }],
318         [ 'OS != "mac"', {
319           'sources/': [
320             ['exclude', '_mac\\.(cc|cpp|mm?)$'],
321             ['exclude', '/mac/']
322           ],
323         }],
324         [ 'OS != "win"', {
325           'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ],
326         }],
327         [ 'chromeos == 1', {
328           'defines': [
329             # Temporarily use SkPaint to keep a scale factor needed for correct
330             # font rendering in high DPI mode.
331             # See https://codereview.appspot.com/6495089/
332             'SK_SUPPORT_HINTING_SCALE_FACTOR',
333           ],
334         }],
335         [ 'armv7 == 1', {
336           'defines': [
337             '__ARM_ARCH__=7',
338           ],
339         }],
340         [ 'armv7 == 1 and arm_neon == 1', {
341           'defines': [
342             '__ARM_HAVE_NEON',
343           ],
344         }],
345         [ 'target_arch == "arm" or target_arch == "mipsel"', {
346           'sources!': [
347             '../third_party/skia/src/opts/opts_check_SSE2.cpp'
348           ],
349         }],
350         [ 'use_glib == 1', {
351           'dependencies': [
352             '../build/linux/system.gyp:fontconfig',
353             '../build/linux/system.gyp:freetype2',
354             '../build/linux/system.gyp:pangocairo',
355             '../third_party/icu/icu.gyp:icuuc',
356           ],
357           'cflags': [
358             '-Wno-unused',
359             '-Wno-unused-function',
360           ],
361           'sources': [
362             'ext/SkFontHost_fontconfig.cpp',
363             'ext/SkFontHost_fontconfig_direct.cpp',
364           ],
365           'defines': [
366 #            'SK_USE_COLOR_LUMINANCE',
367           ],
368         }],
369         [ 'use_glib == 0 and OS != "android"', {
370           'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ],
371           'sources!': [
372             '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
373             '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
374           ],
375         }],
376         [ 'toolkit_uses_gtk == 1', {
377           'dependencies': [
378             '../build/linux/system.gyp:gdk',
379           ],
380         }, {  # toolkit_uses_gtk == 0
381           'sources/': [ ['exclude', '_gtk\\.(cc|cpp)$'] ],
382         }],
383         [ 'OS == "android"', {
384           'sources/': [
385             ['exclude', '_linux\\.(cc|cpp)$'],
386           ],
387           'conditions': [
388             [ '_toolset == "target"', {
389               'defines': [
390                 'HAVE_PTHREADS',
391                 'OS_ANDROID',
392                 'SK_BUILD_FOR_ANDROID_NDK',
393                 # Android devices are typically more memory constrained, so
394                 # use a smaller glyph cache.
395                 'SK_DEFAULT_FONT_CACHE_LIMIT=(8*1024*1024)',
396                 'USE_CHROMIUM_SKIA',
397               ],
398               'dependencies': [
399                 '../third_party/expat/expat.gyp:expat',
400                 '../third_party/freetype/freetype.gyp:ft2',
401                 'skia_opts'
402               ],
403               'dependencies!': [
404                 # Android doesn't use Skia's PDF generation, which is what uses
405                 # sfntly.
406                 '../third_party/sfntly/sfntly.gyp:sfntly',
407               ],
408               # This exports a hard dependency because it needs to run its
409               # symlink action in order to expose the skia header files.
410               'hard_dependency': 1,
411               'include_dirs': [
412                 '../third_party/expat/files/lib',
413               ],
414               'sources/': [
415                 ['include', 'ext/platform_device_linux\\.cc$'],
416                 ['exclude', '../third_party/skia/src/pdf/'],
417               ],
418               'sources!': [
419                 'ext/vector_platform_device_skia.cc',
420               ],
421             }],
422             [ '_toolset == "target" and android_build_type == 0', {
423               'defines': [
424                 'HAVE_ENDIAN_H',
425               ],
426             }],
427             [ '_toolset=="host" and host_os=="linux"', {
428               'sources': [
429                 'ext/platform_device_linux.cc',
430               ],
431             }],
432           ],
433         }],
434         [ 'OS == "ios"', {
435           'defines': [
436             'SK_BUILD_FOR_IOS',
437             'SK_USE_MAC_CORE_TEXT',
438           ],
439           'include_dirs': [
440             '../third_party/skia/include/utils/ios',
441             '../third_party/skia/include/utils/mac',
442           ],
443           'link_settings': {
444             'libraries': [
445               '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework',
446             ],
447           },
448           'dependencies': [
449             'skia_opts_ios',
450           ],
451           'dependencies!': [
452             'skia_opts',
453             '../third_party/sfntly/sfntly.gyp:sfntly',
454           ],
455           'sources': [
456             # This file is used on both iOS and Mac, so it should be removed
457             #  from the ios and mac conditions and moved into the main sources
458             #  list.
459             '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
460           ],
461           'sources/': [
462             ['exclude', '/pdf/'],
463             ['exclude', '^ext/vector_platform_device_skia\\.'],
464             ['exclude', 'opts_check_SSE2\\.cpp$'],
465             ['exclude', 'SkFontHost_tables\\.cpp$',],
466           ],
467         }],
468         [ 'OS == "mac"', {
469           'defines': [
470             'SK_BUILD_FOR_MAC',
471           ],
472           'include_dirs': [
473             '../third_party/skia/include/utils/mac',
474           ],
475           'link_settings': {
476             'libraries': [
477               '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
478             ],
479           },
480           'sources': [
481             '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
482           ],
483           'sources!': [
484             # The mac's fonthost implements the table methods natively,
485             # so no need for these generic versions.
486             '../third_party/skia/src/ports/SkFontHost_tables.cpp',
487           ],
488           'conditions': [
489              [ 'use_skia == 0', {
490                'sources/': [
491                  ['exclude', '/pdf/'],
492                  ['exclude', 'ext/vector_platform_device_skia\\.(cc|h)'],
493                ],
494             },
495             { # use_skia
496               'defines': [
497                 'SK_USE_MAC_CORE_TEXT',
498 #                'SK_USE_COLOR_LUMINANCE',
499               ],
500             }],
501           ],
502         }],
503         [ 'OS == "win"', {
504           'sources!': [
505             '../third_party/skia/src/core/SkMMapStream.cpp',
506             '../third_party/skia/src/ports/SkFontHost_sandbox_none.cpp',
507             '../third_party/skia/src/ports/SkThread_pthread.cpp',
508             '../third_party/skia/src/ports/SkTime_Unix.cpp',
509             'ext/SkThread_chrome.cc',
510           ],
511           'include_dirs': [
512             'config/win',
513           ],
514           'direct_dependent_settings': {
515             'include_dirs': [
516               'config/win',
517             ],
518           },
519         }],
520         ['component=="shared_library"', {
521           'defines': [
522             'GR_DLL=1',
523             'GR_IMPLEMENTATION=1',
524             'SKIA_DLL',
525             'SKIA_IMPLEMENTATION=1',
526           ],
527           'dependencies': [
528             '../base/base.gyp:base',
529           ],
530           'direct_dependent_settings': {
531             'defines': [
532               'GR_DLL',
533               'SKIA_DLL',
534             ],
535           },
536         }],
537       ],
538       'dependencies': [
539         'skia_opts',
540         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
541         '../third_party/sfntly/sfntly.gyp:sfntly',
542         '../third_party/zlib/zlib.gyp:zlib',
543       ],
544       'direct_dependent_settings': {
545         'include_dirs': [
546           'config',
548           #temporary until we can hide SkFontHost
549           '../third_party/skia/src/core',
551           '../third_party/skia/include/config',
552           '../third_party/skia/include/core',
553           '../third_party/skia/include/effects',
554           '../third_party/skia/include/pdf',
555           '../third_party/skia/include/gpu',
556           '../third_party/skia/include/gpu/gl',
557           '../third_party/skia/include/pipe',
558           '../third_party/skia/include/ports',
559           '../third_party/skia/include/utils',
560           'ext',
561         ],
562         'defines': [
563           'SK_BUILD_NO_IMAGE_ENCODE',
564           'SK_DEFERRED_CANVAS_USES_GPIPE=1',
565           'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
566           'GR_AGGRESSIVE_SHADER_OPTS=1',
567         ],
568         'conditions': [
569           [ 'chromeos == 1', {
570             'defines': [
571             'SK_SUPPORT_HINTING_SCALE_FACTOR',
572           ],
573           }],
574           ['OS=="android"', {
575             'dependencies!': [
576               'skia_opts',
577               '../third_party/zlib/zlib.gyp:zlib',
578             ],
579             'defines': [
580               # Don't use non-NDK available stuff.
581               'SK_BUILD_FOR_ANDROID_NDK',
582             ],
583             'conditions': [
584               [ '_toolset == "target" and android_build_type == 0', {
585                 'defines': [
586                   'HAVE_ENDIAN_H',
587                 ],
588               }],
589             ],
590           }],
591           ['OS=="mac"', {
592             'include_dirs': [
593               '../third_party/skia/include/utils/mac',
594             ],
595           }],
596         ],
597       },
598       'target_conditions': [
599         # Pull in specific Mac files for iOS (which have been filtered out
600         # by file name rules).
601         [ 'OS == "ios"', {
602           'sources/': [
603             ['include', 'SkFontHost_mac\\.cpp$',],
604             ['include', 'SkStream_mac\\.cpp$',],
605             ['include', 'SkCreateCGImageRef\\.cpp$',],
606           ],
607         }],
608       ],
609     },
611     # Due to an unfortunate intersection of lameness between gcc and gyp,
612     # we have to build the *_SSE2.cpp files in a separate target.  The
613     # gcc lameness is that, in order to compile SSE2 intrinsics code, it
614     # must be passed the -msse2 flag.  However, with this flag, it may
615     # emit SSE2 instructions even for scalar code, such as the CPUID
616     # test used to test for the presence of SSE2.  So that, and all other
617     # code must be compiled *without* -msse2.  The gyp lameness is that it
618     # does not allow file-specific CFLAGS, so we must create this extra
619     # target for those files to be compiled with -msse2.
620     #
621     # This is actually only a problem on 32-bit Linux (all Intel Macs have
622     # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
623     # SSE2 from instrinsics, which generating plain ol' 386 for everything
624     # else).  However, to keep the .gyp file simple and avoid platform-specific
625     # build breakage, we do this on all platforms.
627     # For about the same reason, we need to compile the ARM opts files
628     # separately as well.
629     {
630       'target_name': 'skia_opts',
631       'type': 'static_library',
632       'variables': {
633         'optimize': 'max',
634       },
635       'include_dirs': [
636         '..',
637         'config',
638         '../third_party/skia/include/config',
639         '../third_party/skia/include/core',
640         '../third_party/skia/include/effects',
641         '../third_party/skia/include/images',
642         '../third_party/skia/include/utils',
643         '../third_party/skia/src/core',
644       ],
645       'conditions': [
646         [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
647            target_arch != "arm" and target_arch != "mipsel"', {
648           'cflags': [
649             '-msse2',
650           ],
651         }],
652         [ 'OS == "android"', {
653           'defines': [
654             'SK_BUILD_FOR_ANDROID_NDK',
655           ],
656         }],
657         [ 'target_arch != "arm" and target_arch != "mipsel"', {
658           'sources': [
659             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
660             '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
661             '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
662             '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
663           ],
664           'conditions': [
665             # x86 Android doesn't support SSSE3 instructions.
666             [ 'OS != "android"', {
667               'dependencies': [
668                 'skia_opts_ssse3',
669               ],
670             }],
671           ],
672         }],
673         [ 'target_arch == "arm"', {
674           'conditions': [
675             [ 'armv7 == 1', {
676               'defines': [
677                 '__ARM_ARCH__=7',
678               ],
679             }],
680             [ 'armv7 == 1 and arm_neon == 1', {
681               'defines': [
682                 '__ARM_HAVE_NEON',
683               ],
684               'cflags': [
685                 # The neon assembly contains conditional instructions which
686                 # aren't enclosed in an IT block. The assembler complains
687                 # without this option.
688                 # See #86592.
689                 '-Wa,-mimplicit-it=always',
690               ],
691            }],
692           ],
693           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
694           # ARM), the compiler doesn't like that. Explicitly remove the
695           # -fno-omit-frame-pointer flag for Android, as that gets added to all
696           # targets via common.gypi.
697           'cflags!': [
698             '-fno-omit-frame-pointer',
699             '-marm',
700             '-mapcs-frame',
701           ],
702           'cflags': [
703             '-fomit-frame-pointer',
704           ],
705           'sources': [
706             '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
707           ],
708         }],
709         [ 'armv7 == 1 and arm_neon == 0', {
710           'sources': [
711             '../third_party/skia/src/opts/memset.arm.S',
712         ],
713         }],
714         [ 'armv7 == 1 and arm_neon == 1', {
715           'sources': [
716             '../third_party/skia/src/opts/memset16_neon.S',
717             '../third_party/skia/src/opts/memset32_neon.S',
718             '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
719             '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
720             '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
721             '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
722             '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
723           ],
724         }],
725         [ 'target_arch == "arm" and armv7 == 0', {
726           'sources': [
727             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
728             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
729           ],
730         }],
731         [ 'target_arch == "arm" and armv7 == 1', {
732           'sources': [
733             '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
734             '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
735             '../third_party/skia/src/opts/opts_check_arm.cpp',
736           ],
737         }],
738         [ 'target_arch == "mipsel"',{
739           'cflags': [
740             '-fomit-frame-pointer',
741           ],
742           'sources': [
743             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
744             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
745             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
746           ],
747         }],
748       ],
749     },
750     # For the same lame reasons as what is done for skia_opts, we have to
751     # create another target specifically for SSSE3 code as we would not want
752     # to compile the SSE2 code with -mssse3 which would potentially allow
753     # gcc to generate SSSE3 code.
754     {
755       'target_name': 'skia_opts_ssse3',
756       'type': 'static_library',
757       'variables': {
758         'optimize': 'max',
759       },
760       'include_dirs': [
761         '..',
762         'config',
763         '../third_party/skia/include/config',
764         '../third_party/skia/include/core',
765         '../third_party/skia/src/core',
766       ],
767       'conditions': [
768         [ 'OS in ["linux", "freebsd", "openbsd", "solaris"]', {
769           'cflags': [
770             '-mssse3',
771           ],
772         }],
773         [ 'OS == "mac"', {
774           'xcode_settings': {
775             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
776           },
777         }],
778         [ 'OS == "win"', {
779           'include_dirs': [
780             'config/win',
781           ],
782           'direct_dependent_settings': {
783             'include_dirs': [
784               'config/win',
785             ],
786           },
787         }],
788         [ 'target_arch != "arm"', {
789           'sources': [
790             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
791           ],
792         }],
793       ],
794     },
795     {
796       'target_name': 'image_operations_bench',
797       'type': 'executable',
798       'dependencies': [
799         '../base/base.gyp:base',
800         'skia',
801       ],
802       'include_dirs': [
803         '..',
804       ],
805       'sources': [
806         'ext/image_operations_bench.cc',
807       ],
808     },
809   ],
810   'conditions': [
811     ['OS=="ios"', {
812       'targets': [
813         # The main skia_opts target does not currently work on iOS because the
814         # target architecture on iOS is determined at compile time rather than
815         # gyp time (simulator builds are x86, device builds are arm).  As a
816         # temporary measure, this is a separate opts target for iOS-only, using
817         # the _none.cpp files to avoid architecture-dependent implementations.
818         {
819           'target_name': 'skia_opts_ios',
820           'type': 'static_library',
821           'include_dirs': [
822             '..',
823             'config',
824             '../third_party/skia/include/config',
825             '../third_party/skia/include/core',
826             '../third_party/skia/include/effects',
827             '../third_party/skia/include/images',
828             '../third_party/skia/include/utils',
829             '../third_party/skia/src/core',
830           ],
831           'sources': [
832             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
833             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
834             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
835           ],
836         },
837       ],
838     }],
839   ],