1# Copyright 2016 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6declare_args() { 7 skia_use_system_libjpeg_turbo = is_official_build 8} 9 10import("../third_party.gni") 11 12if (skia_use_system_libjpeg_turbo) { 13 system("libjpeg") { 14 libs = [ "jpeg" ] 15 } 16} else { 17 third_party("libjpeg") { 18 public_include_dirs = [ 19 ".", 20 "../externals/libjpeg-turbo", 21 ] 22 23 defines = [ 24 "TURBO_FOR_WINDOWS", 25 26 # Add support for arithmetic encoding (C_) and decoding (D_). 27 # This matches Android. Note that such JPEGs are likely rare, given lack of 28 # support by major browsers. 29 "C_ARITH_CODING_SUPPORTED=1", 30 "D_ARITH_CODING_SUPPORTED=1", 31 ] 32 33 if (!is_win || is_clang) { 34 defines += [ "USE_CLZ_INTRINSIC" ] # Cuts a 64K table. 35 } 36 37 sources = [ 38 "../externals/libjpeg-turbo/jaricom.c", 39 "../externals/libjpeg-turbo/jcapimin.c", 40 "../externals/libjpeg-turbo/jcapistd.c", 41 "../externals/libjpeg-turbo/jcarith.c", 42 "../externals/libjpeg-turbo/jccoefct.c", 43 "../externals/libjpeg-turbo/jccolor.c", 44 "../externals/libjpeg-turbo/jcdctmgr.c", 45 "../externals/libjpeg-turbo/jchuff.c", 46 "../externals/libjpeg-turbo/jcinit.c", 47 "../externals/libjpeg-turbo/jcmainct.c", 48 "../externals/libjpeg-turbo/jcmarker.c", 49 "../externals/libjpeg-turbo/jcmaster.c", 50 "../externals/libjpeg-turbo/jcomapi.c", 51 "../externals/libjpeg-turbo/jcparam.c", 52 "../externals/libjpeg-turbo/jcphuff.c", 53 "../externals/libjpeg-turbo/jcprepct.c", 54 "../externals/libjpeg-turbo/jcsample.c", 55 "../externals/libjpeg-turbo/jdapimin.c", 56 "../externals/libjpeg-turbo/jdapistd.c", 57 "../externals/libjpeg-turbo/jdarith.c", 58 "../externals/libjpeg-turbo/jdcoefct.c", 59 "../externals/libjpeg-turbo/jdcolor.c", 60 "../externals/libjpeg-turbo/jddctmgr.c", 61 "../externals/libjpeg-turbo/jdhuff.c", 62 "../externals/libjpeg-turbo/jdinput.c", 63 "../externals/libjpeg-turbo/jdmainct.c", 64 "../externals/libjpeg-turbo/jdmarker.c", 65 "../externals/libjpeg-turbo/jdmaster.c", 66 "../externals/libjpeg-turbo/jdmerge.c", 67 "../externals/libjpeg-turbo/jdphuff.c", 68 "../externals/libjpeg-turbo/jdpostct.c", 69 "../externals/libjpeg-turbo/jdsample.c", 70 "../externals/libjpeg-turbo/jerror.c", 71 "../externals/libjpeg-turbo/jfdctflt.c", 72 "../externals/libjpeg-turbo/jfdctfst.c", 73 "../externals/libjpeg-turbo/jfdctint.c", 74 "../externals/libjpeg-turbo/jidctflt.c", 75 "../externals/libjpeg-turbo/jidctfst.c", 76 "../externals/libjpeg-turbo/jidctint.c", 77 "../externals/libjpeg-turbo/jidctred.c", 78 "../externals/libjpeg-turbo/jmemmgr.c", 79 "../externals/libjpeg-turbo/jmemnobs.c", 80 "../externals/libjpeg-turbo/jpeg_nbits_table.c", 81 "../externals/libjpeg-turbo/jquant1.c", 82 "../externals/libjpeg-turbo/jquant2.c", 83 "../externals/libjpeg-turbo/jutils.c", 84 ] 85 86 if (!is_win && (current_cpu == "arm" || current_cpu == "arm64")) { 87 defines += [ "NEON_INTRINSICS" ] 88 sources += [ 89 "../externals/libjpeg-turbo/simd/arm/jccolor-neon.c", 90 "../externals/libjpeg-turbo/simd/arm/jcgray-neon.c", 91 "../externals/libjpeg-turbo/simd/arm/jcphuff-neon.c", 92 "../externals/libjpeg-turbo/simd/arm/jcsample-neon.c", 93 "../externals/libjpeg-turbo/simd/arm/jdcolor-neon.c", 94 "../externals/libjpeg-turbo/simd/arm/jdmerge-neon.c", 95 "../externals/libjpeg-turbo/simd/arm/jdsample-neon.c", 96 "../externals/libjpeg-turbo/simd/arm/jfdctfst-neon.c", 97 "../externals/libjpeg-turbo/simd/arm/jfdctint-neon.c", 98 "../externals/libjpeg-turbo/simd/arm/jidctfst-neon.c", 99 "../externals/libjpeg-turbo/simd/arm/jidctint-neon.c", 100 "../externals/libjpeg-turbo/simd/arm/jidctred-neon.c", 101 "../externals/libjpeg-turbo/simd/arm/jquanti-neon.c", 102 ] 103 include_dirs = [ "../externals/libjpeg-turbo/simd/arm" ] 104 if (current_cpu == "arm") { 105 sources += [ 106 "../externals/libjpeg-turbo/simd/arm/aarch32/jchuff-neon.c", 107 "../externals/libjpeg-turbo/simd/arm/aarch32/jsimd.c", 108 ] 109 } else if (current_cpu == "arm64") { 110 sources += [ 111 "../externals/libjpeg-turbo/simd/arm/aarch64/jchuff-neon.c", 112 "../externals/libjpeg-turbo/simd/arm/aarch64/jsimd.c", 113 ] 114 } 115 } else { 116 sources += [ "../externals/libjpeg-turbo/jsimd_none.c" ] 117 } 118 } 119} 120