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 and (arm_neon == 1 or arm_neon_optional == 1)', {
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.
78 '-fno-omit-frame-pointer',
83 '-fomit-frame-pointer',
86 [ 'target_arch == "arm" and arm_version < 7', {
87 'sources': [ '<@(none_sources)' ],
89 [ 'target_arch == "arm" and arm_version >= 7', {
90 'sources': [ '<@(armv7_sources)' ],
92 [ 'target_arch == "mipsel" or target_arch == "mips64el"',{
93 'cflags': [ '-fomit-frame-pointer' ],
94 'sources': [ '<@(none_sources)' ],
96 [ 'target_arch == "arm64"', {
97 'sources': [ '<@(arm64_sources)' ],
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.
106 'target_name': 'skia_opts_ssse3',
107 'type': 'static_library',
110 '../build/android/increase_size_for_speed.gypi',
112 'include_dirs': [ '<@(include_dirs)' ],
114 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
115 'cflags': [ '-mssse3' ],
119 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
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.
126 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
130 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
132 [ 'target_arch != "arm" and target_arch != "arm64" and \
133 target_arch != "mipsel" and target_arch != "mips64el"', {
134 'sources': [ '<@(ssse3_sources)' ],
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.
143 'target_name': 'skia_opts_sse41',
144 'type': 'static_library',
147 '../build/android/increase_size_for_speed.gypi',
149 'include_dirs': [ '<@(include_dirs)' ],
150 'sources': [ '<@(sse41_sources)' ],
152 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
153 'cflags': [ '-msse4.1' ],
157 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
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.
164 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
168 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
173 'target_name': 'skia_opts_none',
174 'type': 'static_library',
177 '../build/android/increase_size_for_speed.gypi',
179 'include_dirs': [ '<@(include_dirs)' ],
180 'sources': [ '<@(none_sources)' ],
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)', {
191 'target_name': 'skia_opts_neon',
192 'type': 'static_library',
195 '../build/android/increase_size_for_speed.gypi',
196 # Disable LTO due to Neon issues
198 '../build/android/disable_lto.gypi',
200 'include_dirs': [ '<@(include_dirs)' ],
202 '-fno-omit-frame-pointer',
203 '-mfpu=vfp', # remove them all, just in case.
209 '-fomit-frame-pointer',
213 '-Wl,--fix-cortex-a8',
215 'sources': [ '<@(neon_sources)' ],