| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 # This gyp file contains the platform-specific optimizations for Skia | |
| 6 { | |
| 7 'variables': { | |
| 8 'skia_src_path': '../third_party/skia/src', | |
| 9 'includes': [ '../third_party/skia/gyp/opts.gypi' ], | |
| 10 'include_dirs': [ | |
| 11 '../third_party/skia/include/core', | |
| 12 '../third_party/skia/include/effects', | |
| 13 '../third_party/skia/include/private', | |
| 14 '../third_party/skia/include/utils', | |
| 15 '../third_party/skia/src/core', | |
| 16 '../third_party/skia/src/opts', | |
| 17 '../third_party/skia/src/utils', | |
| 18 ], | |
| 19 }, | |
| 20 | |
| 21 'targets': [ | |
| 22 # SSE files have to be built in a separate target, because gcc needs | |
| 23 # different -msse flags for different SSE levels which enable use of SSE | |
| 24 # intrinsics but also allow emission of SSE2 instructions for scalar code. | |
| 25 # gyp does not allow per-file compiler flags. | |
| 26 # For about the same reason, we need to compile the ARM opts files | |
| 27 # separately as well. | |
| 28 { | |
| 29 'target_name': 'skia_opts', | |
| 30 'type': 'static_library', | |
| 31 # The optimize: 'max' scattered throughout are particularly | |
| 32 # important when compiled by MSVC 2013, which seems | |
| 33 # to mis-link-time-compile code that's built with | |
| 34 # different optimization levels. http://crbug.com/543583 | |
| 35 'variables': { | |
| 36 'optimize': 'max', | |
| 37 }, | |
| 38 'includes': [ | |
| 39 'skia_common.gypi', | |
| 40 '../build/android/increase_size_for_speed.gypi', | |
| 41 # Disable LTO due to compiler error | |
| 42 # in mems_in_disjoint_alias_sets_p, at alias.c:393 | |
| 43 # crbug.com/422255 | |
| 44 '../build/android/disable_gcc_lto.gypi', | |
| 45 ], | |
| 46 'include_dirs': [ '<@(include_dirs)' ], | |
| 47 'conditions': [ | |
| 48 [ 'target_arch != "arm" and target_arch != "mipsel" and \ | |
| 49 target_arch != "arm64" and target_arch != "mips64el"', { | |
| 50 # Chrome builds with -msse2 locally, so sse2_sources could in theory | |
| 51 # be in the regular skia target. But we need skia_opts for arm | |
| 52 # anyway, so putting sse2_sources here is simpler than making this | |
| 53 # conditionally a type none target on x86. | |
| 54 'sources': [ '<@(sse2_sources)' ], | |
| 55 'dependencies': [ | |
| 56 'skia_opts_ssse3', | |
| 57 'skia_opts_sse41', | |
| 58 'skia_opts_sse42', | |
| 59 'skia_opts_avx', | |
| 60 'skia_opts_avx2', | |
| 61 ], | |
| 62 }], | |
| 63 [ 'target_arch == "arm"', { | |
| 64 'conditions': [ | |
| 65 [ 'arm_version >= 7', { | |
| 66 'sources': [ '<@(armv7_sources)' ], | |
| 67 }, { # arm_version < 7 | |
| 68 'sources': [ '<@(none_sources)' ], | |
| 69 }], | |
| 70 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)',
{ | |
| 71 'dependencies': [ | |
| 72 'skia_opts_neon', | |
| 73 ] | |
| 74 }], | |
| 75 ], | |
| 76 # The assembly uses the frame pointer register (r7 in Thumb/r11 in | |
| 77 # ARM), the compiler doesn't like that. Explicitly remove the | |
| 78 # -fno-omit-frame-pointer flag for Android, as that gets added to all | |
| 79 # targets via common.gypi. | |
| 80 'cflags!': [ | |
| 81 '-fno-omit-frame-pointer', | |
| 82 '-marm', | |
| 83 '-mapcs-frame', | |
| 84 ], | |
| 85 'cflags': [ | |
| 86 '-fomit-frame-pointer', | |
| 87 ], | |
| 88 }], | |
| 89 [ 'target_arch == "mipsel"',{ | |
| 90 'cflags': [ '-fomit-frame-pointer' ], | |
| 91 'conditions': [ | |
| 92 [ 'mips_dsp_rev >= 1', { | |
| 93 'sources': [ '<@(mips_dsp_sources)' ], | |
| 94 }, { # mips_dsp_rev == 0 | |
| 95 'sources': [ '<@(none_sources)' ], | |
| 96 }], | |
| 97 ], | |
| 98 }], | |
| 99 [ 'target_arch == "mips64el"',{ | |
| 100 'cflags': [ '-fomit-frame-pointer' ], | |
| 101 'sources': [ '<@(none_sources)' ], | |
| 102 }], | |
| 103 [ 'target_arch == "arm64"', { | |
| 104 'sources': [ '<@(arm64_sources)' ], | |
| 105 }], | |
| 106 ], | |
| 107 }, | |
| 108 # For the same lame reasons as what is done for skia_opts, we have to | |
| 109 # create another target specifically for SSSE3 code as we would not want | |
| 110 # to compile the SSE2 code with -mssse3 which would potentially allow | |
| 111 # gcc to generate SSSE3 code. | |
| 112 { | |
| 113 'target_name': 'skia_opts_ssse3', | |
| 114 'type': 'static_library', | |
| 115 # The optimize: 'max' scattered throughout are particularly | |
| 116 # important when compiled by MSVC 2013, which seems | |
| 117 # to mis-link-time-compile code that's built with | |
| 118 # different optimization levels. http://crbug.com/543583 | |
| 119 'variables': { | |
| 120 'optimize': 'max', | |
| 121 }, | |
| 122 'includes': [ | |
| 123 'skia_common.gypi', | |
| 124 '../build/android/increase_size_for_speed.gypi', | |
| 125 ], | |
| 126 'include_dirs': [ '<@(include_dirs)' ], | |
| 127 'conditions': [ | |
| 128 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { | |
| 129 'cflags': [ '-mssse3' ], | |
| 130 }], | |
| 131 [ 'OS == "mac"', { | |
| 132 'xcode_settings': { | |
| 133 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', | |
| 134 }, | |
| 135 }], | |
| 136 [ 'OS == "win" and clang == 1', { | |
| 137 # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe | |
| 138 # doesn't need it for intrinsics. clang-cl does need it, though. | |
| 139 'msvs_settings': { | |
| 140 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] }, | |
| 141 }, | |
| 142 }], | |
| 143 [ 'OS == "win"', { | |
| 144 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], | |
| 145 }], | |
| 146 [ 'target_arch != "arm" and target_arch != "arm64" and \ | |
| 147 target_arch != "mipsel" and target_arch != "mips64el"', { | |
| 148 'sources': [ '<@(ssse3_sources)' ], | |
| 149 }], | |
| 150 ], | |
| 151 }, | |
| 152 # For the same lame reasons as what is done for skia_opts, we also have to | |
| 153 # create another target specifically for SSE4.1 code as we would not want | |
| 154 # to compile the SSE2 code with -msse4.1 which would potentially allow | |
| 155 # gcc to generate SSE4.1 code. | |
| 156 { | |
| 157 'target_name': 'skia_opts_sse41', | |
| 158 'type': 'static_library', | |
| 159 # The optimize: 'max' scattered throughout are particularly | |
| 160 # important when compiled by MSVC 2013, which seems | |
| 161 # to mis-link-time-compile code that's built with | |
| 162 # different optimization levels. http://crbug.com/543583 | |
| 163 'variables': { | |
| 164 'optimize': 'max', | |
| 165 }, | |
| 166 'includes': [ | |
| 167 'skia_common.gypi', | |
| 168 '../build/android/increase_size_for_speed.gypi', | |
| 169 ], | |
| 170 'include_dirs': [ '<@(include_dirs)' ], | |
| 171 'sources': [ '<@(sse41_sources)' ], | |
| 172 'conditions': [ | |
| 173 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { | |
| 174 'cflags': [ '-msse4.1' ], | |
| 175 }], | |
| 176 [ 'OS == "mac"', { | |
| 177 'xcode_settings': { | |
| 178 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES', | |
| 179 }, | |
| 180 }], | |
| 181 [ 'OS == "win" and clang == 1', { | |
| 182 # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe | |
| 183 # doesn't need it for intrinsics. clang-cl does need it, though. | |
| 184 'msvs_settings': { | |
| 185 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] }, | |
| 186 }, | |
| 187 }], | |
| 188 [ 'OS == "win"', { | |
| 189 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], | |
| 190 }], | |
| 191 ], | |
| 192 }, | |
| 193 { | |
| 194 'target_name': 'skia_opts_sse42', | |
| 195 'type': 'static_library', | |
| 196 # The optimize: 'max' scattered throughout are particularly | |
| 197 # important when compiled by MSVC 2013, which seems | |
| 198 # to mis-link-time-compile code that's built with | |
| 199 # different optimization levels. http://crbug.com/543583 | |
| 200 'variables': { | |
| 201 'optimize': 'max', | |
| 202 }, | |
| 203 'includes': [ | |
| 204 'skia_common.gypi', | |
| 205 '../build/android/increase_size_for_speed.gypi', | |
| 206 ], | |
| 207 'include_dirs': [ '<@(include_dirs)' ], | |
| 208 'sources': [ '<@(sse42_sources)' ], | |
| 209 'conditions': [ | |
| 210 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { | |
| 211 'cflags': [ '-msse4.2' ], | |
| 212 }], | |
| 213 [ 'OS == "mac"', { | |
| 214 'xcode_settings': { | |
| 215 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES', | |
| 216 }, | |
| 217 }], | |
| 218 [ 'OS == "win" and clang == 1', { | |
| 219 # cl.exe's /arch flag doesn't have a setting for SSE4.2, and cl.exe | |
| 220 # doesn't need it for intrinsics. clang-cl does need it, though. | |
| 221 'msvs_settings': { | |
| 222 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.2' ] }, | |
| 223 }, | |
| 224 }], | |
| 225 [ 'OS == "win"', { | |
| 226 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ], | |
| 227 }], | |
| 228 ], | |
| 229 }, | |
| 230 { | |
| 231 'target_name': 'skia_opts_avx', | |
| 232 'type': 'static_library', | |
| 233 # The optimize: 'max' scattered throughout are particularly | |
| 234 # important when compiled by MSVC 2013, which seems | |
| 235 # to mis-link-time-compile code that's built with | |
| 236 # different optimization levels. http://crbug.com/543583 | |
| 237 'variables': { | |
| 238 'optimize': 'max', | |
| 239 }, | |
| 240 'includes': [ | |
| 241 'skia_common.gypi', | |
| 242 '../build/android/increase_size_for_speed.gypi', | |
| 243 ], | |
| 244 'include_dirs': [ '<@(include_dirs)' ], | |
| 245 'sources': [ '<@(avx_sources)' ], | |
| 246 'conditions': [ | |
| 247 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { | |
| 248 'cflags': [ '-mavx' ], | |
| 249 }], | |
| 250 [ 'OS == "mac"', { | |
| 251 'xcode_settings': { | |
| 252 'OTHER_CFLAGS': [ '-mavx' ], | |
| 253 }, | |
| 254 }], | |
| 255 [ 'OS == "win"', { | |
| 256 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet
': '3' } }, | |
| 257 }], | |
| 258 ], | |
| 259 }, | |
| 260 { | |
| 261 'target_name': 'skia_opts_avx2', | |
| 262 'type': 'static_library', | |
| 263 # The optimize: 'max' scattered throughout are particularly | |
| 264 # important when compiled by MSVC 2013, which seems | |
| 265 # to mis-link-time-compile code that's built with | |
| 266 # different optimization levels. http://crbug.com/543583 | |
| 267 'variables': { | |
| 268 'optimize': 'max', | |
| 269 }, | |
| 270 'includes': [ | |
| 271 'skia_common.gypi', | |
| 272 '../build/android/increase_size_for_speed.gypi', | |
| 273 ], | |
| 274 'include_dirs': [ '<@(include_dirs)' ], | |
| 275 'sources': [ '<@(avx2_sources)' ], | |
| 276 'conditions': [ | |
| 277 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { | |
| 278 'cflags': [ '-mavx2' ], | |
| 279 }], | |
| 280 [ 'OS == "mac"', { | |
| 281 'xcode_settings': { | |
| 282 'OTHER_CFLAGS': [ '-mavx2' ], | |
| 283 }, | |
| 284 }], | |
| 285 [ 'OS == "win"', { | |
| 286 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet
': '5' } }, | |
| 287 }], | |
| 288 ], | |
| 289 }, | |
| 290 { | |
| 291 'target_name': 'skia_opts_none', | |
| 292 'type': 'static_library', | |
| 293 # The optimize: 'max' scattered throughout are particularly | |
| 294 # important when compiled by MSVC 2013, which seems | |
| 295 # to mis-link-time-compile code that's built with | |
| 296 # different optimization levels. http://crbug.com/543583 | |
| 297 'variables': { | |
| 298 'optimize': 'max', | |
| 299 }, | |
| 300 'includes': [ | |
| 301 'skia_common.gypi', | |
| 302 '../build/android/increase_size_for_speed.gypi', | |
| 303 ], | |
| 304 'include_dirs': [ '<@(include_dirs)' ], | |
| 305 'sources': [ '<@(none_sources)' ], | |
| 306 }, | |
| 307 ], | |
| 308 'conditions': [ | |
| 309 # NEON code must be compiled with -mfpu=neon which also affects scalar | |
| 310 # code. To support dynamic NEON code paths, we need to build all | |
| 311 # NEON-specific sources in a separate static library. The situation | |
| 312 # is very similar to the SSSE3 one. | |
| 313 ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', { | |
| 314 'targets': [ | |
| 315 { | |
| 316 'target_name': 'skia_opts_neon', | |
| 317 'type': 'static_library', | |
| 318 'includes': [ | |
| 319 'skia_common.gypi', | |
| 320 '../build/android/increase_size_for_speed.gypi', | |
| 321 # Disable LTO due to Neon issues | |
| 322 # crbug.com/408997 | |
| 323 '../build/android/disable_gcc_lto.gypi', | |
| 324 ], | |
| 325 'include_dirs': [ '<@(include_dirs)' ], | |
| 326 'cflags!': [ | |
| 327 '-fno-omit-frame-pointer', | |
| 328 '-mfpu=vfp', # remove them all, just in case. | |
| 329 '-mfpu=vfpv3', | |
| 330 '-mfpu=vfpv3-d16', | |
| 331 ], | |
| 332 'cflags': [ | |
| 333 '-mfpu=neon', | |
| 334 '-fomit-frame-pointer', | |
| 335 ], | |
| 336 'ldflags': [ | |
| 337 '-march=armv7-a', | |
| 338 '-Wl,--fix-cortex-a8', | |
| 339 ], | |
| 340 'sources': [ '<@(neon_sources)' ], | |
| 341 }, | |
| 342 ], | |
| 343 }], | |
| 344 ], | |
| 345 } | |
| OLD | NEW |