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 # 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.
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
40 'target_name': 'skia_opts',
41 'type': 'static_library',
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
48 '../build/android/disable_lto.gypi',
50 'include_dirs': [ '<@(include_dirs)' ],
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' ],
57 [ 'target_arch != "arm" and target_arch != "mipsel" and \
58 target_arch != "arm64" and target_arch != "mips64el"', {
59 'sources': [ '<@(sse2_sources)' ],
65 [ 'target_arch == "arm"', {
67 [ 'arm_version >= 7', {
68 'sources': [ '<@(armv7_sources)' ],
69 }, { # arm_version < 7
70 'sources': [ '<@(none_sources)' ],
72 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
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.
83 '-fno-omit-frame-pointer',
88 '-fomit-frame-pointer',
91 [ 'target_arch == "mipsel"',{
92 'cflags': [ '-fomit-frame-pointer' ],
94 [ 'mips_dsp_rev >= 1', {
95 'sources': [ '<@(mips_dsp_sources)' ],
96 }, { # mips_dsp_rev == 0
97 'sources': [ '<@(none_sources)' ],
101 [ 'target_arch == "mips64el"',{
102 'cflags': [ '-fomit-frame-pointer' ],
103 'sources': [ '<@(none_sources)' ],
105 [ 'target_arch == "arm64"', {
106 'sources': [ '<@(arm64_sources)' ],
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.
115 'target_name': 'skia_opts_ssse3',
116 'type': 'static_library',
119 '../build/android/increase_size_for_speed.gypi',
121 'include_dirs': [ '<@(include_dirs)' ],
123 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
124 'cflags': [ '-mssse3' ],
128 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
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.
135 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
139 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
141 [ 'target_arch != "arm" and target_arch != "arm64" and \
142 target_arch != "mipsel" and target_arch != "mips64el"', {
143 'sources': [ '<@(ssse3_sources)' ],
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.
152 'target_name': 'skia_opts_sse41',
153 'type': 'static_library',
156 '../build/android/increase_size_for_speed.gypi',
158 'include_dirs': [ '<@(include_dirs)' ],
159 'sources': [ '<@(sse41_sources)' ],
161 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
162 'cflags': [ '-msse4.1' ],
166 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
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.
173 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
177 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
182 'target_name': 'skia_opts_none',
183 'type': 'static_library',
186 '../build/android/increase_size_for_speed.gypi',
188 'include_dirs': [ '<@(include_dirs)' ],
189 'sources': [ '<@(none_sources)' ],
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)', {
200 'target_name': 'skia_opts_neon',
201 'type': 'static_library',
204 '../build/android/increase_size_for_speed.gypi',
205 # Disable LTO due to Neon issues
207 '../build/android/disable_lto.gypi',
209 'include_dirs': [ '<@(include_dirs)' ],
211 '-fno-omit-frame-pointer',
212 '-mfpu=vfp', # remove them all, just in case.
218 '-fomit-frame-pointer',
222 '-Wl,--fix-cortex-a8',
224 'sources': [ '<@(neon_sources)' ],