naiveproxy/build/secondary/third_party/libjpeg_turbo/BUILD.gn
2018-01-29 00:30:36 +08:00

222 lines
4.9 KiB
Plaintext

# 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")
}
assert(!is_ios, "This is not used on iOS, don't drag it in unintentionally")
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" ]
if (current_cpu == "x86") {
defines += [ "WIN32" ]
} else {
defines += [ "WIN64" ]
}
} else if (is_mac || is_ios) {
defines += [ "MACHO" ]
} else if (is_linux || is_android || is_fuchsia) {
defines += [ "ELF" ]
}
}
}
static_library("simd") {
if (current_cpu == "x86") {
deps = [
":simd_asm",
]
sources = [
"simd/jsimd_i386.c",
]
} 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 if (current_cpu == "arm64") {
sources = [
"simd/jsimd_arm64.c",
"simd/jsimd_arm64_neon.S",
]
} else {
sources = [
"jsimd_none.c",
]
}
if (is_win) {
cflags = [ "/wd4245" ]
}
}
config("libjpeg_config") {
include_dirs = [ "." ]
}
static_library("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 += [ ":libjpeg_config" ]
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",
]
}
}