mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 1 | # Gyp file for opts projects |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 2 | { |
mtklein | c98fe3a | 2015-01-26 18:05:37 -0800 | [diff] [blame] | 3 | 'targets': [ |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 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. |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 22 | { |
| 23 | 'target_name': 'opts', |
borenet@google.com | efb1d77 | 2012-10-10 19:45:51 +0000 | [diff] [blame] | 24 | 'product_name': 'skia_opts', |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 25 | 'type': 'static_library', |
borenet@google.com | efb1d77 | 2012-10-10 19:45:51 +0000 | [diff] [blame] | 26 | 'standalone_static_library': 1, |
bungeman@google.com | b8f3655 | 2013-07-22 14:39:45 +0000 | [diff] [blame] | 27 | 'dependencies': [ |
| 28 | 'core.gyp:*', |
senorblanco@chromium.org | 0ded88d | 2014-01-24 15:43:50 +0000 | [diff] [blame] | 29 | 'effects.gyp:*' |
bungeman@google.com | b8f3655 | 2013-07-22 14:39:45 +0000 | [diff] [blame] | 30 | ], |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 31 | 'include_dirs': [ |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 32 | '../src/core', |
djsollen@google.com | a44e6c6 | 2012-01-09 14:38:25 +0000 | [diff] [blame] | 33 | '../src/opts', |
krajcevski | 630598c | 2014-07-14 12:00:04 -0700 | [diff] [blame] | 34 | '../src/utils', |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 35 | ], |
| 36 | 'conditions': [ |
caryclark@google.com | 867cbd8 | 2012-09-20 15:45:41 +0000 | [diff] [blame] | 37 | [ 'skia_arch_type == "x86" and skia_os != "ios"', { |
mtklein | c98fe3a | 2015-01-26 18:05:37 -0800 | [diff] [blame] | 38 | 'conditions': [ |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 39 | [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]', { |
| 40 | 'cflags': [ |
| 41 | '-msse2', |
| 42 | ], |
mtklein | c98fe3a | 2015-01-26 18:05:37 -0800 | [diff] [blame] | 43 | }], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 44 | ], |
| 45 | 'include_dirs': [ |
| 46 | '../include/utils', |
| 47 | ], |
| 48 | 'dependencies': [ |
| 49 | 'opts_ssse3', |
| 50 | 'opts_sse4', |
| 51 | ], |
| 52 | 'sources': [ |
| 53 | '../src/opts/opts_check_x86.cpp', |
| 54 | '../src/opts/SkBitmapProcState_opts_SSE2.cpp', |
| 55 | '../src/opts/SkBitmapFilter_opts_SSE2.cpp', |
| 56 | '../src/opts/SkBlitRow_opts_SSE2.cpp', |
| 57 | '../src/opts/SkBlitRect_opts_SSE2.cpp', |
| 58 | '../src/opts/SkBlurImage_opts_SSE2.cpp', |
| 59 | '../src/opts/SkMorphology_opts_SSE2.cpp', |
| 60 | '../src/opts/SkTextureCompression_opts_none.cpp', |
| 61 | '../src/opts/SkUtils_opts_SSE2.cpp', |
| 62 | '../src/opts/SkXfermode_opts_SSE2.cpp', |
| 63 | ], |
mtklein | c98fe3a | 2015-01-26 18:05:37 -0800 | [diff] [blame] | 64 | }], |
djsollen@google.com | f7542ba | 2013-07-31 12:57:27 +0000 | [diff] [blame] | 65 | [ 'skia_arch_type == "arm" and arm_version >= 7', { |
djsollen@google.com | 5862929 | 2011-11-03 13:08:29 +0000 | [diff] [blame] | 66 | # The assembly uses the frame pointer register (r7 in Thumb/r11 in |
| 67 | # ARM), the compiler doesn't like that. |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 68 | 'cflags!': [ |
| 69 | '-fno-omit-frame-pointer', |
| 70 | '-mapcs-frame', |
| 71 | '-mapcs', |
| 72 | ], |
| 73 | 'cflags': [ |
| 74 | '-fomit-frame-pointer', |
| 75 | ], |
| 76 | 'variables': { |
| 77 | 'arm_neon_optional%': '<(arm_neon_optional>', |
| 78 | }, |
| 79 | 'sources': [ |
| 80 | '../src/opts/memset.arm.S', |
| 81 | '../src/opts/SkBitmapProcState_opts_arm.cpp', |
| 82 | '../src/opts/SkBlitMask_opts_arm.cpp', |
| 83 | '../src/opts/SkBlitRow_opts_arm.cpp', |
| 84 | '../src/opts/SkBlurImage_opts_arm.cpp', |
| 85 | '../src/opts/SkMorphology_opts_arm.cpp', |
| 86 | '../src/opts/SkTextureCompression_opts_arm.cpp', |
| 87 | '../src/opts/SkUtils_opts_arm.cpp', |
| 88 | '../src/opts/SkXfermode_opts_arm.cpp', |
| 89 | ], |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 90 | 'conditions': [ |
| 91 | [ 'arm_neon == 1 or arm_neon_optional == 1', { |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 92 | 'dependencies': [ |
| 93 | 'opts_neon', |
| 94 | ] |
caryclark@google.com | 867cbd8 | 2012-09-20 15:45:41 +0000 | [diff] [blame] | 95 | }], |
| 96 | [ 'skia_os == "ios"', { |
| 97 | 'sources!': [ |
caryclark@google.com | 594dd3c | 2012-09-24 19:33:57 +0000 | [diff] [blame] | 98 | # these fail to compile under xcode for ios |
caryclark@google.com | 867cbd8 | 2012-09-20 15:45:41 +0000 | [diff] [blame] | 99 | '../src/opts/memset.arm.S', |
caryclark@google.com | 594dd3c | 2012-09-24 19:33:57 +0000 | [diff] [blame] | 100 | '../src/opts/SkBitmapProcState_opts_arm.cpp', |
| 101 | '../src/opts/SkBlitRow_opts_arm.cpp', |
caryclark@google.com | 867cbd8 | 2012-09-20 15:45:41 +0000 | [diff] [blame] | 102 | ], |
| 103 | }], |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 104 | ], |
djsollen@google.com | 5862929 | 2011-11-03 13:08:29 +0000 | [diff] [blame] | 105 | }], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 106 | [ 'skia_arch_type == "mips"', { |
| 107 | 'sources': [ |
| 108 | '../src/opts/SkBlitMask_opts_none.cpp', |
| 109 | '../src/opts/SkBlurImage_opts_none.cpp', |
| 110 | '../src/opts/SkMorphology_opts_none.cpp', |
| 111 | '../src/opts/SkUtils_opts_none.cpp', |
| 112 | '../src/opts/SkTextureCompression_opts_none.cpp', |
| 113 | '../src/opts/SkXfermode_opts_none.cpp', |
| 114 | ], |
| 115 | 'conditions': [ |
| 116 | [ '(mips_arch_variant == "mips32r2") \ |
| 117 | and (mips_dsp == 1 or mips_dsp == 2)', { |
| 118 | 'sources': [ |
| 119 | '../src/opts/SkBitmapProcState_opts_mips_dsp.cpp', |
| 120 | '../src/opts/SkBlitRow_opts_mips_dsp.cpp', |
| 121 | ], |
| 122 | }, { |
| 123 | 'sources': [ |
| 124 | '../src/opts/SkBitmapProcState_opts_none.cpp', |
| 125 | '../src/opts/SkBlitRow_opts_none.cpp', |
| 126 | ], |
| 127 | }], |
| 128 | ], |
djordje.pesut | 632a454 | 2014-06-11 06:56:10 -0700 | [diff] [blame] | 129 | }], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 130 | [ '(skia_arch_type == "arm" and arm_version < 7) \ |
| 131 | or (skia_os == "ios") \ |
| 132 | or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "mips", "arm64"])', { |
| 133 | 'sources': [ |
| 134 | '../src/opts/SkBitmapProcState_opts_none.cpp', |
| 135 | '../src/opts/SkBlitMask_opts_none.cpp', |
| 136 | '../src/opts/SkBlitRow_opts_none.cpp', |
| 137 | '../src/opts/SkBlurImage_opts_none.cpp', |
| 138 | '../src/opts/SkMorphology_opts_none.cpp', |
| 139 | '../src/opts/SkUtils_opts_none.cpp', |
| 140 | '../src/opts/SkTextureCompression_opts_none.cpp', |
| 141 | '../src/opts/SkXfermode_opts_none.cpp', |
| 142 | ], |
| 143 | }], |
commit-bot@chromium.org | e72a408 | 2014-02-28 16:07:39 +0000 | [diff] [blame] | 144 | [ 'skia_android_framework', { |
| 145 | 'cflags!': [ |
| 146 | '-msse2', |
| 147 | '-mfpu=neon', |
| 148 | '-fomit-frame-pointer', |
commit-bot@chromium.org | e72a408 | 2014-02-28 16:07:39 +0000 | [diff] [blame] | 149 | ] |
| 150 | }], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 151 | [ 'skia_arch_type == "arm64"', { |
| 152 | 'sources': [ |
| 153 | '../src/opts/SkBitmapProcState_arm_neon.cpp', |
| 154 | '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp', |
| 155 | '../src/opts/SkBitmapProcState_opts_arm.cpp', |
| 156 | '../src/opts/SkBlitMask_opts_arm.cpp', |
| 157 | '../src/opts/SkBlitMask_opts_arm_neon.cpp', |
| 158 | '../src/opts/SkBlitRow_opts_arm.cpp', |
| 159 | '../src/opts/SkBlitRow_opts_arm_neon.cpp', |
| 160 | '../src/opts/SkBlurImage_opts_arm.cpp', |
| 161 | '../src/opts/SkBlurImage_opts_neon.cpp', |
| 162 | '../src/opts/SkMorphology_opts_arm.cpp', |
| 163 | '../src/opts/SkMorphology_opts_neon.cpp', |
| 164 | '../src/opts/SkTextureCompression_opts_none.cpp', |
| 165 | '../src/opts/SkUtils_opts_none.cpp', |
| 166 | '../src/opts/SkXfermode_opts_arm.cpp', |
| 167 | '../src/opts/SkXfermode_opts_arm_neon.cpp', |
| 168 | ], |
| 169 | }], |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 170 | ], |
| 171 | }, |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 172 | # For the same lame reasons as what is done for skia_opts, we have to |
| 173 | # create another target specifically for SSSE3 code as we would not want |
| 174 | # to compile the SSE2 code with -mssse3 which would potentially allow |
| 175 | # gcc to generate SSSE3 code. |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 176 | { |
| 177 | 'target_name': 'opts_ssse3', |
borenet@google.com | efb1d77 | 2012-10-10 19:45:51 +0000 | [diff] [blame] | 178 | 'product_name': 'skia_opts_ssse3', |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 179 | 'type': 'static_library', |
borenet@google.com | efb1d77 | 2012-10-10 19:45:51 +0000 | [diff] [blame] | 180 | 'standalone_static_library': 1, |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 181 | 'dependencies': [ |
| 182 | 'core.gyp:*', |
| 183 | 'effects.gyp:*' |
| 184 | ], |
| 185 | 'include_dirs': [ |
| 186 | '../src/core', |
| 187 | '../src/utils', |
| 188 | ], |
| 189 | 'sources': [ |
| 190 | '../src/opts/SkBitmapProcState_opts_SSSE3.cpp', |
| 191 | ], |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 192 | 'conditions': [ |
djsollen | bc89329 | 2014-07-24 13:53:56 -0700 | [diff] [blame] | 193 | [ 'skia_os == "win"', { |
| 194 | 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], |
| 195 | }], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 196 | # (Mac has -mssse3 globally.) |
| 197 | [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"] \ |
| 198 | and not skia_android_framework', { |
| 199 | 'cflags': [ |
| 200 | '-mssse3', |
| 201 | ], |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 202 | }], |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 203 | ], |
| 204 | }, |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 205 | # For the same lame reasons as what is done for skia_opts, we also have to |
| 206 | # create another target specifically for SSE4 code as we would not want |
| 207 | # to compile the SSE2 code with -msse4 which would potentially allow |
| 208 | # gcc to generate SSE4 code. |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 209 | { |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 210 | 'target_name': 'opts_sse4', |
| 211 | 'product_name': 'skia_opts_sse4', |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 212 | 'type': 'static_library', |
| 213 | 'standalone_static_library': 1, |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 214 | 'dependencies': [ |
| 215 | 'core.gyp:*', |
| 216 | 'effects.gyp:*' |
| 217 | ], |
| 218 | 'include_dirs': [ |
| 219 | '../src/core', |
| 220 | '../src/utils', |
| 221 | ], |
| 222 | 'sources': [ |
| 223 | '../src/opts/SkBlurImage_opts_SSE4.cpp', |
| 224 | ], |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 225 | 'conditions': [ |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 226 | [ 'skia_arch_width == 64', { |
| 227 | 'sources': [ |
| 228 | '../src/opts/SkBlitRow_opts_SSE4_x64_asm.S', |
| 229 | ], |
| 230 | }], |
| 231 | [ 'skia_arch_width == 32', { |
| 232 | 'sources': [ |
| 233 | '../src/opts/SkBlitRow_opts_SSE4_asm.S', |
| 234 | ], |
| 235 | }], |
djsollen | bc89329 | 2014-07-24 13:53:56 -0700 | [diff] [blame] | 236 | [ 'skia_os == "win"', { |
| 237 | 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], |
| 238 | }], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 239 | [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"] \ |
| 240 | and not skia_android_framework', { |
| 241 | 'cflags': [ |
| 242 | '-msse4.1', |
| 243 | ], |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 244 | }], |
henrik.smiding | 5f7f9d0 | 2014-07-07 08:05:40 -0700 | [diff] [blame] | 245 | [ 'skia_os == "mac"', { |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 246 | 'xcode_settings': { |
| 247 | 'OTHER_CPLUSPLUSFLAGS!': [ |
| 248 | '-mssse3', |
| 249 | ], |
| 250 | 'OTHER_CPLUSPLUSFLAGS': [ |
| 251 | '-msse4.1', |
| 252 | ], |
| 253 | }, |
henrik.smiding | 5f7f9d0 | 2014-07-07 08:05:40 -0700 | [diff] [blame] | 254 | }], |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 255 | ], |
| 256 | }, |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 257 | # NEON code must be compiled with -mfpu=neon which also affects scalar |
| 258 | # code. To support dynamic NEON code paths, we need to build all |
| 259 | # NEON-specific sources in a separate static library. The situation |
| 260 | # is very similar to the SSSE3 and SSE4 one. |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 261 | { |
| 262 | 'target_name': 'opts_neon', |
borenet@google.com | efb1d77 | 2012-10-10 19:45:51 +0000 | [diff] [blame] | 263 | 'product_name': 'skia_opts_neon', |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 264 | 'type': 'static_library', |
borenet@google.com | efb1d77 | 2012-10-10 19:45:51 +0000 | [diff] [blame] | 265 | 'standalone_static_library': 1, |
bungeman@google.com | b8f3655 | 2013-07-22 14:39:45 +0000 | [diff] [blame] | 266 | 'dependencies': [ |
| 267 | 'core.gyp:*', |
senorblanco@chromium.org | 0ded88d | 2014-01-24 15:43:50 +0000 | [diff] [blame] | 268 | 'effects.gyp:*' |
bungeman@google.com | b8f3655 | 2013-07-22 14:39:45 +0000 | [diff] [blame] | 269 | ], |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 270 | 'include_dirs': [ |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 271 | '../src/core', |
digit@google.com | fce02ac | 2012-08-01 14:25:07 +0000 | [diff] [blame] | 272 | '../src/opts', |
krajcevski | 630598c | 2014-07-14 12:00:04 -0700 | [diff] [blame] | 273 | '../src/utils', |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 274 | ], |
| 275 | 'cflags!': [ |
| 276 | '-fno-omit-frame-pointer', |
| 277 | '-mfpu=vfp', # remove them all, just in case. |
| 278 | '-mfpu=vfpv3', |
| 279 | '-mfpu=vfpv3-d16', |
| 280 | ], |
commit-bot@chromium.org | e72a408 | 2014-02-28 16:07:39 +0000 | [diff] [blame] | 281 | 'conditions': [ |
| 282 | [ 'not skia_android_framework', { |
| 283 | 'cflags': [ |
| 284 | '-mfpu=neon', |
| 285 | '-fomit-frame-pointer', |
| 286 | ], |
| 287 | }], |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 288 | ], |
djsollen@google.com | 4dcc624 | 2013-01-23 18:56:38 +0000 | [diff] [blame] | 289 | 'ldflags': [ |
| 290 | '-march=armv7-a', |
| 291 | '-Wl,--fix-cortex-a8', |
| 292 | ], |
mtklein | 0933725 | 2015-01-26 18:15:31 -0800 | [diff] [blame^] | 293 | 'sources': [ |
| 294 | '../src/opts/memset16_neon.S', |
| 295 | '../src/opts/memset32_neon.S', |
| 296 | '../src/opts/SkBitmapProcState_arm_neon.cpp', |
| 297 | '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp', |
| 298 | '../src/opts/SkBitmapProcState_matrix_neon.h', |
| 299 | '../src/opts/SkBlitMask_opts_arm_neon.cpp', |
| 300 | '../src/opts/SkBlitRow_opts_arm_neon.cpp', |
| 301 | '../src/opts/SkBlurImage_opts_neon.cpp', |
| 302 | '../src/opts/SkMorphology_opts_neon.cpp', |
| 303 | '../src/opts/SkTextureCompression_opts_neon.cpp', |
| 304 | '../src/opts/SkXfermode_opts_arm_neon.cpp', |
| 305 | ], |
digit@google.com | eec9dbc | 2012-05-30 13:54:41 +0000 | [diff] [blame] | 306 | }, |
epoger@google.com | ae85aea | 2011-05-31 13:50:51 +0000 | [diff] [blame] | 307 | ], |
| 308 | } |