Omnibox - Control HQP's HUP-Like Scoring Mode via Field Trial
[chromium-blink-merge.git] / skia / skia_library_opts.gyp
blob58f036f0161a287890cf2ca0706040b1b7bae215
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # This gyp file contains the platform-specific optimizations for Skia
7   'variables': {
8       'skia_src_path': '../third_party/skia/src',
9       'includes': [ '../third_party/skia/gyp/opts.gypi' ],
10       'include_dirs': [
11         '../third_party/skia/include/core',
12         '../third_party/skia/include/effects',
13         '../third_party/skia/include/utils',
14         '../third_party/skia/src/core',
15         '../third_party/skia/src/opts',
16         '../third_party/skia/src/utils',
17       ],
18    },
20   'targets': [
21     # Due to an unfortunate intersection of lameness between gcc and gyp,
22     # we have to build the *_SSE2.cpp files in a separate target.  The
23     # gcc lameness is that, in order to compile SSE2 intrinsics code, it
24     # must be passed the -msse2 flag.  However, with this flag, it may
25     # emit SSE2 instructions even for scalar code, such as the CPUID
26     # test used to test for the presence of SSE2.  So that, and all other
27     # code must be compiled *without* -msse2.  The gyp lameness is that it
28     # does not allow file-specific CFLAGS, so we must create this extra
29     # target for those files to be compiled with -msse2.
30     #
31     # This is actually only a problem on 32-bit Linux (all Intel Macs have
32     # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
33     # SSE2 from instrinsics, which generating plain ol' 386 for everything
34     # else).  However, to keep the .gyp file simple and avoid platform-specific
35     # build breakage, we do this on all platforms.
37     # For about the same reason, we need to compile the ARM opts files
38     # separately as well.
39     {
40       'target_name': 'skia_opts',
41       'type': 'static_library',
42       'includes': [
43         'skia_common.gypi',
44         '../build/android/increase_size_for_speed.gypi',
45         # Disable LTO due to compiler error
46         # in mems_in_disjoint_alias_sets_p, at alias.c:393
47         # crbug.com/422255
48         '../build/android/disable_lto.gypi',
49       ],
50       'include_dirs': [ '<@(include_dirs)' ],
51       'conditions': [
52         [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
53            target_arch != "arm" and target_arch != "arm64" and \
54            target_arch != "mipsel" and target_arch != "mips64el"', {
55           'cflags': [ '-msse2' ],
56         }],
57         [ 'target_arch != "arm" and target_arch != "mipsel" and \
58            target_arch != "arm64" and target_arch != "mips64el"', {
59           'sources': [ '<@(sse2_sources)' ],
60           'dependencies': [
61             'skia_opts_ssse3',
62             'skia_opts_sse41',
63           ],
64         }],
65         [ 'target_arch == "arm"', {
66           'conditions': [
67             [ 'arm_version >= 7', {
68               'sources': [ '<@(armv7_sources)' ],
69             }, {  # arm_version < 7
70               'sources': [ '<@(none_sources)' ],
71             }],
72             [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
73               'dependencies': [
74                 'skia_opts_neon',
75               ]
76             }],
77           ],
78           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
79           # ARM), the compiler doesn't like that. Explicitly remove the
80           # -fno-omit-frame-pointer flag for Android, as that gets added to all
81           # targets via common.gypi.
82           'cflags!': [
83             '-fno-omit-frame-pointer',
84             '-marm',
85             '-mapcs-frame',
86           ],
87           'cflags': [
88             '-fomit-frame-pointer',
89           ],
90         }],
91         [ 'target_arch == "mipsel"',{
92           'cflags': [ '-fomit-frame-pointer' ],
93           'conditions': [
94             [ 'mips_dsp_rev >= 1', {
95               'sources': [ '<@(mips_dsp_sources)' ],
96             }, {  # mips_dsp_rev == 0
97               'sources': [ '<@(none_sources)' ],
98             }],
99           ],
100         }],
101         [ 'target_arch == "mips64el"',{
102           'cflags': [ '-fomit-frame-pointer' ],
103           'sources': [ '<@(none_sources)' ],
104         }],
105         [ 'target_arch == "arm64"', {
106           'sources': [ '<@(arm64_sources)' ],
107         }],
108       ],
109     },
110     # For the same lame reasons as what is done for skia_opts, we have to
111     # create another target specifically for SSSE3 code as we would not want
112     # to compile the SSE2 code with -mssse3 which would potentially allow
113     # gcc to generate SSSE3 code.
114     {
115       'target_name': 'skia_opts_ssse3',
116       'type': 'static_library',
117       'includes': [
118         'skia_common.gypi',
119         '../build/android/increase_size_for_speed.gypi',
120       ],
121       'include_dirs': [ '<@(include_dirs)' ],
122       'conditions': [
123         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
124           'cflags': [ '-mssse3' ],
125         }],
126         [ 'OS == "mac"', {
127           'xcode_settings': {
128             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
129           },
130         }],
131         [ 'OS == "win" and clang == 1', {
132           # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe
133           # doesn't need it for intrinsics. clang-cl does need it, though.
134           'msvs_settings': {
135             'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
136           },
137         }],
138         [ 'OS == "win"', {
139           'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
140         }],
141         [ 'target_arch != "arm" and target_arch != "arm64" and \
142            target_arch != "mipsel" and target_arch != "mips64el"', {
143           'sources': [ '<@(ssse3_sources)' ],
144         }],
145       ],
146     },
147     # For the same lame reasons as what is done for skia_opts, we also have to
148     # create another target specifically for SSE4.1 code as we would not want
149     # to compile the SSE2 code with -msse4.1 which would potentially allow
150     # gcc to generate SSE4.1 code.
151     {
152       'target_name': 'skia_opts_sse41',
153       'type': 'static_library',
154       'includes': [
155         'skia_common.gypi',
156         '../build/android/increase_size_for_speed.gypi',
157       ],
158       'include_dirs': [ '<@(include_dirs)' ],
159       'sources': [ '<@(sse41_sources)' ],
160       'conditions': [
161         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
162           'cflags': [ '-msse4.1' ],
163         }],
164         [ 'OS == "mac"', {
165           'xcode_settings': {
166             'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
167           },
168         }],
169         [ 'OS == "win" and clang == 1', {
170           # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe
171           # doesn't need it for intrinsics. clang-cl does need it, though.
172           'msvs_settings': {
173             'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
174           },
175         }],
176         [ 'OS == "win"', {
177           'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
178         }],
179       ],
180     },
181     {
182       'target_name': 'skia_opts_none',
183       'type': 'static_library',
184       'includes': [
185         'skia_common.gypi',
186         '../build/android/increase_size_for_speed.gypi',
187       ],
188       'include_dirs': [ '<@(include_dirs)' ],
189       'sources': [ '<@(none_sources)' ],
190     },
191   ],
192   'conditions': [
193     # NEON code must be compiled with -mfpu=neon which also affects scalar
194     # code. To support dynamic NEON code paths, we need to build all
195     # NEON-specific sources in a separate static library. The situation
196     # is very similar to the SSSE3 one.
197     ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
198       'targets': [
199         {
200           'target_name': 'skia_opts_neon',
201           'type': 'static_library',
202           'includes': [
203             'skia_common.gypi',
204             '../build/android/increase_size_for_speed.gypi',
205             # Disable LTO due to Neon issues
206             # crbug.com/408997
207             '../build/android/disable_lto.gypi',
208           ],
209           'include_dirs': [ '<@(include_dirs)' ],
210           'cflags!': [
211             '-fno-omit-frame-pointer',
212             '-mfpu=vfp',  # remove them all, just in case.
213             '-mfpu=vfpv3',
214             '-mfpu=vfpv3-d16',
215           ],
216           'cflags': [
217             '-mfpu=neon',
218             '-fomit-frame-pointer',
219           ],
220           'ldflags': [
221             '-march=armv7-a',
222             '-Wl,--fix-cortex-a8',
223           ],
224           'sources': [ '<@(neon_sources)' ],
225         },
226       ],
227     }],
228   ],