OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 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 # Do not use the targets in this file unless you need a certain libjpeg |
| 6 # implementation. Use the meta target //third_party:jpeg instead. |
| 7 |
| 8 import("//build/config/sanitizers/sanitizers.gni") |
| 9 |
| 10 if (current_cpu == "arm") { |
| 11 import("//build/config/arm.gni") |
| 12 } |
| 13 |
| 14 if (current_cpu == "x86" || current_cpu == "x64") { |
| 15 import("//third_party/yasm/yasm_assemble.gni") |
| 16 |
| 17 yasm_assemble("simd_asm") { |
| 18 defines = [] |
| 19 |
| 20 if (current_cpu == "x86") { |
| 21 sources = [ |
| 22 "simd/jccolor-mmx.asm", |
| 23 "simd/jccolor-sse2.asm", |
| 24 "simd/jcgray-mmx.asm", |
| 25 "simd/jcgray-sse2.asm", |
| 26 "simd/jchuff-sse2.asm", |
| 27 "simd/jcsample-mmx.asm", |
| 28 "simd/jcsample-sse2.asm", |
| 29 "simd/jdcolor-mmx.asm", |
| 30 "simd/jdcolor-sse2.asm", |
| 31 "simd/jdmerge-mmx.asm", |
| 32 "simd/jdmerge-sse2.asm", |
| 33 "simd/jdsample-mmx.asm", |
| 34 "simd/jdsample-sse2.asm", |
| 35 "simd/jfdctflt-3dn.asm", |
| 36 "simd/jfdctflt-sse.asm", |
| 37 "simd/jfdctfst-mmx.asm", |
| 38 "simd/jfdctfst-sse2.asm", |
| 39 "simd/jfdctint-mmx.asm", |
| 40 "simd/jfdctint-sse2.asm", |
| 41 "simd/jidctflt-3dn.asm", |
| 42 "simd/jidctflt-sse.asm", |
| 43 "simd/jidctflt-sse2.asm", |
| 44 "simd/jidctfst-mmx.asm", |
| 45 "simd/jidctfst-sse2.asm", |
| 46 "simd/jidctint-mmx.asm", |
| 47 "simd/jidctint-sse2.asm", |
| 48 "simd/jidctred-mmx.asm", |
| 49 "simd/jidctred-sse2.asm", |
| 50 "simd/jquant-3dn.asm", |
| 51 "simd/jquant-mmx.asm", |
| 52 "simd/jquant-sse.asm", |
| 53 "simd/jquantf-sse2.asm", |
| 54 "simd/jquanti-sse2.asm", |
| 55 "simd/jsimdcpu.asm", |
| 56 ] |
| 57 defines += [ |
| 58 "__x86__", |
| 59 "PIC", |
| 60 ] |
| 61 } else if (current_cpu == "x64") { |
| 62 sources = [ |
| 63 "simd/jccolor-sse2-64.asm", |
| 64 "simd/jcgray-sse2-64.asm", |
| 65 "simd/jchuff-sse2-64.asm", |
| 66 "simd/jcsample-sse2-64.asm", |
| 67 "simd/jdcolor-sse2-64.asm", |
| 68 "simd/jdmerge-sse2-64.asm", |
| 69 "simd/jdsample-sse2-64.asm", |
| 70 "simd/jfdctflt-sse-64.asm", |
| 71 "simd/jfdctfst-sse2-64.asm", |
| 72 "simd/jfdctint-sse2-64.asm", |
| 73 "simd/jidctflt-sse2-64.asm", |
| 74 "simd/jidctfst-sse2-64.asm", |
| 75 "simd/jidctint-sse2-64.asm", |
| 76 "simd/jidctred-sse2-64.asm", |
| 77 "simd/jquantf-sse2-64.asm", |
| 78 "simd/jquanti-sse2-64.asm", |
| 79 ] |
| 80 defines += [ |
| 81 "__x86_64__", |
| 82 "PIC", |
| 83 ] |
| 84 } |
| 85 |
| 86 if (is_win) { |
| 87 defines += [ "MSVC" ] |
| 88 include_dirs = [ "win" ] |
| 89 if (current_cpu == "x86") { |
| 90 defines += [ "WIN32" ] |
| 91 } else { |
| 92 defines += [ "WIN64" ] |
| 93 } |
| 94 } else if (is_mac) { |
| 95 defines += [ "MACHO" ] |
| 96 include_dirs = [ "mac" ] |
| 97 } else if (is_linux || is_android) { |
| 98 defines += [ "ELF" ] |
| 99 include_dirs = [ "linux" ] |
| 100 } |
| 101 } |
| 102 } |
| 103 |
| 104 source_set("simd") { |
| 105 if (current_cpu == "x86") { |
| 106 deps = [ |
| 107 ":simd_asm", |
| 108 ] |
| 109 sources = [ |
| 110 "simd/jsimd_i386.c", |
| 111 ] |
| 112 if (is_win) { |
| 113 cflags = [ "/wd4245" ] |
| 114 } |
| 115 } else if (current_cpu == "x64") { |
| 116 deps = [ |
| 117 ":simd_asm", |
| 118 ] |
| 119 sources = [ |
| 120 "simd/jsimd_x86_64.c", |
| 121 ] |
| 122 } else if (current_cpu == "arm" && arm_version >= 7 && |
| 123 (arm_use_neon || arm_optionally_use_neon)) { |
| 124 sources = [ |
| 125 "simd/jsimd_arm.c", |
| 126 "simd/jsimd_arm_neon.S", |
| 127 ] |
| 128 } else { |
| 129 sources = [ |
| 130 "jsimd_none.c", |
| 131 ] |
| 132 } |
| 133 if (is_win) { |
| 134 cflags = [ "/wd4245" ] |
| 135 } |
| 136 } |
| 137 |
| 138 config("libjpeg_config") { |
| 139 include_dirs = [ "." ] |
| 140 } |
| 141 |
| 142 source_set("libjpeg") { |
| 143 sources = [ |
| 144 "jcapimin.c", |
| 145 "jcapistd.c", |
| 146 "jccoefct.c", |
| 147 "jccolor.c", |
| 148 "jcdctmgr.c", |
| 149 "jchuff.c", |
| 150 "jchuff.h", |
| 151 "jcinit.c", |
| 152 "jcmainct.c", |
| 153 "jcmarker.c", |
| 154 "jcmaster.c", |
| 155 "jcomapi.c", |
| 156 "jconfig.h", |
| 157 "jcparam.c", |
| 158 "jcphuff.c", |
| 159 "jcprepct.c", |
| 160 "jcsample.c", |
| 161 "jdapimin.c", |
| 162 "jdapistd.c", |
| 163 "jdatadst.c", |
| 164 "jdatasrc.c", |
| 165 "jdcoefct.c", |
| 166 "jdcolor.c", |
| 167 "jdct.h", |
| 168 "jddctmgr.c", |
| 169 "jdhuff.c", |
| 170 "jdhuff.h", |
| 171 "jdinput.c", |
| 172 "jdmainct.c", |
| 173 "jdmarker.c", |
| 174 "jdmaster.c", |
| 175 "jdmerge.c", |
| 176 "jdphuff.c", |
| 177 "jdpostct.c", |
| 178 "jdsample.c", |
| 179 "jerror.c", |
| 180 "jerror.h", |
| 181 "jfdctflt.c", |
| 182 "jfdctfst.c", |
| 183 "jfdctint.c", |
| 184 "jidctflt.c", |
| 185 "jidctfst.c", |
| 186 "jidctint.c", |
| 187 "jidctred.c", |
| 188 "jinclude.h", |
| 189 "jmemmgr.c", |
| 190 "jmemnobs.c", |
| 191 "jmemsys.h", |
| 192 "jmorecfg.h", |
| 193 "jpegint.h", |
| 194 "jpeglib.h", |
| 195 "jpeglibmangler.h", |
| 196 "jquant1.c", |
| 197 "jquant2.c", |
| 198 "jutils.c", |
| 199 "jversion.h", |
| 200 ] |
| 201 |
| 202 defines = [ |
| 203 "WITH_SIMD", |
| 204 "NO_GETENV", |
| 205 ] |
| 206 |
| 207 configs -= [ "//build/config/compiler:chromium_code" ] |
| 208 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 209 |
| 210 public_configs = [ ":libjpeg_config" ] |
| 211 |
| 212 # MemorySanitizer doesn't support assembly code, so keep it disabled in |
| 213 # MSan builds for now. |
| 214 if (is_msan) { |
| 215 sources += [ "jsimd_none.c" ] |
| 216 } else { |
| 217 deps = [ |
| 218 ":simd", |
| 219 ] |
| 220 } |
| 221 } |
OLD | NEW |