# Copyright (C) 2023 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. import("//build/ohos.gni") import("//foundation/multimedia/image_framework/ide/image_decode_config.gni") third_party_dir = "/third_party" third_party_root = "/${third_party_dir}" if (use_mingw_win || use_clang_mac) { graphic_root = "/${image_sep_f}${image_oundation}/${graphic_multimedia}" } ohos_static_library("exifhelper") { if (!use_clang_android && !use_clang_ios) { sanitize = { cfi = true cfi_cross_dso = true debug = false } } sources = [ "../libjpegplugin/src/exif_info.cpp", "../libjpegplugin/src/exif_maker_note.cpp", ] include_dirs = [ "../libjpegplugin/include", "${image_subsystem}/frameworks/innerkitsimpl/utils/include", "${image_subsystem}/interfaces/innerkits/include", "//third_party/libexif", ] deps = [ "//third_party/libexif:libexif" ] external_deps = [ "c_utils:utils", "graphic_surface:surface", "hilog:libhilog", "hitrace:hitrace_meter", ] part_name = "image_framework" subsystem_name = "multimedia" } config("plugins_includes") { include_dirs = [ "${image_subsystem}/plugins/manager/include", "${image_subsystem}/plugins/manager/include/image", "${image_subsystem}/plugins/manager/include/pluginbase", ] } config("skia_includes") { include_dirs = [ "${skia_root}/skia", "${skia_root}/skia/include/codec", "${skia_root}/skia/include/core", "${skia_root}/skia/third_party/skcms", ] } config("third_part_includes") { include_dirs = [ "../libjpegplugin/include", "${third_party_root}/libexif", ] } config("win_config") { if (use_mingw_win) { defines = image_decode_windows_defines include_dirs += [ "${image_subsystem}/mock/native/include", "${image_subsystem}/mock/native/include/secure", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/codec", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config/win", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/core", ] } } config("mac_config") { if (use_clang_mac) { defines = image_decode_mac_defines include_dirs += [ "${image_subsystem}/mock/native/include", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/codec", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/core", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config/mac", "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config", "${third_party_root}/bounds_checking_function/include", ] } } ohos_shared_library("textureEncoderCL") { if (!use_clang_android && !use_clang_ios) { sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "./cfi_blocklist.txt" } } sources = [ "src/texture_encode/image_compressor.cpp" ] include_dirs = [ "${image_subsystem}/frameworks/innerkitsimpl/utils/include", "${image_subsystem}/interfaces/innerkits/include", "include/texture_encode", ] if (use_mingw_win) { configs += [ ":win_config" ] } else if (use_clang_mac) { configs += [ ":mac_config" ] } else { deps = [ "//third_party/opencl-headers:libcl" ] external_deps = [ "c_utils:utils", "hilog:libhilog", ] } cflags = [ "-O3" ] cflags_cc = [ "-O3" ] subsystem_name = "multimedia" part_name = "image_framework" } ohos_shared_library("extplugin") { if (!use_clang_android && !use_clang_ios) { sanitize = { cfi = true cfi_cross_dso = true debug = false } } sources = [ "src/ext_decoder.cpp", "src/ext_encoder.cpp", "src/ext_pixel_convert.cpp", "src/ext_stream.cpp", "src/ext_wstream.cpp", "src/plugin_export.cpp", "src/texture_encode/astc_codec.cpp", ] if (enable_jpeg_hw_decode) { sources += [ "src/hardware/jpeg_hw_decoder.cpp" ] } configs = [ ":plugins_includes", ":skia_includes", ":third_part_includes", ] include_dirs = [ "include", "include/texture_encode", "${image_subsystem}/interfaces/innerkits/include", "${image_subsystem}/frameworks/innerkitsimpl/utils/include", "${graphic_subsystem}/interfaces/inner_api/surface", "${image_subsystem}/../../../drivers/peripheral/base/", "${image_subsystem}/../../../drivers/peripheral/display/interfaces/include/", "${image_subsystem}/../../../third_party/skia/", "${image_subsystem}/../../../third_party/skia/include/codec/", "${image_subsystem}/../../../third_party/skia/include/core/", "${image_subsystem}/../../../third_party/libjpeg-turbo/", "//third_party/astc-encoder/Source", "//third_party/skia", "//third_party/skia/include/codec", "//third_party/skia/include/core", "//third_party/libjpeg-turbo", "${image_subsystem}/../../../drivers/peripheral/base", "${image_subsystem}/../../../drivers/peripheral/display/interfaces/include", ] if (use_mingw_win) { configs += [ ":win_config" ] deps = [ "${graphic_root}/ide/libs/skia:skia", "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils_static", "${image_subsystem}/mock/native:log_mock_static", "${image_subsystem}/plugins/manager:pluginmanager_static", ] deps += skia_core } else if (use_clang_mac) { configs += [ ":mac_config" ] deps = [ "${graphic_root}/ide/libs/skia:skia", "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils_static", "${image_subsystem}/mock/native:log_mock_static", "${image_subsystem}/plugins/manager:pluginmanager_static", "${third_party_root}/bounds_checking_function:libsec_static", ] } else { include_dirs += [ "${commonlibrary_subsystem}/base/include" ] deps = [ ":exifhelper", "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils", "${image_subsystem}/interfaces/innerkits:image_native", "${image_subsystem}/plugins/manager:pluginmanager", "//third_party/astc-encoder:astc_encoder_shared", ] if (defined(global_parts_info) && defined(global_parts_info.open_source_libyuv)) { deps += [ ":textureEncoderCL", "//third_party/opencl-headers:libcl", ] } deps += skia_platform external_deps = [ "c_utils:utils", "graphic_2d:color_manager", "hilog:libhilog", "hisysevent:libhisysevent", ] if (enable_jpeg_hw_decode) { external_deps += [ "drivers_interface_codec:image_idl_headers", "drivers_interface_codec:libimage_proxy_1.0", "drivers_interface_display:display_buffer_idl_headers", "drivers_interface_display:display_composer_idl_headers", "drivers_interface_display:libdisplay_buffer_hdi_impl", "drivers_interface_display:libdisplay_composer_hdi_impl", "hdf_core:libhdf_utils", "hdf_core:libhdi", "ipc:ipc_single", ] defines = [ "JPEG_HW_DECODE_ENABLE" ] } } cflags = [ "-DIMAGE_COLORSPACE_FLAG", "-O3", ] if (defined(global_parts_info) && defined(global_parts_info.open_source_libyuv)) { defines += [ "ENABLE_ASTC_ENCODE_BASED_GPU" ] } cflags_cc = [ "-O3" ] subsystem_name = "multimedia" part_name = "image_framework" } ohos_prebuilt_etc("extpluginmetadata") { source = "extplugin.pluginmeta" relative_install_dir = "multimediaplugin/image" subsystem_name = "multimedia" part_name = "image_framework" }