From 0e5d892fe86d7c2527d8f7b7ac2c5aa8fc77a7be Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 6 Apr 2017 21:43:50 -0700 Subject: Use libjpeg-turbo instead of our own copy of libjpeg. Check out libjpeg-turbo via DEPS. Also checkout yasm via DEPS and copy some yasm build files from Chromium. BUG=chromium:541704,pdfium:389 Change-Id: Ic7af415f002a3ca2acd9223ed3474dedf3930b32 Reviewed-on: https://pdfium-review.googlesource.com/3470 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- third_party/BUILD.gn | 107 ++++++++++++++++----------------------------------- 1 file changed, 33 insertions(+), 74 deletions(-) (limited to 'third_party/BUILD.gn') diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn index 81f919046f..c270a1063a 100644 --- a/third_party/BUILD.gn +++ b/third_party/BUILD.gn @@ -280,83 +280,42 @@ static_library("fx_lcms2") { ] } -# This is only used for standalone builds. -config("jpeg_warnings") { - visibility = [ ":*" ] - if (is_clang) { - cflags = [ "-Wno-shift-negative-value" ] +if (!build_with_chromium) { + declare_args() { + # Uses system libjpeg. If true, overrides use_libjpeg_turbo. + use_system_libjpeg = false + + # Uses libjpeg_turbo as the jpeg implementation. Has no effect if + # use_system_libjpeg is set. + use_libjpeg_turbo = true } -} -static_library("jpeg") { - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - "//build/config/compiler:no_chromium_code", - ":pdfium_third_party_config", + config("system_libjpeg_config") { + libs = [ "jpeg" ] + defines = [ "USE_SYSTEM_LIBJPEG" ] + } - # Must be after no_chromium_code for warning flags to be ordered correctly. - ":jpeg_warnings", - ] - sources = [ - "libjpeg/cderror.h", - "libjpeg/cdjpeg.h", - "libjpeg/fpdfapi_jcapimin.c", - "libjpeg/fpdfapi_jcapistd.c", - "libjpeg/fpdfapi_jccoefct.c", - "libjpeg/fpdfapi_jccolor.c", - "libjpeg/fpdfapi_jcdctmgr.c", - "libjpeg/fpdfapi_jchuff.c", - "libjpeg/fpdfapi_jcinit.c", - "libjpeg/fpdfapi_jcmainct.c", - "libjpeg/fpdfapi_jcmarker.c", - "libjpeg/fpdfapi_jcmaster.c", - "libjpeg/fpdfapi_jcomapi.c", - "libjpeg/fpdfapi_jcparam.c", - "libjpeg/fpdfapi_jcphuff.c", - "libjpeg/fpdfapi_jcprepct.c", - "libjpeg/fpdfapi_jcsample.c", - "libjpeg/fpdfapi_jctrans.c", - "libjpeg/fpdfapi_jdapimin.c", - "libjpeg/fpdfapi_jdapistd.c", - "libjpeg/fpdfapi_jdcoefct.c", - "libjpeg/fpdfapi_jdcolor.c", - "libjpeg/fpdfapi_jddctmgr.c", - "libjpeg/fpdfapi_jdhuff.c", - "libjpeg/fpdfapi_jdinput.c", - "libjpeg/fpdfapi_jdmainct.c", - "libjpeg/fpdfapi_jdmarker.c", - "libjpeg/fpdfapi_jdmaster.c", - "libjpeg/fpdfapi_jdmerge.c", - "libjpeg/fpdfapi_jdphuff.c", - "libjpeg/fpdfapi_jdpostct.c", - "libjpeg/fpdfapi_jdsample.c", - "libjpeg/fpdfapi_jdtrans.c", - "libjpeg/fpdfapi_jerror.c", - "libjpeg/fpdfapi_jfdctfst.c", - "libjpeg/fpdfapi_jfdctint.c", - "libjpeg/fpdfapi_jidctfst.c", - "libjpeg/fpdfapi_jidctint.c", - "libjpeg/fpdfapi_jidctred.c", - "libjpeg/fpdfapi_jmemmgr.c", - "libjpeg/fpdfapi_jmemnobs.c", - "libjpeg/fpdfapi_jutils.c", - "libjpeg/jchuff.h", - "libjpeg/jconfig.h", - "libjpeg/jdct.h", - "libjpeg/jdhuff.h", - "libjpeg/jerror.h", - "libjpeg/jinclude.h", - "libjpeg/jmemsys.h", - "libjpeg/jmorecfg.h", - "libjpeg/jpegint.h", - "libjpeg/jpeglib.h", - "libjpeg/jversion.h", - "libjpeg/makefile", - "libjpeg/transupp.h", - ] - deps = [ - "..:fxcrt", - ] + config("libjpeg_turbo_config") { + defines = [ "USE_LIBJPEG_TURBO=1" ] + } + + # This is a meta target that forwards to the system's libjpeg, + # third_party/libjpeg, or third_party/libjpeg_turbo depending on the build args + # declared in this file. + group("jpeg") { + if (use_system_libjpeg) { + public_configs = [ ":system_libjpeg_config" ] + } else if (use_libjpeg_turbo) { + public_deps = [ + "//third_party/libjpeg_turbo:libjpeg", + ] + public_configs = [ ":libjpeg_turbo_config" ] + } else { + public_deps = [ + "//third_party/libjpeg:libjpeg", + ] + } + } } config("fx_libopenjpeg_warnings") { -- cgit v1.2.3