• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/multimedia/image_framework/ide/image_decode_config.gni")
16third_party_dir = "/third_party"
17third_party_root = "/${third_party_dir}"
18if (use_mingw_win || use_clang_mac) {
19  graphic_root = "/${image_sep_f}${image_oundation}/${graphic_multimedia}"
20}
21
22ohos_static_library("exifhelper") {
23  if (!use_clang_android && !use_clang_ios) {
24    sanitize = {
25      cfi = true
26      cfi_cross_dso = true
27      debug = false
28    }
29  }
30  sources = [
31    "../libjpegplugin/src/exif_info.cpp",
32    "../libjpegplugin/src/exif_maker_note.cpp",
33  ]
34  include_dirs = [
35    "../libjpegplugin/include",
36    "${image_subsystem}/frameworks/innerkitsimpl/utils/include",
37    "${image_subsystem}/interfaces/innerkits/include",
38    "//third_party/libexif",
39  ]
40  deps = [ "//third_party/libexif:libexif" ]
41  external_deps = [
42    "c_utils:utils",
43    "graphic_surface:surface",
44    "hilog:libhilog",
45    "hitrace:hitrace_meter",
46  ]
47  part_name = "image_framework"
48  subsystem_name = "multimedia"
49}
50
51config("plugins_includes") {
52  include_dirs = [
53    "${image_subsystem}/plugins/manager/include",
54    "${image_subsystem}/plugins/manager/include/image",
55    "${image_subsystem}/plugins/manager/include/pluginbase",
56  ]
57}
58config("skia_includes") {
59  include_dirs = [
60    "${skia_root}/skia",
61    "${skia_root}/skia/include/codec",
62    "${skia_root}/skia/include/core",
63    "${skia_root}/skia/third_party/skcms",
64  ]
65}
66config("third_part_includes") {
67  include_dirs = [
68    "../libjpegplugin/include",
69    "${third_party_root}/libexif",
70  ]
71}
72config("win_config") {
73  if (use_mingw_win) {
74    defines = image_decode_windows_defines
75    include_dirs += [
76      "${image_subsystem}/mock/native/include",
77      "${image_subsystem}/mock/native/include/secure",
78      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/codec",
79      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config",
80      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config/win",
81      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/core",
82    ]
83  }
84}
85config("mac_config") {
86  if (use_clang_mac) {
87    defines = image_decode_mac_defines
88    include_dirs += [
89      "${image_subsystem}/mock/native/include",
90      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/codec",
91      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/core",
92      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config/mac",
93      "${asdk_dir}/static_library/${target_os}_${target_cpu}/include/external/skia/include/config",
94      "${third_party_root}/bounds_checking_function/include",
95    ]
96  }
97}
98
99ohos_shared_library("textureEncoderCL") {
100  if (!use_clang_android && !use_clang_ios) {
101    sanitize = {
102      cfi = true
103      cfi_cross_dso = true
104      debug = false
105      blocklist = "./cfi_blocklist.txt"
106    }
107  }
108  sources = [ "src/texture_encode/image_compressor.cpp" ]
109  include_dirs = [
110    "${image_subsystem}/frameworks/innerkitsimpl/utils/include",
111    "${image_subsystem}/interfaces/innerkits/include",
112    "include/texture_encode",
113  ]
114  if (use_mingw_win) {
115    configs += [ ":win_config" ]
116  } else if (use_clang_mac) {
117    configs += [ ":mac_config" ]
118  } else {
119    deps = [ "//third_party/opencl-headers:libcl" ]
120    external_deps = [
121      "c_utils:utils",
122      "hilog:libhilog",
123    ]
124  }
125  cflags = [ "-O3" ]
126  cflags_cc = [ "-O3" ]
127  subsystem_name = "multimedia"
128  part_name = "image_framework"
129}
130
131ohos_shared_library("extplugin") {
132  if (!use_clang_android && !use_clang_ios) {
133    sanitize = {
134      cfi = true
135      cfi_cross_dso = true
136      debug = false
137    }
138  }
139  sources = [
140    "src/ext_decoder.cpp",
141    "src/ext_encoder.cpp",
142    "src/ext_pixel_convert.cpp",
143    "src/ext_stream.cpp",
144    "src/ext_wstream.cpp",
145    "src/plugin_export.cpp",
146    "src/texture_encode/astc_codec.cpp",
147  ]
148  if (enable_jpeg_hw_decode) {
149    sources += [ "src/hardware/jpeg_hw_decoder.cpp" ]
150  }
151  configs = [
152    ":plugins_includes",
153    ":skia_includes",
154    ":third_part_includes",
155  ]
156  include_dirs = [
157    "include",
158    "include/texture_encode",
159    "${image_subsystem}/interfaces/innerkits/include",
160    "${image_subsystem}/frameworks/innerkitsimpl/utils/include",
161    "${graphic_subsystem}/interfaces/inner_api/surface",
162    "${image_subsystem}/../../../drivers/peripheral/base/",
163    "${image_subsystem}/../../../drivers/peripheral/display/interfaces/include/",
164    "${image_subsystem}/../../../third_party/skia/",
165    "${image_subsystem}/../../../third_party/skia/include/codec/",
166    "${image_subsystem}/../../../third_party/skia/include/core/",
167    "${image_subsystem}/../../../third_party/libjpeg-turbo/",
168    "//third_party/astc-encoder/Source",
169    "//third_party/skia",
170    "//third_party/skia/include/codec",
171    "//third_party/skia/include/core",
172    "//third_party/libjpeg-turbo",
173    "${image_subsystem}/../../../drivers/peripheral/base",
174    "${image_subsystem}/../../../drivers/peripheral/display/interfaces/include",
175  ]
176  if (use_mingw_win) {
177    configs += [ ":win_config" ]
178    deps = [
179      "${graphic_root}/ide/libs/skia:skia",
180      "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils_static",
181      "${image_subsystem}/mock/native:log_mock_static",
182      "${image_subsystem}/plugins/manager:pluginmanager_static",
183    ]
184    deps += skia_core
185  } else if (use_clang_mac) {
186    configs += [ ":mac_config" ]
187    deps = [
188      "${graphic_root}/ide/libs/skia:skia",
189      "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils_static",
190      "${image_subsystem}/mock/native:log_mock_static",
191      "${image_subsystem}/plugins/manager:pluginmanager_static",
192      "${third_party_root}/bounds_checking_function:libsec_static",
193    ]
194  } else {
195    include_dirs += [ "${commonlibrary_subsystem}/base/include" ]
196    deps = [
197      ":exifhelper",
198      "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils",
199      "${image_subsystem}/interfaces/innerkits:image_native",
200      "${image_subsystem}/plugins/manager:pluginmanager",
201      "//third_party/astc-encoder:astc_encoder_shared",
202    ]
203    if (defined(global_parts_info) &&
204        defined(global_parts_info.open_source_libyuv)) {
205      deps += [
206        ":textureEncoderCL",
207        "//third_party/opencl-headers:libcl",
208      ]
209    }
210    deps += skia_platform
211
212    external_deps = [
213      "c_utils:utils",
214      "graphic_2d:color_manager",
215      "hilog:libhilog",
216      "hisysevent:libhisysevent",
217    ]
218
219    if (enable_jpeg_hw_decode) {
220      external_deps += [
221        "drivers_interface_codec:image_idl_headers",
222        "drivers_interface_codec:libimage_proxy_1.0",
223        "drivers_interface_display:display_buffer_idl_headers",
224        "drivers_interface_display:display_composer_idl_headers",
225        "drivers_interface_display:libdisplay_buffer_hdi_impl",
226        "drivers_interface_display:libdisplay_composer_hdi_impl",
227        "hdf_core:libhdf_utils",
228        "hdf_core:libhdi",
229        "ipc:ipc_single",
230      ]
231      defines = [ "JPEG_HW_DECODE_ENABLE" ]
232    }
233  }
234  cflags = [
235    "-DIMAGE_COLORSPACE_FLAG",
236    "-O3",
237  ]
238  if (defined(global_parts_info) &&
239      defined(global_parts_info.open_source_libyuv)) {
240    defines += [ "ENABLE_ASTC_ENCODE_BASED_GPU" ]
241  }
242  cflags_cc = [ "-O3" ]
243  subsystem_name = "multimedia"
244  part_name = "image_framework"
245}
246
247ohos_prebuilt_etc("extpluginmetadata") {
248  source = "extplugin.pluginmeta"
249  relative_install_dir = "multimediaplugin/image"
250  subsystem_name = "multimedia"
251  part_name = "image_framework"
252}
253