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.
6 # This gyp file contains the platform-specific optimizations for Skia
9 # Due to an unfortunate intersection of lameness between gcc and gyp,
10 # we have to build the *_SSE2.cpp files in a separate target. The
11 # gcc lameness is that, in order to compile SSE2 intrinsics code, it
12 # must be passed the -msse2 flag. However, with this flag, it may
13 # emit SSE2 instructions even for scalar code, such as the CPUID
14 # test used to test for the presence of SSE2. So that, and all other
15 # code must be compiled *without* -msse2. The gyp lameness is that it
16 # does not allow file-specific CFLAGS, so we must create this extra
17 # target for those files to be compiled with -msse2.
19 # This is actually only a problem on 32-bit Linux (all Intel Macs have
20 # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
21 # SSE2 from instrinsics, which generating plain ol' 386 for everything
22 # else). However, to keep the .gyp file simple and avoid platform-specific
23 # build breakage, we do this on all platforms.
25 # For about the same reason, we need to compile the ARM opts files
28 'target_name': 'skia_opts',
29 'type': 'static_library',
32 '../third_party/skia/include/config',
33 '../third_party/skia/include/core',
34 '../third_party/skia/src/core',
35 '../third_party/skia/src/opts',
38 [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
39 target_arch != "arm" and target_arch != "mipsel"', {
44 [ 'target_arch != "arm" and target_arch != "mipsel"', {
46 '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
47 '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
48 '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
49 '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
50 '../third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp',
56 [ 'target_arch == "arm"', {
58 [ 'arm_version >= 7 and arm_neon == 1', {
63 [ 'arm_version >= 7 and arm_neon_optional == 1', {
65 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
68 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
70 # The neon assembly contains conditional instructions which
71 # aren't enclosed in an IT block. The assembler complains
72 # without this option.
74 '-Wa,-mimplicit-it=always',
81 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
82 # ARM), the compiler doesn't like that. Explicitly remove the
83 # -fno-omit-frame-pointer flag for Android, as that gets added to all
84 # targets via common.gypi.
86 '-fno-omit-frame-pointer',
91 '-fomit-frame-pointer',
94 '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
97 [ 'target_arch == "arm" and (arm_version < 7 or (arm_neon == 0 and arm_neon_optional == 1))', {
99 '../third_party/skia/src/opts/memset.arm.S',
102 [ 'target_arch == "arm" and arm_version < 6', {
104 '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
105 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
106 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
109 [ 'target_arch == "arm" and arm_version >= 6', {
111 '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
112 '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
113 '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
114 '../third_party/skia/src/opts/opts_check_arm.cpp',
117 [ 'target_arch == "mipsel"',{
119 '-fomit-frame-pointer',
122 '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
123 '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
124 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
125 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
130 # For the same lame reasons as what is done for skia_opts, we have to
131 # create another target specifically for SSSE3 code as we would not want
132 # to compile the SSE2 code with -mssse3 which would potentially allow
133 # gcc to generate SSSE3 code.
135 'target_name': 'skia_opts_ssse3',
136 'type': 'static_library',
140 '../third_party/skia/include/config',
141 '../third_party/skia/include/core',
142 '../third_party/skia/src/core',
145 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
152 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
159 'direct_dependent_settings': {
165 [ 'target_arch != "arm" and target_arch != "mipsel"', {
167 '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
173 'target_name': 'skia_opts_none',
174 'type': 'static_library',
178 '../third_party/skia/include/config',
179 '../third_party/skia/include/core',
180 '../third_party/skia/src/core',
183 '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
184 '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
185 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
186 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
191 # NEON code must be compiled with -mfpu=neon which also affects scalar
192 # code. To support dynamic NEON code paths, we need to build all
193 # NEON-specific sources in a separate static library. The situation
194 # is very similar to the SSSE3 one.
195 ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
198 'target_name': 'skia_opts_neon',
199 'type': 'static_library',
203 '../third_party/skia/include/core',
204 '../third_party/skia/src/core',
205 '../third_party/skia/src/opts',
208 '-fno-omit-frame-pointer',
209 '-mfpu=vfp', # remove them all, just in case.
215 '-fomit-frame-pointer',
219 '-Wl,--fix-cortex-a8',
222 '../third_party/skia/src/opts/memset16_neon.S',
223 '../third_party/skia/src/opts/memset32_neon.S',
224 '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
225 '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
226 '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
227 '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
228 '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
236 ['arm_neon_optional == 1', {
238 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',