1# Copyright (C) 2022 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_var.gni")
15
16# source code for Windows.
17use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64"
18use_clang_mac = "${current_os}_${current_cpu}" == "mac_x64"
19use_clang_ios = current_os == "ios" || current_os == "tvos"
20use_clang_android = current_os == "android"
21
22# Toolchain
23windows_buildtool = "//build/toolchain/mingw:mingw_x86_64"
24mac_buildtool = "//build/toolchain/mac:clang_x64"
25
26# Defines
27image_decode_windows_defines = [ "_WIN32" ]
28image_decode_mac_defines = [ "_APPLE" ]
29image_decode_ios_defines = [ "IOS_PLATFORM" ]
30image_decode_android_defines = [ "ANDROID_PLATFORM" ]
31image_sep_f = "/f"
32image_sep_p = "/p"
33image_oundation = "oundation"
34image_lugins = "lugins"
35image_multimedia = "multimedia"
36image_dir = "image_framework"
37image_subsystem = "/$image_sep_f$image_oundation/$image_multimedia/$image_dir"
38ipc_subsystem = "/$image_sep_f$image_oundation"
39graphic_multimedia = "graphic"
40graphic_dir = "graphic_2d"
41graphic_subsystem =
42    "/$image_sep_f$image_oundation/$graphic_multimedia/$graphic_dir"
43plugins_lib_root = "/$image_sep_p$image_lugins/libs"
44comlib_sep_c = "/c"
45comlib_ommonlibrary = "ommonlibrary"
46commonlibrary_c_utils = "c_utils"
47commonlibrary_subsystem =
48    "/$comlib_sep_c$comlib_ommonlibrary/$commonlibrary_c_utils"
49commonlibrary_memory_utils = "memory_utils"
50comlibmemory_subsystem =
51    "/$comlib_sep_c$comlib_ommonlibrary/$commonlibrary_memory_utils"
52base_sep_b = "/b"
53base_ase = "ase"
54resource_management_subsystem =
55    "/$base_sep_b$base_ase/global/resource_management"
56graphic_surface_root = "//foundation/graphic/graphic_surface"
57
58# skia
59image_use_new_skia = defined(use_new_skia) && use_new_skia
60
61skia_root = "//third_party"
62skia_deps_root = skia_root
63skia_core = [ "$skia_deps_root/skia:skia_core" ]
64skia_skcms = [ "$skia_deps_root/skia:skcms" ]
65
66exif_root = "//third_party"
67
68if (use_clang_android) {
69  if (image_use_new_skia) {
70    skia_platform = [ "$skia_deps_root/skia:skia_android" ]
71  } else {
72    skia_platform = [ "$skia_deps_root/skia:ace_skia_android" ]
73  }
74} else if (use_clang_ios) {
75  if (image_use_new_skia) {
76    skia_platform = [ "$skia_deps_root/skia:skia_ios" ]
77  } else {
78    skia_platform = [ "$skia_deps_root/skia:ace_skia_ios" ]
79  }
80} else if (use_mingw_win) {
81  if (image_use_new_skia) {
82    skia_platform = [ "$skia_deps_root/skia:skia_windows" ]
83  } else {
84    skia_platform = [ "$skia_deps_root/skia:ace_skia_windows" ]
85  }
86} else if (use_clang_mac) {
87  if (image_use_new_skia) {
88    skia_platform = [ "$skia_deps_root/skia:skia_mac" ]
89  } else {
90    skia_platform = [ "$skia_deps_root/skia:ace_skia_mac" ]
91  }
92} else {
93  if (image_use_new_skia) {
94    skia_platform = [ "$skia_deps_root/skia:skia_ohos" ]
95  } else {
96    skia_platform = [ "$skia_deps_root/skia:ace_skia_ohos" ]
97  }
98}
99
100# hw_decoder
101declare_args() {
102  enable_jpeg_hw_decode = true
103  enable_heif_hw_decode = false
104  enable_libexif = true
105  enable_heif_hw_encode = false
106
107  if (defined(global_parts_info) &&
108      !defined(global_parts_info.hdf_drivers_interface_display)) {
109    enable_jpeg_hw_decode = false
110    enable_heif_hw_decode = false
111    enable_heif_hw_encode = false
112  }
113}
114