1 # Copyright (c) 2012 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 { 6 'xcode_settings': { 7 'SYMROOT': '<(DEPTH)/xcodebuild', 8 }, 9 'variables': { 10 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/externals/libjpeg-turbo', 11 'conditions': [ 12 [ 'skia_os == "win"', { 13 'object_suffix': 'obj', 14 }, { 15 'object_suffix': 'o', 16 }], 17 ], 18 }, 19 'targets': [ 20 { 21 'target_name': 'yasm-win', 22 'type': 'executable', 23 'sources': [ 24 '../third_party/externals/yasm/binaries/win/yasm.exe', 25 ], 26 'copies' : [{ 27 'destination': '<(PRODUCT_DIR)', 28 'files': [ '../third_party/externals/yasm/binaries/win/yasm.exe' ], 29 }], 30 }, 31 { 32 'target_name': 'libjpeg-turbo', 33 'type': 'static_library', 34 'include_dirs': [ 35 '../third_party/externals/libjpeg-turbo/', 36 ], 37 'defines': [ 38 'WITH_SIMD', 39 'MOTION_JPEG_SUPPORTED', 40 'NO_GETENV', 41 ], 42 'cflags': [ 43 '-w', # supresses warnings 44 ], 45 'msvs_settings': { 46 'VCCLCompilerTool': { 47 'WarningLevel': '0', 48 }, 49 }, 50 'xcode_settings': { 51 'WARNING_CFLAGS': [ 52 '-w', 53 ], 54 }, 55 'sources': [ 56 '../third_party/externals/libjpeg-turbo/jcapimin.c', 57 '../third_party/externals/libjpeg-turbo/jcapistd.c', 58 '../third_party/externals/libjpeg-turbo/jccoefct.c', 59 '../third_party/externals/libjpeg-turbo/jccolor.c', 60 '../third_party/externals/libjpeg-turbo/jcdctmgr.c', 61 '../third_party/externals/libjpeg-turbo/jchuff.c', 62 '../third_party/externals/libjpeg-turbo/jchuff.h', 63 '../third_party/externals/libjpeg-turbo/jcinit.c', 64 '../third_party/externals/libjpeg-turbo/jcmainct.c', 65 '../third_party/externals/libjpeg-turbo/jcmarker.c', 66 '../third_party/externals/libjpeg-turbo/jcmaster.c', 67 '../third_party/externals/libjpeg-turbo/jcomapi.c', 68 '../third_party/externals/libjpeg-turbo/jconfig.h', 69 '../third_party/externals/libjpeg-turbo/jcparam.c', 70 '../third_party/externals/libjpeg-turbo/jcphuff.c', 71 '../third_party/externals/libjpeg-turbo/jcprepct.c', 72 '../third_party/externals/libjpeg-turbo/jcsample.c', 73 '../third_party/externals/libjpeg-turbo/jdapimin.c', 74 '../third_party/externals/libjpeg-turbo/jdapistd.c', 75 '../third_party/externals/libjpeg-turbo/jdcoefct.c', 76 '../third_party/externals/libjpeg-turbo/jdcolor.c', 77 '../third_party/externals/libjpeg-turbo/jdct.h', 78 '../third_party/externals/libjpeg-turbo/jddctmgr.c', 79 '../third_party/externals/libjpeg-turbo/jdhuff.c', 80 '../third_party/externals/libjpeg-turbo/jdhuff.h', 81 '../third_party/externals/libjpeg-turbo/jdinput.c', 82 '../third_party/externals/libjpeg-turbo/jdmainct.c', 83 '../third_party/externals/libjpeg-turbo/jdmarker.c', 84 '../third_party/externals/libjpeg-turbo/jdmaster.c', 85 '../third_party/externals/libjpeg-turbo/jdmerge.c', 86 '../third_party/externals/libjpeg-turbo/jdphuff.c', 87 '../third_party/externals/libjpeg-turbo/jdpostct.c', 88 '../third_party/externals/libjpeg-turbo/jdsample.c', 89 '../third_party/externals/libjpeg-turbo/jerror.c', 90 '../third_party/externals/libjpeg-turbo/jerror.h', 91 '../third_party/externals/libjpeg-turbo/jfdctflt.c', 92 '../third_party/externals/libjpeg-turbo/jfdctfst.c', 93 '../third_party/externals/libjpeg-turbo/jfdctint.c', 94 '../third_party/externals/libjpeg-turbo/jidctflt.c', 95 '../third_party/externals/libjpeg-turbo/jidctfst.c', 96 '../third_party/externals/libjpeg-turbo/jidctint.c', 97 '../third_party/externals/libjpeg-turbo/jidctred.c', 98 '../third_party/externals/libjpeg-turbo/jinclude.h', 99 '../third_party/externals/libjpeg-turbo/jmemmgr.c', 100 '../third_party/externals/libjpeg-turbo/jmemnobs.c', 101 '../third_party/externals/libjpeg-turbo/jmemsys.h', 102 '../third_party/externals/libjpeg-turbo/jmorecfg.h', 103 '../third_party/externals/libjpeg-turbo/jpegint.h', 104 '../third_party/externals/libjpeg-turbo/jpeglib.h', 105 '../third_party/externals/libjpeg-turbo/jquant1.c', 106 '../third_party/externals/libjpeg-turbo/jquant2.c', 107 '../third_party/externals/libjpeg-turbo/jutils.c', 108 '../third_party/externals/libjpeg-turbo/jversion.h', 109 ], 110 'direct_dependent_settings': { 111 'include_dirs': [ 112 '../third_party/externals/libjpeg-turbo/', 113 ], 114 }, 115 'msvs_disabled_warnings': [4018, 4101], 116 # VS2010 does not correctly incrementally link obj files generated 117 # from asm files. This flag disables UseLibraryDependencyInputs to 118 # avoid this problem. 119 'msvs_2010_disable_uldi_when_referenced': 1, 120 121 # Add target-specific source files. 122 'conditions': [ 123 # TODO (msarett): Is it possible to enable cross compiling for Android on other platforms? 124 [ 'skia_os == "android" and host_os != "linux" and "x86" in skia_arch_type', { 125 'sources': [ 126 '../third_party/externals/libjpeg-turbo/jsimd_none.c', 127 ], 128 }], 129 [ 'skia_arch_type == "x86" and (skia_os != "android" or host_os == "linux")', { 130 'sources': [ 131 '../third_party/externals/libjpeg-turbo/simd/jsimd_i386.c', 132 '../third_party/externals/libjpeg-turbo/simd/jccolor-mmx.asm', 133 '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2.asm', 134 '../third_party/externals/libjpeg-turbo/simd/jcgray-mmx.asm', 135 '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2.asm', 136 '../third_party/externals/libjpeg-turbo/simd/jcsample-mmx.asm', 137 '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2.asm', 138 '../third_party/externals/libjpeg-turbo/simd/jdcolor-mmx.asm', 139 '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2.asm', 140 '../third_party/externals/libjpeg-turbo/simd/jdmerge-mmx.asm', 141 '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2.asm', 142 '../third_party/externals/libjpeg-turbo/simd/jdsample-mmx.asm', 143 '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2.asm', 144 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-3dn.asm', 145 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse.asm', 146 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-mmx.asm', 147 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2.asm', 148 '../third_party/externals/libjpeg-turbo/simd/jfdctint-mmx.asm', 149 '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2.asm', 150 '../third_party/externals/libjpeg-turbo/simd/jidctflt-3dn.asm', 151 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2.asm', 152 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse.asm', 153 '../third_party/externals/libjpeg-turbo/simd/jidctfst-mmx.asm', 154 '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2.asm', 155 '../third_party/externals/libjpeg-turbo/simd/jidctint-mmx.asm', 156 '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2.asm', 157 '../third_party/externals/libjpeg-turbo/simd/jidctred-mmx.asm', 158 '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2.asm', 159 '../third_party/externals/libjpeg-turbo/simd/jquant-3dn.asm', 160 '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2.asm', 161 '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2.asm', 162 '../third_party/externals/libjpeg-turbo/simd/jquant-mmx.asm', 163 '../third_party/externals/libjpeg-turbo/simd/jquant-sse.asm', 164 '../third_party/externals/libjpeg-turbo/simd/jsimdcpu.asm', 165 ], 166 }], 167 [ 'skia_arch_type == "x86_64" and (skia_os != "android" or host_os == "linux")', { 168 'sources': [ 169 '../third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c', 170 '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2-64.asm', 171 '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2-64.asm', 172 '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2-64.asm', 173 '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2-64.asm', 174 '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2-64.asm', 175 '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2-64.asm', 176 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse-64.asm', 177 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2-64.asm', 178 '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2-64.asm', 179 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2-64.asm', 180 '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2-64.asm', 181 '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2-64.asm', 182 '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2-64.asm', 183 '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2-64.asm', 184 '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2-64.asm', 185 ], 186 }], 187 [ 'skia_arch_type == "arm64"', { 188 'sources': [ 189 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c', 190 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64_neon.S', 191 ], 192 }], 193 [ 'skia_arch_type == "arm"', { 194 'conditions': [ 195 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', { 196 'sources': [ 197 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm.c', 198 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm_neon.S', 199 ], 200 }, { 201 'sources': [ 202 '../third_party/externals/libjpeg-turbo/jsimd_none.c', 203 ], 204 }], 205 ], 206 }], 207 # mips simd is supported in later versions of libjpeg-turbo. If we 208 # choose to update our copy of libjpeg-turbo we can enable mips simd. 209 [ '"mips" in skia_arch_type', { 210 'sources': [ 211 '../third_party/externals/libjpeg-turbo/jsimd_none.c', 212 ], 213 }], 214 215 # Build rules for an asm file. 216 # On Windows, we use the precompiled yasm binary. 217 # On Linux, we build our patched yasm and use it. 218 # On Mac, we always build our patched yasm and use it. 219 [ 'skia_os == "win"', { 220 'dependencies': [ 221 'yasm-win', 222 ], 223 'defines': [ 224 'TURBO_FOR_WINDOWS', 225 ], 226 'variables': { 227 'yasm_path': '<(PRODUCT_DIR)/yasm.exe', 228 'conditions': [ 229 [ 'skia_arch_type == "x86"', { 230 'yasm_format': '-fwin32', 231 'yasm_flags': [ 232 '-D__x86__', 233 '-DWIN32', 234 '-DMSVC', 235 ], 236 }, { 237 'yasm_format': '-fwin64', 238 'yasm_flags': [ 239 '-D__x86_64__', 240 '-DWIN64', 241 '-DMSVC', 242 ], 243 }], 244 ], 245 }, 246 }], 247 [ 'skia_os == "android" and host_os == "linux" and \ 248 (skia_arch_type == "x86" or skia_arch_type == "x86_64")', { 249 'dependencies': [ 250 'yasm.gyp:yasm#host', 251 ], 252 'variables': { 253 'yasm_path': '<(PRODUCT_DIR)/yasm', 254 'conditions': [ 255 [ 'skia_arch_type == "x86"', { 256 'yasm_format': '-felf', 257 'yasm_flags': [ 258 '-D__x86__', 259 '-DELF', 260 ], 261 }, { 262 'yasm_format': '-felf64', 263 'yasm_flags': [ 264 '-D__x86_64__', 265 '-DELF', 266 ], 267 }], 268 ], 269 }, 270 }], 271 [ '(skia_os == "mac" or skia_os == "ios") and \ 272 (skia_arch_type == "x86" or skia_arch_type == "x86_64")', { 273 'dependencies': [ 274 'yasm.gyp:yasm#host', 275 ], 276 'variables': { 277 'yasm_path': '<(PRODUCT_DIR)/yasm', 278 'conditions': [ 279 [ 'skia_arch_type == "x86"', { 280 'yasm_format': '-fmacho', 281 'yasm_flags': [ 282 '-D__x86__', 283 '-DMACHO', 284 ], 285 }, { 286 'yasm_format': '-fmacho64', 287 'yasm_flags': [ 288 '-D__x86_64__', 289 '-DMACHO', 290 ], 291 }], 292 ], 293 }, 294 }], 295 [ '(skia_os == "linux" or skia_os == "freebsd" or skia_os == "openbsd" or \ 296 skia_os == "solaris" or skia_os == "chromeos")', { 297 'dependencies': [ 298 'yasm.gyp:yasm#host', 299 ], 300 'variables': { 301 'yasm_path': '<(PRODUCT_DIR)/yasm', 302 'conditions': [ 303 [ 'skia_arch_type == "x86"', { 304 'yasm_format': '-felf', 305 'yasm_flags': [ 306 '-D__x86__', 307 '-DELF', 308 ], 309 }, { 310 'yasm_format': '-felf64', 311 'yasm_flags': [ 312 '-D__x86_64__', 313 '-DELF', 314 ], 315 }], 316 ], 317 }, 318 }], 319 ], 320 'rules': [ 321 { 322 'rule_name': 'assemble', 323 'extension': 'asm', 324 'conditions': [ 325 [ '(skia_arch_type == "x86" or skia_arch_type == "x86_64") and \ 326 (skia_os != "android" or host_os == "linux")', { 327 'inputs': [], 328 'outputs': [ 329 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)', 330 ], 331 'action': [ 332 '<(yasm_path)', 333 '<(yasm_format)', 334 '<@(yasm_flags)', 335 '-DRGBX_FILLER_0XFF', 336 '-DSTRICT_MEMORY_ACCESS', 337 '-Isimd/', 338 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)', 339 '<(RULE_INPUT_PATH)', 340 ], 341 'process_outputs_as_sources': 1, 342 'message': 'Building <(RULE_INPUT_ROOT).<(object_suffix)', 343 }], 344 ] 345 }, 346 ], 347 }, 348 ], 349 } 350