Index: build/secondary/third_party/libjpeg_turbo/BUILD.gn |
diff --git a/build/secondary/third_party/libjpeg_turbo/BUILD.gn b/build/secondary/third_party/libjpeg_turbo/BUILD.gn |
new file mode 100644 |
index 0000000000000000000000000000000000000000..62e60aed0dbaef491bfc12b7af01687874c5e8a3 |
--- /dev/null |
+++ b/build/secondary/third_party/libjpeg_turbo/BUILD.gn |
@@ -0,0 +1,221 @@ |
+# Copyright 2014 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+# Do not use the targets in this file unless you need a certain libjpeg |
+# implementation. Use the meta target //third_party:jpeg instead. |
+ |
+import("//build/config/sanitizers/sanitizers.gni") |
+ |
+if (current_cpu == "arm") { |
+ import("//build/config/arm.gni") |
+} |
+ |
+if (current_cpu == "x86" || current_cpu == "x64") { |
+ import("//third_party/yasm/yasm_assemble.gni") |
+ |
+ yasm_assemble("simd_asm") { |
+ defines = [] |
+ |
+ if (current_cpu == "x86") { |
+ sources = [ |
+ "simd/jccolor-mmx.asm", |
+ "simd/jccolor-sse2.asm", |
+ "simd/jcgray-mmx.asm", |
+ "simd/jcgray-sse2.asm", |
+ "simd/jchuff-sse2.asm", |
+ "simd/jcsample-mmx.asm", |
+ "simd/jcsample-sse2.asm", |
+ "simd/jdcolor-mmx.asm", |
+ "simd/jdcolor-sse2.asm", |
+ "simd/jdmerge-mmx.asm", |
+ "simd/jdmerge-sse2.asm", |
+ "simd/jdsample-mmx.asm", |
+ "simd/jdsample-sse2.asm", |
+ "simd/jfdctflt-3dn.asm", |
+ "simd/jfdctflt-sse.asm", |
+ "simd/jfdctfst-mmx.asm", |
+ "simd/jfdctfst-sse2.asm", |
+ "simd/jfdctint-mmx.asm", |
+ "simd/jfdctint-sse2.asm", |
+ "simd/jidctflt-3dn.asm", |
+ "simd/jidctflt-sse.asm", |
+ "simd/jidctflt-sse2.asm", |
+ "simd/jidctfst-mmx.asm", |
+ "simd/jidctfst-sse2.asm", |
+ "simd/jidctint-mmx.asm", |
+ "simd/jidctint-sse2.asm", |
+ "simd/jidctred-mmx.asm", |
+ "simd/jidctred-sse2.asm", |
+ "simd/jquant-3dn.asm", |
+ "simd/jquant-mmx.asm", |
+ "simd/jquant-sse.asm", |
+ "simd/jquantf-sse2.asm", |
+ "simd/jquanti-sse2.asm", |
+ "simd/jsimdcpu.asm", |
+ ] |
+ defines += [ |
+ "__x86__", |
+ "PIC", |
+ ] |
+ } else if (current_cpu == "x64") { |
+ sources = [ |
+ "simd/jccolor-sse2-64.asm", |
+ "simd/jcgray-sse2-64.asm", |
+ "simd/jchuff-sse2-64.asm", |
+ "simd/jcsample-sse2-64.asm", |
+ "simd/jdcolor-sse2-64.asm", |
+ "simd/jdmerge-sse2-64.asm", |
+ "simd/jdsample-sse2-64.asm", |
+ "simd/jfdctflt-sse-64.asm", |
+ "simd/jfdctfst-sse2-64.asm", |
+ "simd/jfdctint-sse2-64.asm", |
+ "simd/jidctflt-sse2-64.asm", |
+ "simd/jidctfst-sse2-64.asm", |
+ "simd/jidctint-sse2-64.asm", |
+ "simd/jidctred-sse2-64.asm", |
+ "simd/jquantf-sse2-64.asm", |
+ "simd/jquanti-sse2-64.asm", |
+ ] |
+ defines += [ |
+ "__x86_64__", |
+ "PIC", |
+ ] |
+ } |
+ |
+ if (is_win) { |
+ defines += [ "MSVC" ] |
+ include_dirs = [ "win" ] |
+ if (current_cpu == "x86") { |
+ defines += [ "WIN32" ] |
+ } else { |
+ defines += [ "WIN64" ] |
+ } |
+ } else if (is_mac) { |
+ defines += [ "MACHO" ] |
+ include_dirs = [ "mac" ] |
+ } else if (is_linux || is_android) { |
+ defines += [ "ELF" ] |
+ include_dirs = [ "linux" ] |
+ } |
+ } |
+} |
+ |
+source_set("simd") { |
+ if (current_cpu == "x86") { |
+ deps = [ |
+ ":simd_asm", |
+ ] |
+ sources = [ |
+ "simd/jsimd_i386.c", |
+ ] |
+ if (is_win) { |
+ cflags = [ "/wd4245" ] |
+ } |
+ } else if (current_cpu == "x64") { |
+ deps = [ |
+ ":simd_asm", |
+ ] |
+ sources = [ |
+ "simd/jsimd_x86_64.c", |
+ ] |
+ } else if (current_cpu == "arm" && arm_version >= 7 && |
+ (arm_use_neon || arm_optionally_use_neon)) { |
+ sources = [ |
+ "simd/jsimd_arm.c", |
+ "simd/jsimd_arm_neon.S", |
+ ] |
+ } else { |
+ sources = [ |
+ "jsimd_none.c", |
+ ] |
+ } |
+ if (is_win) { |
+ cflags = [ "/wd4245" ] |
+ } |
+} |
+ |
+config("libjpeg_config") { |
+ include_dirs = [ "." ] |
+} |
+ |
+source_set("libjpeg") { |
+ sources = [ |
+ "jcapimin.c", |
+ "jcapistd.c", |
+ "jccoefct.c", |
+ "jccolor.c", |
+ "jcdctmgr.c", |
+ "jchuff.c", |
+ "jchuff.h", |
+ "jcinit.c", |
+ "jcmainct.c", |
+ "jcmarker.c", |
+ "jcmaster.c", |
+ "jcomapi.c", |
+ "jconfig.h", |
+ "jcparam.c", |
+ "jcphuff.c", |
+ "jcprepct.c", |
+ "jcsample.c", |
+ "jdapimin.c", |
+ "jdapistd.c", |
+ "jdatadst.c", |
+ "jdatasrc.c", |
+ "jdcoefct.c", |
+ "jdcolor.c", |
+ "jdct.h", |
+ "jddctmgr.c", |
+ "jdhuff.c", |
+ "jdhuff.h", |
+ "jdinput.c", |
+ "jdmainct.c", |
+ "jdmarker.c", |
+ "jdmaster.c", |
+ "jdmerge.c", |
+ "jdphuff.c", |
+ "jdpostct.c", |
+ "jdsample.c", |
+ "jerror.c", |
+ "jerror.h", |
+ "jfdctflt.c", |
+ "jfdctfst.c", |
+ "jfdctint.c", |
+ "jidctflt.c", |
+ "jidctfst.c", |
+ "jidctint.c", |
+ "jidctred.c", |
+ "jinclude.h", |
+ "jmemmgr.c", |
+ "jmemnobs.c", |
+ "jmemsys.h", |
+ "jmorecfg.h", |
+ "jpegint.h", |
+ "jpeglib.h", |
+ "jpeglibmangler.h", |
+ "jquant1.c", |
+ "jquant2.c", |
+ "jutils.c", |
+ "jversion.h", |
+ ] |
+ |
+ defines = [ |
+ "WITH_SIMD", |
+ "NO_GETENV", |
+ ] |
+ |
+ configs -= [ "//build/config/compiler:chromium_code" ] |
+ configs += [ "//build/config/compiler:no_chromium_code" ] |
+ |
+ public_configs = [ ":libjpeg_config" ] |
+ |
+ # MemorySanitizer doesn't support assembly code, so keep it disabled in |
+ # MSan builds for now. |
+ if (is_msan) { |
+ sources += [ "jsimd_none.c" ] |
+ } else { |
+ deps = [ |
+ ":simd", |
+ ] |
+ } |
+} |