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/utils',
14 '../third_party/skia/src/core',
15 '../third_party/skia/src/opts',
16 '../third_party/skia/src/utils',
21 # SSE files have to be built in a separate target, because gcc needs
22 # different -msse flags for different SSE levels which enable use of SSE
23 # intrinsics but also allow emission of SSE2 instructions for scalar code.
24 # gyp does not allow per-file compiler flags.
25 # For about the same reason, we need to compile the ARM opts files
28 'target_name': 'skia_opts',
29 'type': 'static_library',
32 '../build/android/increase_size_for_speed.gypi',
33 # Disable LTO due to compiler error
34 # in mems_in_disjoint_alias_sets_p, at alias.c:393
36 '../build/android/disable_lto.gypi',
38 'include_dirs': [ '<@(include_dirs)' ],
40 [ 'target_arch != "arm" and target_arch != "mipsel" and \
41 target_arch != "arm64" and target_arch != "mips64el"', {
42 # Chrome builds with -msse2 locally, so sse2_sources could in theory
43 # be in the regular skia target. But we need skia_opts for arm
44 # anyway, so putting sse2_sources here is simpler than making this
45 # conditionally a type none target on x86.
46 'sources': [ '<@(sse2_sources)' ],
52 [ 'target_arch == "arm"', {
54 [ 'arm_version >= 7', {
55 'sources': [ '<@(armv7_sources)' ],
56 }, { # arm_version < 7
57 'sources': [ '<@(none_sources)' ],
59 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
65 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
66 # ARM), the compiler doesn't like that. Explicitly remove the
67 # -fno-omit-frame-pointer flag for Android, as that gets added to all
68 # targets via common.gypi.
70 '-fno-omit-frame-pointer',
75 '-fomit-frame-pointer',
78 [ 'target_arch == "mipsel"',{
79 'cflags': [ '-fomit-frame-pointer' ],
81 [ 'mips_dsp_rev >= 1', {
82 'sources': [ '<@(mips_dsp_sources)' ],
83 }, { # mips_dsp_rev == 0
84 'sources': [ '<@(none_sources)' ],
88 [ 'target_arch == "mips64el"',{
89 'cflags': [ '-fomit-frame-pointer' ],
90 'sources': [ '<@(none_sources)' ],
92 [ 'target_arch == "arm64"', {
93 'sources': [ '<@(arm64_sources)' ],
97 # For the same lame reasons as what is done for skia_opts, we have to
98 # create another target specifically for SSSE3 code as we would not want
99 # to compile the SSE2 code with -mssse3 which would potentially allow
100 # gcc to generate SSSE3 code.
102 'target_name': 'skia_opts_ssse3',
103 'type': 'static_library',
106 '../build/android/increase_size_for_speed.gypi',
108 'include_dirs': [ '<@(include_dirs)' ],
110 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
111 'cflags': [ '-mssse3' ],
115 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
118 [ 'OS == "win" and clang == 1', {
119 # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe
120 # doesn't need it for intrinsics. clang-cl does need it, though.
122 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
126 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
128 [ 'target_arch != "arm" and target_arch != "arm64" and \
129 target_arch != "mipsel" and target_arch != "mips64el"', {
130 'sources': [ '<@(ssse3_sources)' ],
134 # For the same lame reasons as what is done for skia_opts, we also have to
135 # create another target specifically for SSE4.1 code as we would not want
136 # to compile the SSE2 code with -msse4.1 which would potentially allow
137 # gcc to generate SSE4.1 code.
139 'target_name': 'skia_opts_sse41',
140 'type': 'static_library',
143 '../build/android/increase_size_for_speed.gypi',
145 'include_dirs': [ '<@(include_dirs)' ],
146 'sources': [ '<@(sse41_sources)' ],
148 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
149 'cflags': [ '-msse4.1' ],
153 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
156 [ 'OS == "win" and clang == 1', {
157 # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe
158 # doesn't need it for intrinsics. clang-cl does need it, though.
160 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
164 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
169 'target_name': 'skia_opts_none',
170 'type': 'static_library',
173 '../build/android/increase_size_for_speed.gypi',
175 'include_dirs': [ '<@(include_dirs)' ],
176 'sources': [ '<@(none_sources)' ],
180 # NEON code must be compiled with -mfpu=neon which also affects scalar
181 # code. To support dynamic NEON code paths, we need to build all
182 # NEON-specific sources in a separate static library. The situation
183 # is very similar to the SSSE3 one.
184 ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
187 'target_name': 'skia_opts_neon',
188 'type': 'static_library',
191 '../build/android/increase_size_for_speed.gypi',
192 # Disable LTO due to Neon issues
194 '../build/android/disable_lto.gypi',
196 'include_dirs': [ '<@(include_dirs)' ],
198 '-fno-omit-frame-pointer',
199 '-mfpu=vfp', # remove them all, just in case.
205 '-fomit-frame-pointer',
209 '-Wl,--fix-cortex-a8',
211 'sources': [ '<@(neon_sources)' ],