# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. if (defined(ohos_lite)) { import("//build/lite/config/component/lite_component.gni") } else { import("//build/ohos.gni") } jpeg_sources = [ "jcapimin.c", "jcapistd.c", "jccoefct.c", "jccolor.c", "jcdctmgr.c", "jchuff.c", "jcicc.c", "jcinit.c", "jcmainct.c", "jcmarker.c", "jcmaster.c", "jcomapi.c", "jcparam.c", "jcphuff.c", "jcprepct.c", "jcsample.c", "jctrans.c", "jdapimin.c", "jdapistd.c", "jdatadst.c", "jdatasrc.c", "jdcoefct.c", "jdcolor.c", "jddctmgr.c", "jdhuff.c", "jdicc.c", "jdinput.c", "jdmainct.c", "jdmarker.c", "jdmaster.c", "jdmerge.c", "jdphuff.c", "jdpostct.c", "jdsample.c", "jdtrans.c", "jerror.c", "jfdctflt.c", "jfdctfst.c", "jfdctint.c", "jidctflt.c", "jidctfst.c", "jidctint.c", "jidctred.c", "jmemmgr.c", "jmemnobs.c", "jquant1.c", "jquant2.c", "jutils.c", ] mkernel = defined(ohos_kernel_type) && ohos_kernel_type == "liteos_m" if (mkernel || is_win) { jpeg_sources += [ "jsimd_none.c" ] } else if (current_cpu == "arm") { jpeg_sources += [ "simd/arm/jsimd.c", "simd/arm/jsimd_neon.S", ] } else if (current_cpu == "arm64") { jpeg_sources += [ "simd/arm64/jsimd.c", "simd/arm64/jsimd_neon.S", ] } else { jpeg_sources += [ "jsimd_none.c" ] } define_config = [] if (!defined(ohos_lite)) { jpeg_sources += [ # enable arith codec "jaricom.c", "jcarith.c", "jdarith.c", "jdatadst-tj.c", "jdatasrc-tj.c", "rdbmp.c", "rdppm.c", "transupp.c", # enable turbo "turbojpeg.c", "wrbmp.c", "wrppm.c", ] define_config += [ "C_ARITH_CODING_SUPPORTED=1", #Support arithmetic encoding "D_ARITH_CODING_SUPPORTED=1", #Support arithmetic decoding "BMP_SUPPORTED=1", #Support arithmetic decoding "PPM_SUPPORTED=1", #Support arithmetic decoding ] } config("turbojpeg_config") { include_dirs = [ "//third_party/libjpeg-turbo" ] defines = define_config } if (defined(ohos_lite)) { lite_library("libjpeg") { if (ohos_kernel_type == "liteos_m") { target_type = "static_library" } else { target_type = "shared_library" } sources = jpeg_sources public_configs = [ ":turbojpeg_config" ] if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") { cflags = [ "--diag_suppress", "Pa181,Pe301,Pe546", ] cflags_cc = cflags } } } else { ohos_static_library("turbojpeg_static") { sources = jpeg_sources public_configs = [ ":turbojpeg_config" ] } ohos_shared_library("turbojpeg") { sources = jpeg_sources public_configs = [ ":turbojpeg_config" ] } }