blob: f7093bbd47df7a9e9aa0d9ba722f6306ab44ee53 [file] [log] [blame]
# Copyright 2016 The Fuchsia 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.
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",
]
}
defines += [ "ELF" ]
}
}
static_library("simd") {
if (!is_fuchsia) {
sources = [
"jsimd_none.c",
]
} else 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",
]
}
}
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",
"jquant1.c",
"jquant2.c",
"jutils.c",
"jversion.h",
]
defines = [
"WITH_SIMD",
"NO_GETENV",
]
configs += [ ":libjpeg_config" ]
public_configs = [ ":libjpeg_config" ]
deps = [
":simd",
]
}