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
8 'skia_src_path': '../third_party/skia/src',
9 'includes': [ '../third_party/skia/gyp/opts.gypi' ],
11 '../third_party/skia/include/core',
12 '../third_party/skia/include/effects',
13 '../third_party/skia/include/private',
14 '../third_party/skia/include/utils',
15 '../third_party/skia/src/core',
16 '../third_party/skia/src/opts',
17 '../third_party/skia/src/utils',
22 # SSE files have to be built in a separate target, because gcc needs
23 # different -msse flags for different SSE levels which enable use of SSE
24 # intrinsics but also allow emission of SSE2 instructions for scalar code.
25 # gyp does not allow per-file compiler flags.
26 # For about the same reason, we need to compile the ARM opts files
29 'target_name': 'skia_opts',
30 'type': 'static_library',
33 '../build/android/increase_size_for_speed.gypi',
34 # Disable LTO due to compiler error
35 # in mems_in_disjoint_alias_sets_p, at alias.c:393
37 '../build/android/disable_gcc_lto.gypi',
39 'include_dirs': [ '<@(include_dirs)' ],
41 [ 'target_arch != "arm" and target_arch != "mipsel" and \
42 target_arch != "arm64" and target_arch != "mips64el"', {
43 # Chrome builds with -msse2 locally, so sse2_sources could in theory
44 # be in the regular skia target. But we need skia_opts for arm
45 # anyway, so putting sse2_sources here is simpler than making this
46 # conditionally a type none target on x86.
47 'sources': [ '<@(sse2_sources)' ],
53 [ 'target_arch == "arm"', {
55 [ 'arm_version >= 7', {
56 'sources': [ '<@(armv7_sources)' ],
57 }, { # arm_version < 7
58 'sources': [ '<@(none_sources)' ],
60 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
66 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
67 # ARM), the compiler doesn't like that. Explicitly remove the
68 # -fno-omit-frame-pointer flag for Android, as that gets added to all
69 # targets via common.gypi.
71 '-fno-omit-frame-pointer',
76 '-fomit-frame-pointer',
79 [ 'target_arch == "mipsel"',{
80 'cflags': [ '-fomit-frame-pointer' ],
82 [ 'mips_dsp_rev >= 1', {
83 'sources': [ '<@(mips_dsp_sources)' ],
84 }, { # mips_dsp_rev == 0
85 'sources': [ '<@(none_sources)' ],
89 [ 'target_arch == "mips64el"',{
90 'cflags': [ '-fomit-frame-pointer' ],
91 'sources': [ '<@(none_sources)' ],
93 [ 'target_arch == "arm64"', {
94 'sources': [ '<@(arm64_sources)' ],
98 # For the same lame reasons as what is done for skia_opts, we have to
99 # create another target specifically for SSSE3 code as we would not want
100 # to compile the SSE2 code with -mssse3 which would potentially allow
101 # gcc to generate SSSE3 code.
103 'target_name': 'skia_opts_ssse3',
104 'type': 'static_library',
107 '../build/android/increase_size_for_speed.gypi',
109 'include_dirs': [ '<@(include_dirs)' ],
111 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
112 'cflags': [ '-mssse3' ],
116 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
119 [ 'OS == "win" and clang == 1', {
120 # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe
121 # doesn't need it for intrinsics. clang-cl does need it, though.
123 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
127 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
129 [ 'target_arch != "arm" and target_arch != "arm64" and \
130 target_arch != "mipsel" and target_arch != "mips64el"', {
131 'sources': [ '<@(ssse3_sources)' ],
135 # For the same lame reasons as what is done for skia_opts, we also have to
136 # create another target specifically for SSE4.1 code as we would not want
137 # to compile the SSE2 code with -msse4.1 which would potentially allow
138 # gcc to generate SSE4.1 code.
140 'target_name': 'skia_opts_sse41',
141 'type': 'static_library',
144 '../build/android/increase_size_for_speed.gypi',
146 'include_dirs': [ '<@(include_dirs)' ],
147 'sources': [ '<@(sse41_sources)' ],
149 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
150 'cflags': [ '-msse4.1' ],
154 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
157 [ 'OS == "win" and clang == 1', {
158 # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe
159 # doesn't need it for intrinsics. clang-cl does need it, though.
161 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
165 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
170 'target_name': 'skia_opts_none',
171 'type': 'static_library',
174 '../build/android/increase_size_for_speed.gypi',
176 'include_dirs': [ '<@(include_dirs)' ],
177 'sources': [ '<@(none_sources)' ],
181 # NEON code must be compiled with -mfpu=neon which also affects scalar
182 # code. To support dynamic NEON code paths, we need to build all
183 # NEON-specific sources in a separate static library. The situation
184 # is very similar to the SSSE3 one.
185 ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
188 'target_name': 'skia_opts_neon',
189 'type': 'static_library',
192 '../build/android/increase_size_for_speed.gypi',
193 # Disable LTO due to Neon issues
195 '../build/android/disable_gcc_lto.gypi',
197 'include_dirs': [ '<@(include_dirs)' ],
199 '-fno-omit-frame-pointer',
200 '-mfpu=vfp', # remove them all, just in case.
206 '-fomit-frame-pointer',
210 '-Wl,--fix-cortex-a8',
212 'sources': [ '<@(neon_sources)' ],