Ensure that NPAPI is enabled if any enterprise plugin policies are set.
[chromium-blink-merge.git] / skia / skia_library_opts.gyp
blobcde0e0b9ea8925a9bbf7b54d2331363c3ab3551e
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 and (arm_neon == 1 or arm_neon_optional == 1)', {
68               'dependencies': [
69                 'skia_opts_neon',
70               ]
71            }],
72           ],
73           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
74           # ARM), the compiler doesn't like that. Explicitly remove the
75           # -fno-omit-frame-pointer flag for Android, as that gets added to all
76           # targets via common.gypi.
77           'cflags!': [
78             '-fno-omit-frame-pointer',
79             '-marm',
80             '-mapcs-frame',
81           ],
82           'cflags': [
83             '-fomit-frame-pointer',
84           ],
85         }],
86         [ 'target_arch == "arm" and arm_version < 7', {
87           'sources': [ '<@(none_sources)' ],
88         }],
89         [ 'target_arch == "arm" and arm_version >= 7', {
90           'sources': [ '<@(armv7_sources)' ],
91         }],
92         [ 'target_arch == "mipsel" or target_arch == "mips64el"',{
93           'cflags': [ '-fomit-frame-pointer' ],
94           'sources': [ '<@(none_sources)' ],
95         }],
96         [ 'target_arch == "arm64"', {
97           'sources': [ '<@(arm64_sources)' ],
98         }],
99       ],
100     },
101     # For the same lame reasons as what is done for skia_opts, we have to
102     # create another target specifically for SSSE3 code as we would not want
103     # to compile the SSE2 code with -mssse3 which would potentially allow
104     # gcc to generate SSSE3 code.
105     {
106       'target_name': 'skia_opts_ssse3',
107       'type': 'static_library',
108       'includes': [
109         'skia_common.gypi',
110         '../build/android/increase_size_for_speed.gypi',
111       ],
112       'include_dirs': [ '<@(include_dirs)' ],
113       'conditions': [
114         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
115           'cflags': [ '-mssse3' ],
116         }],
117         [ 'OS == "mac"', {
118           'xcode_settings': {
119             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
120           },
121         }],
122         [ 'OS == "win" and clang == 1', {
123           # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe
124           # doesn't need it for intrinsics. clang-cl does need it, though.
125           'msvs_settings': {
126             'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
127           },
128         }],
129         [ 'OS == "win"', {
130           'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
131         }],
132         [ 'target_arch != "arm" and target_arch != "arm64" and \
133            target_arch != "mipsel" and target_arch != "mips64el"', {
134           'sources': [ '<@(ssse3_sources)' ],
135         }],
136       ],
137     },
138     # For the same lame reasons as what is done for skia_opts, we also have to
139     # create another target specifically for SSE4.1 code as we would not want
140     # to compile the SSE2 code with -msse4.1 which would potentially allow
141     # gcc to generate SSE4.1 code.
142     {
143       'target_name': 'skia_opts_sse41',
144       'type': 'static_library',
145       'includes': [
146         'skia_common.gypi',
147         '../build/android/increase_size_for_speed.gypi',
148       ],
149       'include_dirs': [ '<@(include_dirs)' ],
150       'sources': [ '<@(sse41_sources)' ],
151       'conditions': [
152         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
153           'cflags': [ '-msse4.1' ],
154         }],
155         [ 'OS == "mac"', {
156           'xcode_settings': {
157             'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
158           },
159         }],
160         [ 'OS == "win" and clang == 1', {
161           # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe
162           # doesn't need it for intrinsics. clang-cl does need it, though.
163           'msvs_settings': {
164             'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
165           },
166         }],
167         [ 'OS == "win"', {
168           'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
169         }],
170       ],
171     },
172     {
173       'target_name': 'skia_opts_none',
174       'type': 'static_library',
175       'includes': [
176         'skia_common.gypi',
177         '../build/android/increase_size_for_speed.gypi',
178       ],
179       'include_dirs': [ '<@(include_dirs)' ],
180       'sources': [ '<@(none_sources)' ],
181     },
182   ],
183   'conditions': [
184     # NEON code must be compiled with -mfpu=neon which also affects scalar
185     # code. To support dynamic NEON code paths, we need to build all
186     # NEON-specific sources in a separate static library. The situation
187     # is very similar to the SSSE3 one.
188     ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
189       'targets': [
190         {
191           'target_name': 'skia_opts_neon',
192           'type': 'static_library',
193           'includes': [
194             'skia_common.gypi',
195             '../build/android/increase_size_for_speed.gypi',
196             # Disable LTO due to Neon issues
197             # crbug.com/408997
198             '../build/android/disable_lto.gypi',
199           ],
200           'include_dirs': [ '<@(include_dirs)' ],
201           'cflags!': [
202             '-fno-omit-frame-pointer',
203             '-mfpu=vfp',  # remove them all, just in case.
204             '-mfpu=vfpv3',
205             '-mfpu=vfpv3-d16',
206           ],
207           'cflags': [
208             '-mfpu=neon',
209             '-fomit-frame-pointer',
210           ],
211           'ldflags': [
212             '-march=armv7-a',
213             '-Wl,--fix-cortex-a8',
214           ],
215           'sources': [ '<@(neon_sources)' ],
216         },
217       ],
218     }],
219   ],