Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / gyp / opts.gyp
1 # Gyp file for opts projects
2 {
3   'targets': [
4     # Due to an unfortunate intersection of lameness between gcc and gyp,
5     # we have to build the *_SSE2.cpp files in a separate target.  The
6     # gcc lameness is that, in order to compile SSE2 intrinsics code, it
7     # must be passed the -msse2 flag.  However, with this flag, it may
8     # emit SSE2 instructions even for scalar code, such as the CPUID
9     # test used to test for the presence of SSE2.  So that, and all other
10     # code must be compiled *without* -msse2.  The gyp lameness is that it
11     # does not allow file-specific CFLAGS, so we must create this extra
12     # target for those files to be compiled with -msse2.
13     #
14     # This is actually only a problem on 32-bit Linux (all Intel Macs have
15     # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
16     # SSE2 from instrinsics, while generating plain ol' 386 for everything
17     # else).  However, to keep the .gyp file simple and avoid platform-specific
18     # build breakage, we do this on all platforms.
19
20     # For about the same reason, we need to compile the ARM opts files
21     # separately as well.
22     {
23       'target_name': 'opts',
24       'product_name': 'skia_opts',
25       'type': 'static_library',
26       'standalone_static_library': 1,
27       'dependencies': [
28         'core.gyp:*',
29         'effects.gyp:*'
30       ],
31       'include_dirs': [
32         '../src/core',
33         '../src/opts',
34       ],
35       'conditions': [
36         [ 'skia_arch_type == "x86" and skia_os != "ios"', {
37           'conditions': [
38             [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]', {
39               'cflags': [
40                 '-msse2',
41               ],
42             }],
43           ],
44           'include_dirs': [
45             '../include/utils',
46           ],
47           'dependencies': [
48             'opts_ssse3',
49           ],
50           'sources': [
51             '../src/opts/opts_check_x86.cpp',
52             '../src/opts/SkBitmapProcState_opts_SSE2.cpp',
53             '../src/opts/SkBitmapFilter_opts_SSE2.cpp',
54             '../src/opts/SkBlitRow_opts_SSE2.cpp',
55             '../src/opts/SkBlitRect_opts_SSE2.cpp',
56             '../src/opts/SkBlurImage_opts_SSE2.cpp',
57             '../src/opts/SkMorphology_opts_SSE2.cpp',
58             '../src/opts/SkUtils_opts_SSE2.cpp',
59             '../src/opts/SkXfermode_opts_SSE2.cpp',
60           ],
61         }],
62         [ 'skia_arch_type == "arm" and arm_version >= 7', {
63           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
64           # ARM), the compiler doesn't like that.
65           'cflags!': [
66             '-fno-omit-frame-pointer',
67             '-mapcs-frame',
68             '-mapcs',
69           ],
70           'cflags': [
71             '-fomit-frame-pointer',
72             '-mno-apcs-frame',
73           ],
74           'variables': {
75             'arm_neon_optional%': '<(arm_neon_optional>',
76           },
77           'sources': [
78             '../src/opts/memset.arm.S',
79             '../src/opts/SkBitmapProcState_opts_arm.cpp',
80             '../src/opts/SkBlitMask_opts_arm.cpp',
81             '../src/opts/SkBlitRow_opts_arm.cpp',
82             '../src/opts/SkBlitRow_opts_arm.h',
83             '../src/opts/SkBlurImage_opts_arm.cpp',
84             '../src/opts/SkMorphology_opts_arm.cpp',
85             '../src/opts/SkUtils_opts_arm.cpp',
86             '../src/opts/SkXfermode_opts_arm.cpp',
87           ],
88           'conditions': [
89             [ 'arm_neon == 1 or arm_neon_optional == 1', {
90               'dependencies': [
91                 'opts_neon',
92               ]
93             }],
94             [ 'skia_os == "ios"', {
95               'sources!': [
96                 # these fail to compile under xcode for ios
97                 '../src/opts/memset.arm.S',
98                 '../src/opts/SkBitmapProcState_opts_arm.cpp',
99                 '../src/opts/SkBlitRow_opts_arm.cpp',
100               ],
101             }],
102           ],
103         }],
104         [ '(skia_arch_type == "mips") or (skia_arch_type == "arm" and arm_version < 7) \
105             or (skia_os == "ios") \
106             or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "mips", "arm64"])', {
107           'sources': [
108             '../src/opts/SkBitmapProcState_opts_none.cpp',
109             '../src/opts/SkBlitMask_opts_none.cpp',
110             '../src/opts/SkBlitRow_opts_none.cpp',
111             '../src/opts/SkBlurImage_opts_none.cpp',
112             '../src/opts/SkMorphology_opts_none.cpp',
113             '../src/opts/SkUtils_opts_none.cpp',
114             '../src/opts/SkXfermode_opts_none.cpp',
115           ],
116         }],
117         [ 'skia_android_framework', {
118           'cflags!': [
119             '-msse2',
120             '-mfpu=neon',
121             '-fomit-frame-pointer',
122             '-mno-apcs-frame',
123           ]
124         }],
125         [ 'skia_arch_type == "arm64"', {
126           'sources': [
127             '../src/opts/SkBitmapProcState_arm_neon.cpp',
128             '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
129             '../src/opts/SkBitmapProcState_opts_arm.cpp',
130             '../src/opts/SkBlitMask_opts_arm.cpp',
131             '../src/opts/SkBlitMask_opts_arm_neon.cpp',
132             '../src/opts/SkBlitRow_opts_none.cpp',
133             '../src/opts/SkBlurImage_opts_arm.cpp',
134             '../src/opts/SkBlurImage_opts_neon.cpp',
135             '../src/opts/SkMorphology_opts_arm.cpp',
136             '../src/opts/SkMorphology_opts_neon.cpp',
137             '../src/opts/SkUtils_opts_none.cpp',
138             '../src/opts/SkXfermode_opts_arm.cpp',
139             '../src/opts/SkXfermode_opts_arm_neon.cpp',
140           ],
141         }],
142       ],
143     },
144     # For the same lame reasons as what is done for skia_opts, we have to
145     # create another target specifically for SSSE3 code as we would not want
146     # to compile the SSE2 code with -mssse3 which would potentially allow
147     # gcc to generate SSSE3 code.
148     {
149       'target_name': 'opts_ssse3',
150       'product_name': 'skia_opts_ssse3',
151       'type': 'static_library',
152       'standalone_static_library': 1,
153       'dependencies': [
154         'core.gyp:*',
155         'effects.gyp:*'
156       ],
157       'include_dirs': [
158         '../src/core',
159       ],
160       'conditions': [
161         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"] \
162            and not skia_android_framework', {
163           'cflags': [
164             '-mssse3',
165           ],
166         }],
167         # (Mac has -mssse3 globally.)
168         [ 'skia_arch_type == "x86"', {
169           'sources': [
170             '../src/opts/SkBitmapProcState_opts_SSSE3.cpp',
171           ],
172         }],
173       ],
174     },
175     # NEON code must be compiled with -mfpu=neon which also affects scalar
176     # code. To support dynamic NEON code paths, we need to build all
177     # NEON-specific sources in a separate static library. The situation
178     # is very similar to the SSSE3 one.
179     {
180       'target_name': 'opts_neon',
181       'product_name': 'skia_opts_neon',
182       'type': 'static_library',
183       'standalone_static_library': 1,
184       'dependencies': [
185         'core.gyp:*',
186         'effects.gyp:*'
187       ],
188       'include_dirs': [
189         '../src/core',
190         '../src/opts',
191       ],
192       'cflags!': [
193         '-fno-omit-frame-pointer',
194         '-mfpu=vfp',  # remove them all, just in case.
195         '-mfpu=vfpv3',
196         '-mfpu=vfpv3-d16',
197       ],
198       'conditions': [
199         [ 'not skia_android_framework', {
200           'cflags': [
201             '-mfpu=neon',
202             '-fomit-frame-pointer',
203           ],
204         }],
205       ],
206       'ldflags': [
207         '-march=armv7-a',
208         '-Wl,--fix-cortex-a8',
209       ],
210       'sources': [
211         '../src/opts/memset16_neon.S',
212         '../src/opts/memset32_neon.S',
213         '../src/opts/SkBitmapProcState_arm_neon.cpp',
214         '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
215         '../src/opts/SkBitmapProcState_matrix_neon.h',
216         '../src/opts/SkBlitMask_opts_arm_neon.cpp',
217         '../src/opts/SkBlitRow_opts_arm_neon.cpp',
218         '../src/opts/SkBlurImage_opts_neon.cpp',
219         '../src/opts/SkMorphology_opts_neon.cpp',
220         '../src/opts/SkXfermode_opts_arm_neon.cpp',
221       ],
222     },
223   ],
224 }