Set test_isolation_outdir to '' by default
[chromium-blink-merge.git] / skia / skia.gyp
blob8646a2feaf4e7eb3550528cafbb3c984cdd50c2b
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',
221         'SK_ENABLE_INST_COUNT=0',
223         # this flag can be removed entirely once this has baked for a while
224         'SK_ALLOW_OVER_32K_BITMAPS',
226         # skia uses static initializers to initialize the serialization logic
227         # of its "pictures" library. This is currently not used in chrome; if
228         # it ever gets used the processes that use it need to call
229         # SkGraphics::Init().
230         'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
231       ],
232       'sources!': [
233         '../third_party/skia/include/core/SkTypes.h',
234       ],
235       'conditions': [
236         ['skia_support_gpu != 0', {
237           'includes': [
238             '../third_party/skia/gyp/gpu.gypi',
239           ],
240           'sources': [
241             '<@(gr_sources)',
242             '<@(skgr_sources)',
243           ],
244           'include_dirs': [
245             '../third_party/skia/include/gpu',
246             '../third_party/skia/include/gpu/gl',
247             '../third_party/skia/src/gpu',
248           ],
249         }, {  # skia_support_gpu == 0
250           'defines': [
251             'SK_SUPPORT_GPU=0',
252           ],
253         }],
254         ['release_valgrind_build == 1', {
255           'defines': [
256             'SK_DEBUG_PATH_REF=1',
257           ],
258           'direct_dependent_settings': {
259             'defines': [
260               'SK_DEBUG_PATH_REF=1',
261             ],
262           },
263         }],
264         #Settings for text blitting, chosen to approximate the system browser.
265         [ 'OS == "linux"', {
266           'defines': [
267             'SK_GAMMA_EXPONENT=1.2',
268             'SK_GAMMA_CONTRAST=0.2',
269           ],
270         }],
271         ['OS == "android" or OS == "win"', {
272           'defines': [
273             'SK_GAMMA_SRGB',
274             'SK_GAMMA_CONTRAST=0.5',
275           ],
276         }],
277         ['OS == "mac"', {
278           'defines': [
279             'SK_GAMMA_SRGB',
280             'SK_GAMMA_CONTRAST=0.0',
281           ],
282         }],
284         # For POSIX platforms, prefer the Mutex implementation provided by Skia
285         # since it does not generate static initializers.
286         [ 'OS == "android" or OS == "linux" or OS == "mac" or OS == "ios"', {
287           'defines+': [
288             'SK_USE_POSIX_THREADS',
289           ],
290           'direct_dependent_settings': {
291             'defines': [
292               'SK_USE_POSIX_THREADS',
293             ],
294           },
295           'sources!': [
296             'ext/SkThread_chrome.cc',
297           ],
298         }],
299         [ 'OS != "android"', {
300           'sources/': [
301             ['exclude', '_android\\.(cc|cpp)$'],
302           ],
303           'defines': [
304             'SK_DEFAULT_FONT_CACHE_LIMIT=(20*1024*1024)',
305           ],
306         }],
307         [ 'OS != "ios"', {
308           'sources/': [
309             ['exclude', '_ios\\.(cc|cpp|mm?)$'],
310           ],
311           'dependencies': [
312             '<(webkit_src_dir)/Source/WebKit/chromium/skia_webkit.gyp:skia_webkit',
313           ],
314         }],
315         [ 'OS != "mac"', {
316           'sources/': [
317             ['exclude', '_mac\\.(cc|cpp|mm?)$'],
318             ['exclude', '/mac/']
319           ],
320         }],
321         [ 'OS != "win"', {
322           'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ],
323         }],
324         [ 'chromeos == 1', {
325           'defines': [
326             # Temporarily use SkPaint to keep a scale factor needed for correct
327             # font rendering in high DPI mode.
328             # See https://codereview.appspot.com/6495089/
329             'SK_SUPPORT_HINTING_SCALE_FACTOR',
330           ],
331         }],
332         [ 'armv7 == 1', {
333           'defines': [
334             '__ARM_ARCH__=7',
335           ],
336         }],
337         [ 'armv7 == 1 and arm_neon == 1', {
338           'defines': [
339             '__ARM_HAVE_NEON',
340           ],
341         }],
342         [ 'target_arch == "arm" or target_arch == "mipsel"', {
343           'sources!': [
344             '../third_party/skia/src/opts/opts_check_SSE2.cpp'
345           ],
346         }],
347         [ 'use_glib == 1', {
348           'dependencies': [
349             '../build/linux/system.gyp:fontconfig',
350             '../build/linux/system.gyp:freetype2',
351             '../build/linux/system.gyp:pangocairo',
352             '../third_party/icu/icu.gyp:icuuc',
353           ],
354           'cflags': [
355             '-Wno-unused',
356             '-Wno-unused-function',
357           ],
358           'sources': [
359             'ext/SkFontHost_fontconfig.cpp',
360             'ext/SkFontHost_fontconfig_direct.cpp',
361           ],
362           'defines': [
363 #            'SK_USE_COLOR_LUMINANCE',
364           ],
365         }],
366         [ 'use_glib == 0 and OS != "android"', {
367           'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ],
368           'sources!': [
369             '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
370             '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
371           ],
372         }],
373         [ 'toolkit_uses_gtk == 1', {
374           'dependencies': [
375             '../build/linux/system.gyp:gdk',
376           ],
377         }, {  # toolkit_uses_gtk == 0
378           'sources/': [ ['exclude', '_gtk\\.(cc|cpp)$'] ],
379         }],
380         [ 'OS == "android"', {
381           'sources/': [
382             ['exclude', '_linux\\.(cc|cpp)$'],
383           ],
384           'conditions': [
385             [ '_toolset == "target"', {
386               'defines': [
387                 'HAVE_PTHREADS',
388                 'OS_ANDROID',
389                 'SK_BUILD_FOR_ANDROID_NDK',
390                 # Android devices are typically more memory constrained, so
391                 # use a smaller glyph cache.
392                 'SK_DEFAULT_FONT_CACHE_LIMIT=(8*1024*1024)',
393                 'USE_CHROMIUM_SKIA',
394               ],
395               'dependencies': [
396                 '../third_party/expat/expat.gyp:expat',
397                 '../third_party/freetype/freetype.gyp:ft2',
398                 'skia_opts'
399               ],
400               'dependencies!': [
401                 # Android doesn't use Skia's PDF generation, which is what uses
402                 # sfntly.
403                 '../third_party/sfntly/sfntly.gyp:sfntly',
404               ],
405               # This exports a hard dependency because it needs to run its
406               # symlink action in order to expose the skia header files.
407               'hard_dependency': 1,
408               'include_dirs': [
409                 '../third_party/expat/files/lib',
410               ],
411               'sources/': [
412                 ['include', 'ext/platform_device_linux\\.cc$'],
413                 ['exclude', '../third_party/skia/src/pdf/'],
414               ],
415               'sources!': [
416                 'ext/vector_platform_device_skia.cc',
417               ],
418             }],
419             [ '_toolset == "target" and android_build_type == 0', {
420               'defines': [
421                 'HAVE_ENDIAN_H',
422               ],
423             }],
424             [ '_toolset=="host" and host_os=="linux"', {
425               'sources': [
426                 'ext/platform_device_linux.cc',
427               ],
428             }],
429           ],
430         }],
431         [ 'OS == "ios"', {
432           'defines': [
433             'SK_BUILD_FOR_IOS',
434             'SK_USE_MAC_CORE_TEXT',
435           ],
436           'include_dirs': [
437             '../third_party/skia/include/utils/ios',
438             '../third_party/skia/include/utils/mac',
439           ],
440           'link_settings': {
441             'libraries': [
442               '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework',
443             ],
444           },
445           'dependencies': [
446             'skia_opts_ios',
447           ],
448           'dependencies!': [
449             'skia_opts',
450             '../third_party/sfntly/sfntly.gyp:sfntly',
451           ],
452           'sources': [
453             # This file is used on both iOS and Mac, so it should be removed
454             #  from the ios and mac conditions and moved into the main sources
455             #  list.
456             '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
457           ],
458           'sources/': [
459             ['exclude', '/pdf/'],
460             ['exclude', '^ext/vector_platform_device_skia\\.'],
461             ['exclude', 'opts_check_SSE2\\.cpp$'],
462             ['exclude', 'SkFontHost_tables\\.cpp$',],
463           ],
464         }],
465         [ 'OS == "mac"', {
466           'defines': [
467             'SK_BUILD_FOR_MAC',
468           ],
469           'include_dirs': [
470             '../third_party/skia/include/utils/mac',
471           ],
472           'link_settings': {
473             'libraries': [
474               '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
475             ],
476           },
477           'sources': [
478             '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
479           ],
480           'sources!': [
481             # The mac's fonthost implements the table methods natively,
482             # so no need for these generic versions.
483             '../third_party/skia/src/ports/SkFontHost_tables.cpp',
484           ],
485           'conditions': [
486              [ 'use_skia == 0', {
487                'sources/': [
488                  ['exclude', '/pdf/'],
489                  ['exclude', 'ext/vector_platform_device_skia\\.(cc|h)'],
490                ],
491             },
492             { # use_skia
493               'defines': [
494                 'SK_USE_MAC_CORE_TEXT',
495 #                'SK_USE_COLOR_LUMINANCE',
496               ],
497             }],
498           ],
499         }],
500         [ 'OS == "win"', {
501           'sources!': [
502             '../third_party/skia/src/core/SkMMapStream.cpp',
503             '../third_party/skia/src/ports/SkFontHost_sandbox_none.cpp',
504             '../third_party/skia/src/ports/SkThread_pthread.cpp',
505             '../third_party/skia/src/ports/SkTime_Unix.cpp',
506             'ext/SkThread_chrome.cc',
507           ],
508           'include_dirs': [
509             'config/win',
510           ],
511           'direct_dependent_settings': {
512             'include_dirs': [
513               'config/win',
514             ],
515           },
516         }],
517         ['component=="shared_library"', {
518           'defines': [
519             'GR_DLL=1',
520             'GR_IMPLEMENTATION=1',
521             'SKIA_DLL',
522             'SKIA_IMPLEMENTATION=1',
523           ],
524           'dependencies': [
525             '../base/base.gyp:base',
526           ],
527           'direct_dependent_settings': {
528             'defines': [
529               'GR_DLL',
530               'SKIA_DLL',
531             ],
532           },
533         }],
534       ],
535       'dependencies': [
536         'skia_opts',
537         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
538         '../third_party/sfntly/sfntly.gyp:sfntly',
539         '../third_party/zlib/zlib.gyp:zlib',
540       ],
541       'direct_dependent_settings': {
542         'include_dirs': [
543           'config',
545           #temporary until we can hide SkFontHost
546           '../third_party/skia/src/core',
548           '../third_party/skia/include/config',
549           '../third_party/skia/include/core',
550           '../third_party/skia/include/effects',
551           '../third_party/skia/include/pdf',
552           '../third_party/skia/include/gpu',
553           '../third_party/skia/include/gpu/gl',
554           '../third_party/skia/include/pipe',
555           '../third_party/skia/include/ports',
556           '../third_party/skia/include/utils',
557           'ext',
558         ],
559         'defines': [
560           'SK_BUILD_NO_IMAGE_ENCODE',
561           'SK_DEFERRED_CANVAS_USES_GPIPE=1',
562           'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
563           'GR_AGGRESSIVE_SHADER_OPTS=1',
564           'SK_ENABLE_INST_COUNT=0',
565         ],
566         'conditions': [
567           [ 'chromeos == 1', {
568             'defines': [
569             'SK_SUPPORT_HINTING_SCALE_FACTOR',
570           ],
571           }],
572           ['OS=="android"', {
573             'dependencies!': [
574               'skia_opts',
575               '../third_party/zlib/zlib.gyp:zlib',
576             ],
577             'defines': [
578               # Don't use non-NDK available stuff.
579               'SK_BUILD_FOR_ANDROID_NDK',
580             ],
581             'conditions': [
582               [ '_toolset == "target" and android_build_type == 0', {
583                 'defines': [
584                   'HAVE_ENDIAN_H',
585                 ],
586               }],
587             ],
588           }],
589           ['OS=="mac"', {
590             'include_dirs': [
591               '../third_party/skia/include/utils/mac',
592             ],
593           }],
594         ],
595       },
596       'target_conditions': [
597         # Pull in specific Mac files for iOS (which have been filtered out
598         # by file name rules).
599         [ 'OS == "ios"', {
600           'sources/': [
601             ['include', 'SkFontHost_mac\\.cpp$',],
602             ['include', 'SkStream_mac\\.cpp$',],
603             ['include', 'SkCreateCGImageRef\\.cpp$',],
604           ],
605         }],
606       ],
607     },
609     # Due to an unfortunate intersection of lameness between gcc and gyp,
610     # we have to build the *_SSE2.cpp files in a separate target.  The
611     # gcc lameness is that, in order to compile SSE2 intrinsics code, it
612     # must be passed the -msse2 flag.  However, with this flag, it may
613     # emit SSE2 instructions even for scalar code, such as the CPUID
614     # test used to test for the presence of SSE2.  So that, and all other
615     # code must be compiled *without* -msse2.  The gyp lameness is that it
616     # does not allow file-specific CFLAGS, so we must create this extra
617     # target for those files to be compiled with -msse2.
618     #
619     # This is actually only a problem on 32-bit Linux (all Intel Macs have
620     # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
621     # SSE2 from instrinsics, which generating plain ol' 386 for everything
622     # else).  However, to keep the .gyp file simple and avoid platform-specific
623     # build breakage, we do this on all platforms.
625     # For about the same reason, we need to compile the ARM opts files
626     # separately as well.
627     {
628       'target_name': 'skia_opts',
629       'type': 'static_library',
630       'variables': {
631         'optimize': 'max',
632       },
633       'include_dirs': [
634         '..',
635         'config',
636         '../third_party/skia/include/config',
637         '../third_party/skia/include/core',
638         '../third_party/skia/include/effects',
639         '../third_party/skia/include/images',
640         '../third_party/skia/include/utils',
641         '../third_party/skia/src/core',
642       ],
643       'conditions': [
644         [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
645            target_arch != "arm" and target_arch != "mipsel"', {
646           'cflags': [
647             '-msse2',
648           ],
649         }],
650         [ 'OS == "android"', {
651           'defines': [
652             'SK_BUILD_FOR_ANDROID_NDK',
653           ],
654         }],
655         [ 'target_arch != "arm" and target_arch != "mipsel"', {
656           'sources': [
657             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
658             '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
659             '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
660             '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
661           ],
662           'conditions': [
663             # x86 Android doesn't support SSSE3 instructions.
664             [ 'OS != "android"', {
665               'dependencies': [
666                 'skia_opts_ssse3',
667               ],
668             }],
669           ],
670         }],
671         [ 'target_arch == "arm"', {
672           'conditions': [
673             [ 'armv7 == 1', {
674               'defines': [
675                 '__ARM_ARCH__=7',
676               ],
677             }],
678             [ 'armv7 == 1 and arm_neon == 1', {
679               'defines': [
680                 '__ARM_HAVE_NEON',
681               ],
682               'cflags': [
683                 # The neon assembly contains conditional instructions which
684                 # aren't enclosed in an IT block. The assembler complains
685                 # without this option.
686                 # See #86592.
687                 '-Wa,-mimplicit-it=always',
688               ],
689            }],
690           ],
691           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
692           # ARM), the compiler doesn't like that. Explicitly remove the
693           # -fno-omit-frame-pointer flag for Android, as that gets added to all
694           # targets via common.gypi.
695           'cflags!': [
696             '-fno-omit-frame-pointer',
697             '-marm',
698             '-mapcs-frame',
699           ],
700           'cflags': [
701             '-fomit-frame-pointer',
702           ],
703           'sources': [
704             '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
705           ],
706         }],
707         [ 'armv7 == 1 and arm_neon == 0', {
708           'sources': [
709             '../third_party/skia/src/opts/memset.arm.S',
710         ],
711         }],
712         [ 'armv7 == 1 and arm_neon == 1', {
713           'sources': [
714             '../third_party/skia/src/opts/memset16_neon.S',
715             '../third_party/skia/src/opts/memset32_neon.S',
716             '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
717             '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
718             '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
719             '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
720             '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
721           ],
722         }],
723         [ 'target_arch == "arm" and armv7 == 0', {
724           'sources': [
725             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
726             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
727           ],
728         }],
729         [ 'target_arch == "arm" and armv7 == 1', {
730           'sources': [
731             '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
732             '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
733             '../third_party/skia/src/opts/opts_check_arm.cpp',
734           ],
735         }],
736         [ 'target_arch == "mipsel"',{
737           'cflags': [
738             '-fomit-frame-pointer',
739           ],
740           'sources': [
741             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
742             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
743             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
744           ],
745         }],
746       ],
747     },
748     # For the same lame reasons as what is done for skia_opts, we have to
749     # create another target specifically for SSSE3 code as we would not want
750     # to compile the SSE2 code with -mssse3 which would potentially allow
751     # gcc to generate SSSE3 code.
752     {
753       'target_name': 'skia_opts_ssse3',
754       'type': 'static_library',
755       'variables': {
756         'optimize': 'max',
757       },
758       'include_dirs': [
759         '..',
760         'config',
761         '../third_party/skia/include/config',
762         '../third_party/skia/include/core',
763         '../third_party/skia/src/core',
764       ],
765       'conditions': [
766         [ 'OS in ["linux", "freebsd", "openbsd", "solaris"]', {
767           'cflags': [
768             '-mssse3',
769           ],
770         }],
771         [ 'OS == "mac"', {
772           'xcode_settings': {
773             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
774           },
775         }],
776         [ 'OS == "win"', {
777           'include_dirs': [
778             'config/win',
779           ],
780           'direct_dependent_settings': {
781             'include_dirs': [
782               'config/win',
783             ],
784           },
785         }],
786         [ 'target_arch != "arm"', {
787           'sources': [
788             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
789           ],
790         }],
791       ],
792     },
793     {
794       'target_name': 'image_operations_bench',
795       'type': 'executable',
796       'dependencies': [
797         '../base/base.gyp:base',
798         'skia',
799       ],
800       'include_dirs': [
801         '..',
802       ],
803       'sources': [
804         'ext/image_operations_bench.cc',
805       ],
806     },
807   ],
808   'conditions': [
809     ['OS=="ios"', {
810       'targets': [
811         # The main skia_opts target does not currently work on iOS because the
812         # target architecture on iOS is determined at compile time rather than
813         # gyp time (simulator builds are x86, device builds are arm).  As a
814         # temporary measure, this is a separate opts target for iOS-only, using
815         # the _none.cpp files to avoid architecture-dependent implementations.
816         {
817           'target_name': 'skia_opts_ios',
818           'type': 'static_library',
819           'include_dirs': [
820             '..',
821             'config',
822             '../third_party/skia/include/config',
823             '../third_party/skia/include/core',
824             '../third_party/skia/include/effects',
825             '../third_party/skia/include/images',
826             '../third_party/skia/include/utils',
827             '../third_party/skia/src/core',
828           ],
829           'sources': [
830             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
831             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
832             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
833           ],
834         },
835       ],
836     }],
837   ],