OLD | NEW |
| 1 # Gyp file for opts projects |
1 { | 2 { |
2 # Source lists live in opts.gypi. This makes it easier to maintain our Chrome
GYP/GN setup. | 3 'targets': [ |
3 # (To be honest, I'm not sure why we need to include common.gypi. I thought i
t was automatic.) | 4 # Due to an unfortunate intersection of lameness between gcc and gyp, |
4 'variables': { | 5 # we have to build the *_SSE2.cpp files in a separate target. The |
5 'includes': [ 'common.gypi', 'opts.gypi' ], | 6 # gcc lameness is that, in order to compile SSE2 intrinsics code, it |
6 }, | 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. |
7 | 19 |
8 # Generally we shove things into one 'opts' target conditioned on platform. | 20 # For about the same reason, we need to compile the ARM opts files |
9 # If a particular platform needs some files built with different flags, | 21 # separately as well. |
10 # those become separate targets: opts_ssse3, opts_sse41, opts_neon. | |
11 | |
12 'targets': [ | |
13 { | 22 { |
14 'target_name': 'opts', | 23 'target_name': 'opts', |
15 'product_name': 'skia_opts', | 24 'product_name': 'skia_opts', |
16 'type': 'static_library', | 25 'type': 'static_library', |
17 'standalone_static_library': 1, | 26 'standalone_static_library': 1, |
18 'dependencies': [ | 27 'dependencies': [ |
19 'core.gyp:*', | 28 'core.gyp:*', |
20 'effects.gyp:*' | 29 'effects.gyp:*' |
21 ], | 30 ], |
22 'include_dirs': [ | 31 'include_dirs': [ |
23 '../src/core', | 32 '../src/core', |
24 '../src/opts', | 33 '../src/opts', |
25 '../src/utils', | 34 '../src/utils', |
26 '../include/utils', | |
27 ], | 35 ], |
28 'conditions': [ | 36 'conditions': [ |
29 [ 'skia_arch_type == "x86" and skia_os != "ios"', { | 37 [ 'skia_arch_type == "x86" and skia_os != "ios"', { |
30 'cflags': [ '-msse2' ], | 38 'conditions': [ |
31 'dependencies': [ 'opts_ssse3', 'opts_sse41' ], | 39 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "ch
romeos", "android"]', { |
32 'sources': [ '<@(sse2_sources)' ], | 40 'cflags': [ |
| 41 '-msse2', |
| 42 ], |
| 43 }], |
| 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 ], |
33 }], | 64 }], |
34 | |
35 [ 'skia_arch_type == "mips"', { | |
36 'conditions': [ | |
37 [ '(mips_arch_variant == "mips32r2") and (mips_dsp == 1 or mips_dsp
== 2)', { | |
38 'sources': [ '<@(mips_dsp_sources)' ], | |
39 },{ | |
40 'sources': [ '<@(none_sources)' ], | |
41 }], | |
42 ] | |
43 }], | |
44 | |
45 [ '(skia_arch_type == "arm" and arm_version < 7) \ | |
46 or (skia_os == "ios") \ | |
47 or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "m
ips", "arm64"])', { | |
48 'sources': [ '<@(none_sources)' ], | |
49 }], | |
50 | |
51 [ 'skia_arch_type == "arm" and arm_version >= 7', { | 65 [ 'skia_arch_type == "arm" and arm_version >= 7', { |
52 # The assembly uses the frame pointer register (r7 in Thumb/r11 in | 66 # The assembly uses the frame pointer register (r7 in Thumb/r11 in |
53 # ARM), the compiler doesn't like that. | 67 # ARM), the compiler doesn't like that. |
54 'cflags!': [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mapcs' ], | 68 'cflags!': [ |
55 'cflags': [ '-fomit-frame-pointer' ], | 69 '-fno-omit-frame-pointer', |
56 'variables': { 'arm_neon_optional%': '<(arm_neon_optional>' }, | 70 '-mapcs-frame', |
57 'sources': [ '<@(armv7_sources)' ], | 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 ], |
58 'conditions': [ | 90 'conditions': [ |
59 [ 'arm_neon == 1 or arm_neon_optional == 1', { | 91 [ 'arm_neon == 1 or arm_neon_optional == 1', { |
60 'dependencies': [ 'opts_neon' ] | 92 'dependencies': [ |
| 93 'opts_neon', |
| 94 ] |
61 }], | 95 }], |
62 [ 'skia_os == "ios"', { | 96 [ 'skia_os == "ios"', { |
63 'sources!': [ | 97 'sources!': [ |
64 # these fail to compile under xcode for ios | 98 # these fail to compile under xcode for ios |
65 '../src/opts/memset.arm.S', | 99 '../src/opts/memset.arm.S', |
66 '../src/opts/SkBitmapProcState_opts_arm.cpp', | 100 '../src/opts/SkBitmapProcState_opts_arm.cpp', |
67 '../src/opts/SkBlitRow_opts_arm.cpp', | 101 '../src/opts/SkBlitRow_opts_arm.cpp', |
68 ], | 102 ], |
69 }], | 103 }], |
70 ], | 104 ], |
71 }], | 105 }], |
72 | 106 [ 'skia_arch_type == "mips"', { |
73 [ 'skia_arch_type == "arm64"', { | 107 'sources': [ |
74 'sources': [ '<@(armv64_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 ], |
75 }], | 129 }], |
76 | 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", "m
ips", "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 }], |
77 [ 'skia_android_framework', { | 144 [ 'skia_android_framework', { |
78 'cflags!': [ | 145 'cflags!': [ |
79 '-msse2', | 146 '-msse2', |
80 '-mfpu=neon', | 147 '-mfpu=neon', |
81 '-fomit-frame-pointer', | 148 '-fomit-frame-pointer', |
82 ] | 149 ] |
83 }], | 150 }], |
| 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 }], |
84 ], | 170 ], |
85 }, | 171 }, |
| 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. |
86 { | 176 { |
87 'target_name': 'opts_ssse3', | 177 'target_name': 'opts_ssse3', |
88 'product_name': 'skia_opts_ssse3', | 178 'product_name': 'skia_opts_ssse3', |
89 'type': 'static_library', | 179 'type': 'static_library', |
90 'standalone_static_library': 1, | 180 'standalone_static_library': 1, |
91 'dependencies': [ 'core.gyp:*' ], | 181 'dependencies': [ |
92 'include_dirs': [ '../src/core' ], | 182 'core.gyp:*', |
93 'sources': [ '<@(ssse3_sources)' ], | 183 'effects.gyp:*' |
| 184 ], |
| 185 'include_dirs': [ |
| 186 '../src/core', |
| 187 '../src/utils', |
| 188 ], |
| 189 'sources': [ |
| 190 '../src/opts/SkBitmapProcState_opts_SSSE3.cpp', |
| 191 ], |
94 'conditions': [ | 192 'conditions': [ |
95 [ 'skia_os == "win"', { | 193 [ 'skia_os == "win"', { |
96 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], | 194 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], |
97 }], | 195 }], |
98 [ 'not skia_android_framework', { | 196 # (Mac has -mssse3 globally.) |
99 'cflags': [ '-mssse3' ], | 197 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chrome
os", "android"] \ |
| 198 and not skia_android_framework', { |
| 199 'cflags': [ |
| 200 '-mssse3', |
| 201 ], |
100 }], | 202 }], |
101 ], | 203 ], |
102 }, | 204 }, |
| 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. |
103 { | 209 { |
104 'target_name': 'opts_sse41', | 210 'target_name': 'opts_sse4', |
105 'product_name': 'skia_opts_sse41', | 211 'product_name': 'skia_opts_sse4', |
106 'type': 'static_library', | 212 'type': 'static_library', |
107 'standalone_static_library': 1, | 213 'standalone_static_library': 1, |
108 'dependencies': [ 'core.gyp:*' ], | 214 'dependencies': [ |
109 'sources': [ '<@(sse41_sources)' ], | 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 ], |
110 'conditions': [ | 225 'conditions': [ |
| 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 }], |
111 [ 'skia_os == "win"', { | 236 [ 'skia_os == "win"', { |
112 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], | 237 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], |
113 }], | 238 }], |
114 [ 'not skia_android_framework', { | 239 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chrome
os", "android"] \ |
115 'cflags': [ '-msse4.1' ], | 240 and not skia_android_framework', { |
| 241 'cflags': [ |
| 242 '-msse4.1', |
| 243 ], |
116 }], | 244 }], |
117 [ 'skia_os == "mac"', { | 245 [ 'skia_os == "mac"', { |
118 'xcode_settings': { 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES' }, | 246 'xcode_settings': { |
| 247 'OTHER_CPLUSPLUSFLAGS!': [ |
| 248 '-mssse3', |
| 249 ], |
| 250 'OTHER_CPLUSPLUSFLAGS': [ |
| 251 '-msse4.1', |
| 252 ], |
| 253 }, |
119 }], | 254 }], |
120 ], | 255 ], |
121 }, | 256 }, |
| 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. |
122 { | 261 { |
123 'target_name': 'opts_neon', | 262 'target_name': 'opts_neon', |
124 'product_name': 'skia_opts_neon', | 263 'product_name': 'skia_opts_neon', |
125 'type': 'static_library', | 264 'type': 'static_library', |
126 'standalone_static_library': 1, | 265 'standalone_static_library': 1, |
127 'dependencies': [ | 266 'dependencies': [ |
128 'core.gyp:*', | 267 'core.gyp:*', |
129 'effects.gyp:*' | 268 'effects.gyp:*' |
130 ], | 269 ], |
131 'include_dirs': [ | 270 'include_dirs': [ |
132 '../src/core', | 271 '../src/core', |
133 '../src/opts', | 272 '../src/opts', |
134 '../src/utils', | 273 '../src/utils', |
135 ], | 274 ], |
136 'sources': [ '<@(neon_sources)' ], | |
137 'cflags!': [ | 275 'cflags!': [ |
138 '-fno-omit-frame-pointer', | 276 '-fno-omit-frame-pointer', |
139 '-mfpu=vfp', # remove them all, just in case. | 277 '-mfpu=vfp', # remove them all, just in case. |
140 '-mfpu=vfpv3', | 278 '-mfpu=vfpv3', |
141 '-mfpu=vfpv3-d16', | 279 '-mfpu=vfpv3-d16', |
142 ], | 280 ], |
143 'conditions': [ | 281 'conditions': [ |
144 [ 'not skia_android_framework', { | 282 [ 'not skia_android_framework', { |
145 'cflags': [ | 283 'cflags': [ |
146 '-mfpu=neon', | 284 '-mfpu=neon', |
147 '-fomit-frame-pointer', | 285 '-fomit-frame-pointer', |
148 ], | 286 ], |
149 }], | 287 }], |
150 ], | 288 ], |
151 'ldflags': [ | 289 'ldflags': [ |
152 '-march=armv7-a', | 290 '-march=armv7-a', |
153 '-Wl,--fix-cortex-a8', | 291 '-Wl,--fix-cortex-a8', |
154 ], | 292 ], |
| 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 ], |
155 }, | 306 }, |
156 ], | 307 ], |
157 } | 308 } |
OLD | NEW |