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