blob: 55306e4ee106c442c3d8bb547333730de7f72eec [file] [log] [blame]
scroggo@google.comd4adfa32014-02-05 16:35:12 +00001# Gyp file for opts projects
epoger@google.comae85aea2011-05-31 13:50:51 +00002{
epoger@google.comae85aea2011-05-31 13:50:51 +00003 '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',
borenet@google.comefb1d772012-10-10 19:45:51 +000024 'product_name': 'skia_opts',
epoger@google.comae85aea2011-05-31 13:50:51 +000025 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +000026 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +000027 'dependencies': [
28 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +000029 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +000030 ],
epoger@google.comae85aea2011-05-31 13:50:51 +000031 'include_dirs': [
epoger@google.comae85aea2011-05-31 13:50:51 +000032 '../src/core',
djsollen@google.coma44e6c62012-01-09 14:38:25 +000033 '../src/opts',
krajcevski630598c2014-07-14 12:00:04 -070034 '../src/utils',
epoger@google.comae85aea2011-05-31 13:50:51 +000035 ],
36 'conditions': [
caryclark@google.com867cbd82012-09-20 15:45:41 +000037 [ 'skia_arch_type == "x86" and skia_os != "ios"', {
tomhudson@google.com95ad1552012-02-14 18:28:54 +000038 'conditions': [
mtklein@google.comd9d5c052013-07-31 20:09:25 +000039 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]', {
tomhudson@google.com95ad1552012-02-14 18:28:54 +000040 'cflags': [
41 '-msse2',
42 ],
43 }],
44 ],
humper@google.comb0889472013-07-09 21:37:14 +000045 'include_dirs': [
46 '../include/utils',
47 ],
mtklein@google.comd9d5c052013-07-31 20:09:25 +000048 'dependencies': [
49 'opts_ssse3',
henrik.smiding3bb195e2014-06-27 08:03:17 -070050 'opts_sse4',
mtklein@google.comd9d5c052013-07-31 20:09:25 +000051 ],
djsollen@google.com58629292011-11-03 13:08:29 +000052 'sources': [
commit-bot@chromium.org8c4953c2014-04-30 14:58:46 +000053 '../src/opts/opts_check_x86.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000054 '../src/opts/SkBitmapProcState_opts_SSE2.cpp',
humper@google.comb0889472013-07-09 21:37:14 +000055 '../src/opts/SkBitmapFilter_opts_SSE2.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000056 '../src/opts/SkBlitRow_opts_SSE2.cpp',
tomhudson@google.com8dd90a92012-03-19 13:49:50 +000057 '../src/opts/SkBlitRect_opts_SSE2.cpp',
senorblanco@chromium.org27eec462013-11-08 20:49:04 +000058 '../src/opts/SkBlurImage_opts_SSE2.cpp',
senorblanco@chromium.org7a47ad32013-10-30 21:57:04 +000059 '../src/opts/SkMorphology_opts_SSE2.cpp',
krajcevski630598c2014-07-14 12:00:04 -070060 '../src/opts/SkTextureCompression_opts_none.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000061 '../src/opts/SkUtils_opts_SSE2.cpp',
commit-bot@chromium.orgc524e982014-04-09 15:43:46 +000062 '../src/opts/SkXfermode_opts_SSE2.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000063 ],
64 }],
djsollen@google.comf7542ba2013-07-31 12:57:27 +000065 [ 'skia_arch_type == "arm" and arm_version >= 7', {
djsollen@google.com58629292011-11-03 13:08:29 +000066 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
67 # ARM), the compiler doesn't like that.
68 'cflags!': [
69 '-fno-omit-frame-pointer',
djsollen@google.com5afbbc42012-11-29 15:09:58 +000070 '-mapcs-frame',
71 '-mapcs',
djsollen@google.com58629292011-11-03 13:08:29 +000072 ],
73 'cflags': [
74 '-fomit-frame-pointer',
djsollen@google.com5afbbc42012-11-29 15:09:58 +000075 '-mno-apcs-frame',
djsollen@google.com58629292011-11-03 13:08:29 +000076 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +000077 'variables': {
78 'arm_neon_optional%': '<(arm_neon_optional>',
79 },
djsollen@google.com58629292011-11-03 13:08:29 +000080 'sources': [
djsollen@google.coma44e6c62012-01-09 14:38:25 +000081 '../src/opts/memset.arm.S',
djsollen@google.com58629292011-11-03 13:08:29 +000082 '../src/opts/SkBitmapProcState_opts_arm.cpp',
commit-bot@chromium.orge997c262013-08-28 15:07:58 +000083 '../src/opts/SkBlitMask_opts_arm.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000084 '../src/opts/SkBlitRow_opts_arm.cpp',
commit-bot@chromium.org57641652014-02-10 15:01:05 +000085 '../src/opts/SkBlurImage_opts_arm.cpp',
86 '../src/opts/SkMorphology_opts_arm.cpp',
krajcevski630598c2014-07-14 12:00:04 -070087 '../src/opts/SkTextureCompression_opts_arm.cpp',
commit-bot@chromium.org57641652014-02-10 15:01:05 +000088 '../src/opts/SkUtils_opts_arm.cpp',
commit-bot@chromium.orgdf187c72013-10-09 14:39:46 +000089 '../src/opts/SkXfermode_opts_arm.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000090 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +000091 'conditions': [
92 [ 'arm_neon == 1 or arm_neon_optional == 1', {
93 'dependencies': [
94 'opts_neon',
95 ]
caryclark@google.com867cbd82012-09-20 15:45:41 +000096 }],
97 [ 'skia_os == "ios"', {
98 'sources!': [
caryclark@google.com594dd3c2012-09-24 19:33:57 +000099 # these fail to compile under xcode for ios
caryclark@google.com867cbd82012-09-20 15:45:41 +0000100 '../src/opts/memset.arm.S',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000101 '../src/opts/SkBitmapProcState_opts_arm.cpp',
102 '../src/opts/SkBlitRow_opts_arm.cpp',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000103 ],
104 }],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000105 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000106 }],
djordje.pesut632a4542014-06-11 06:56:10 -0700107 [ 'skia_arch_type == "mips"', {
108 'sources': [
djordje.pesut632a4542014-06-11 06:56:10 -0700109 '../src/opts/SkBlitMask_opts_none.cpp',
110 '../src/opts/SkBlurImage_opts_none.cpp',
111 '../src/opts/SkMorphology_opts_none.cpp',
112 '../src/opts/SkUtils_opts_none.cpp',
krajcevski630598c2014-07-14 12:00:04 -0700113 '../src/opts/SkTextureCompression_opts_none.cpp',
djordje.pesut632a4542014-06-11 06:56:10 -0700114 '../src/opts/SkXfermode_opts_none.cpp',
115 ],
116 'conditions': [
117 [ '(mips_arch_variant == "mips32r2") \
118 and (mips_dsp == 1 or mips_dsp == 2)', {
119 'sources': [
djordje.pesuta26bbb92014-07-08 02:24:16 -0700120 '../src/opts/SkBitmapProcState_opts_mips_dsp.cpp',
djordje.pesut632a4542014-06-11 06:56:10 -0700121 '../src/opts/SkBlitRow_opts_mips_dsp.cpp',
122 ],
123 }, {
124 'sources': [
djordje.pesuta26bbb92014-07-08 02:24:16 -0700125 '../src/opts/SkBitmapProcState_opts_none.cpp',
djordje.pesut632a4542014-06-11 06:56:10 -0700126 '../src/opts/SkBlitRow_opts_none.cpp',
127 ],
128 }],
129 ],
130 }],
131 [ '(skia_arch_type == "arm" and arm_version < 7) \
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000132 or (skia_os == "ios") \
commit-bot@chromium.orgab084372014-05-22 13:42:34 +0000133 or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "mips", "arm64"])', {
djsollen@google.com58629292011-11-03 13:08:29 +0000134 'sources': [
135 '../src/opts/SkBitmapProcState_opts_none.cpp',
commit-bot@chromium.orge997c262013-08-28 15:07:58 +0000136 '../src/opts/SkBlitMask_opts_none.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +0000137 '../src/opts/SkBlitRow_opts_none.cpp',
senorblanco@chromium.org27eec462013-11-08 20:49:04 +0000138 '../src/opts/SkBlurImage_opts_none.cpp',
senorblanco@chromium.org7a47ad32013-10-30 21:57:04 +0000139 '../src/opts/SkMorphology_opts_none.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +0000140 '../src/opts/SkUtils_opts_none.cpp',
krajcevski630598c2014-07-14 12:00:04 -0700141 '../src/opts/SkTextureCompression_opts_none.cpp',
commit-bot@chromium.orgdf187c72013-10-09 14:39:46 +0000142 '../src/opts/SkXfermode_opts_none.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +0000143 ],
144 }],
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000145 [ 'skia_android_framework', {
146 'cflags!': [
147 '-msse2',
148 '-mfpu=neon',
149 '-fomit-frame-pointer',
150 '-mno-apcs-frame',
151 ]
152 }],
commit-bot@chromium.orgab084372014-05-22 13:42:34 +0000153 [ 'skia_arch_type == "arm64"', {
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +0000154 'sources': [
155 '../src/opts/SkBitmapProcState_arm_neon.cpp',
156 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
157 '../src/opts/SkBitmapProcState_opts_arm.cpp',
158 '../src/opts/SkBlitMask_opts_arm.cpp',
159 '../src/opts/SkBlitMask_opts_arm_neon.cpp',
kevin.petit866b95d2014-06-03 10:08:07 -0700160 '../src/opts/SkBlitRow_opts_arm.cpp',
161 '../src/opts/SkBlitRow_opts_arm_neon.cpp',
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +0000162 '../src/opts/SkBlurImage_opts_arm.cpp',
163 '../src/opts/SkBlurImage_opts_neon.cpp',
164 '../src/opts/SkMorphology_opts_arm.cpp',
165 '../src/opts/SkMorphology_opts_neon.cpp',
krajcevski630598c2014-07-14 12:00:04 -0700166 '../src/opts/SkTextureCompression_opts_none.cpp',
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +0000167 '../src/opts/SkUtils_opts_none.cpp',
168 '../src/opts/SkXfermode_opts_arm.cpp',
169 '../src/opts/SkXfermode_opts_arm_neon.cpp',
170 ],
171 }],
epoger@google.comae85aea2011-05-31 13:50:51 +0000172 ],
173 },
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000174 # For the same lame reasons as what is done for skia_opts, we have to
175 # create another target specifically for SSSE3 code as we would not want
176 # to compile the SSE2 code with -mssse3 which would potentially allow
177 # gcc to generate SSSE3 code.
178 {
179 'target_name': 'opts_ssse3',
borenet@google.comefb1d772012-10-10 19:45:51 +0000180 'product_name': 'skia_opts_ssse3',
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000181 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +0000182 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +0000183 'dependencies': [
184 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +0000185 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +0000186 ],
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000187 'include_dirs': [
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000188 '../src/core',
krajcevski630598c2014-07-14 12:00:04 -0700189 '../src/utils',
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000190 ],
djsollenbc893292014-07-24 13:53:56 -0700191 'sources': [
192 '../src/opts/SkBitmapProcState_opts_SSSE3.cpp',
193 ],
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000194 'conditions': [
djsollenbc893292014-07-24 13:53:56 -0700195 [ 'skia_os == "win"', {
196 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ],
197 }],
198 # (Mac has -mssse3 globally.)
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000199 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"] \
200 and not skia_android_framework', {
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000201 'cflags': [
202 '-mssse3',
203 ],
204 }],
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000205 ],
206 },
henrik.smiding3bb195e2014-06-27 08:03:17 -0700207 # For the same lame reasons as what is done for skia_opts, we also have to
208 # create another target specifically for SSE4 code as we would not want
209 # to compile the SSE2 code with -msse4 which would potentially allow
210 # gcc to generate SSE4 code.
211 {
212 'target_name': 'opts_sse4',
213 'product_name': 'skia_opts_sse4',
214 'type': 'static_library',
215 'standalone_static_library': 1,
216 'dependencies': [
217 'core.gyp:*',
218 'effects.gyp:*'
219 ],
220 'include_dirs': [
221 '../src/core',
krajcevski630598c2014-07-14 12:00:04 -0700222 '../src/utils',
henrik.smiding3bb195e2014-06-27 08:03:17 -0700223 ],
djsollenbc893292014-07-24 13:53:56 -0700224 'sources': [
225 '../src/opts/SkBlurImage_opts_SSE4.cpp',
226 ],
henrik.smiding3bb195e2014-06-27 08:03:17 -0700227 'conditions': [
djsollenbc893292014-07-24 13:53:56 -0700228 [ 'skia_arch_width == 64', {
229 'sources': [
230 '../src/opts/SkBlitRow_opts_SSE4_x64_asm.S',
231 ],
232 }],
233 [ 'skia_arch_width == 32', {
234 'sources': [
235 '../src/opts/SkBlitRow_opts_SSE4_asm.S',
236 ],
237 }],
238 [ 'skia_os == "win"', {
239 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
240 }],
henrik.smiding5f7f9d02014-07-07 08:05:40 -0700241 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"] \
henrik.smiding3bb195e2014-06-27 08:03:17 -0700242 and not skia_android_framework', {
243 'cflags': [
djsollenbc893292014-07-24 13:53:56 -0700244 '-msse4.1',
henrik.smiding3bb195e2014-06-27 08:03:17 -0700245 ],
246 }],
henrik.smiding5f7f9d02014-07-07 08:05:40 -0700247 [ 'skia_os == "mac"', {
248 'xcode_settings': {
249 'OTHER_CPLUSPLUSFLAGS!': [
250 '-mssse3',
251 ],
252 'OTHER_CPLUSPLUSFLAGS': [
djsollenbc893292014-07-24 13:53:56 -0700253 '-msse4.1',
henrik.smiding5f7f9d02014-07-07 08:05:40 -0700254 ],
255 },
256 }],
henrik.smiding3bb195e2014-06-27 08:03:17 -0700257 ],
258 },
digit@google.comeec9dbc2012-05-30 13:54:41 +0000259 # NEON code must be compiled with -mfpu=neon which also affects scalar
260 # code. To support dynamic NEON code paths, we need to build all
261 # NEON-specific sources in a separate static library. The situation
henrik.smiding3bb195e2014-06-27 08:03:17 -0700262 # is very similar to the SSSE3 and SSE4 one.
digit@google.comeec9dbc2012-05-30 13:54:41 +0000263 {
264 'target_name': 'opts_neon',
borenet@google.comefb1d772012-10-10 19:45:51 +0000265 'product_name': 'skia_opts_neon',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000266 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +0000267 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +0000268 'dependencies': [
269 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +0000270 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +0000271 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000272 'include_dirs': [
digit@google.comeec9dbc2012-05-30 13:54:41 +0000273 '../src/core',
digit@google.comfce02ac2012-08-01 14:25:07 +0000274 '../src/opts',
krajcevski630598c2014-07-14 12:00:04 -0700275 '../src/utils',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000276 ],
277 'cflags!': [
278 '-fno-omit-frame-pointer',
279 '-mfpu=vfp', # remove them all, just in case.
280 '-mfpu=vfpv3',
281 '-mfpu=vfpv3-d16',
282 ],
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000283 'conditions': [
284 [ 'not skia_android_framework', {
285 'cflags': [
286 '-mfpu=neon',
287 '-fomit-frame-pointer',
288 ],
289 }],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000290 ],
djsollen@google.com4dcc6242013-01-23 18:56:38 +0000291 'ldflags': [
292 '-march=armv7-a',
293 '-Wl,--fix-cortex-a8',
294 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000295 'sources': [
296 '../src/opts/memset16_neon.S',
297 '../src/opts/memset32_neon.S',
digit@google.com3ada0ef2012-08-13 14:06:34 +0000298 '../src/opts/SkBitmapProcState_arm_neon.cpp',
digit@google.comfce02ac2012-08-01 14:25:07 +0000299 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
commit-bot@chromium.orga96176d2014-01-28 15:18:54 +0000300 '../src/opts/SkBitmapProcState_matrix_neon.h',
rmistry@google.comd6bab022013-12-02 13:50:38 +0000301 '../src/opts/SkBlitMask_opts_arm_neon.cpp',
digit@google.coma8dd1ce2012-08-08 22:06:29 +0000302 '../src/opts/SkBlitRow_opts_arm_neon.cpp',
senorblanco@chromium.org1d62f422013-12-04 18:19:45 +0000303 '../src/opts/SkBlurImage_opts_neon.cpp',
senorblanco@chromium.orgf376f5d2013-11-11 16:48:51 +0000304 '../src/opts/SkMorphology_opts_neon.cpp',
krajcevski630598c2014-07-14 12:00:04 -0700305 '../src/opts/SkTextureCompression_opts_neon.cpp',
commit-bot@chromium.orgcd7992b2013-10-17 16:29:34 +0000306 '../src/opts/SkXfermode_opts_arm_neon.cpp',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000307 ],
308 },
epoger@google.comae85aea2011-05-31 13:50:51 +0000309 ],
310}